/* StreamClipper — shared design tokens, base reset, layouts, and components.
   Linked by every app page (everything except the marketing landing). */

:root {
    --bg: #0a0a0f;
    --bg-card: #12121a;
    --bg-card-hover: #1a1a26;
    --border: #1e1e2e;
    --text: #e4e4eb;
    --text-muted: #8888a0;
    --accent: #6c5ce7;
    --accent-hover: #5a4bd4;
    --accent-light: #a29bfe;
    --accent-glow: rgba(108, 92, 231, 0.3);
    --green: #00b894;
    --red: #e74c3c;
    --yellow: #fdcb6e;
    --sidebar-w: 240px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif; }

body {
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ─── Floating top nav pill ──────────────────────────────────────────── */

nav.app-nav {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 48px);
    max-width: 1100px;
    z-index: 100;
    background: rgba(18, 18, 26, 0.7);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-nav .logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-light);
    text-decoration: none;
}

.app-nav .nav-back {
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.app-nav .nav-back:hover { color: var(--text); }

@media (max-width: 640px) {
    nav.app-nav { width: calc(100% - 32px); padding: 10px 16px; }
}

/* ─── Vertical sidebar (used by /dashboard, /account, /feedback) ─────── */

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: rgba(18, 18, 26, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    z-index: 50;
}

.sidebar-logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-light);
    text-decoration: none;
    padding: 0 12px 24px;
    display: block;
}

.sidebar-user {
    padding: 12px;
    margin-bottom: 16px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-plan {
    font-size: 11px;
    color: var(--accent-light);
    margin-top: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    font-size: 14px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.15s;
    border: 1px solid transparent;
}

.sidebar-link:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
}

.sidebar-link.active {
    color: var(--text);
    background: rgba(108, 92, 231, 0.12);
    border-color: rgba(108, 92, 231, 0.25);
}

.sidebar-link svg { flex-shrink: 0; opacity: 0.8; }
.sidebar-link.active svg { opacity: 1; color: var(--accent-light); }

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-footer .sidebar-link { font-size: 13px; }

.app-main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    padding: 48px 48px 60px;
}

@media (max-width: 860px) {
    .app-sidebar {
        position: static;
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        padding: 16px;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        overflow-x: auto;
    }
    .sidebar-logo { padding: 0 8px; }
    .sidebar-user { display: none; }
    .sidebar-nav { flex-direction: row; flex: 0 0 auto; }
    .sidebar-link { white-space: nowrap; }
    .sidebar-footer {
        border: none;
        padding: 0;
        flex-direction: row;
        margin-left: auto;
    }
    .app-main { margin-left: 0; padding: 28px 20px 48px; }
}

/* ─── Language switcher ──────────────────────────────────────────────── */

.lang-switcher {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.lang-switcher a {
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s;
}

.lang-switcher a:hover { color: var(--text); }

.lang-switcher a.active {
    background: var(--accent);
    color: #fff;
}

.sidebar-footer .lang-switcher {
    align-self: flex-start;
    margin-bottom: 8px;
}

@media (max-width: 860px) {
    .sidebar-footer .lang-switcher { margin-bottom: 0; margin-right: 8px; }
}

/* ─── Page wrappers ──────────────────────────────────────────────────── */

.page {
    max-width: 800px;
    margin: 0 auto;
}

.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.page-header p {
    color: var(--text-muted);
    font-size: 14px;
}

/* ─── Cards & sections ───────────────────────────────────────────────── */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
}

.section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 20px;
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.section-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.section-danger {
    border-color: rgba(231, 76, 60, 0.2);
}

.section-danger .section-title {
    color: var(--red);
}

/* ─── Buttons ────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    line-height: 1.2;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent);
}

.btn-outline {
    background: transparent;
    color: var(--accent-light);
    border: 1px solid var(--accent);
}

.btn-outline:hover {
    background: rgba(108, 92, 231, 0.1);
    transform: translateY(-1px);
}

.btn-danger {
    background: transparent;
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: var(--red);
}

.btn-danger:hover {
    background: rgba(231, 76, 60, 0.1);
    border-color: var(--red);
}

.btn-twitch {
    background: #9146ff;
    color: #fff;
}

.btn-twitch:hover {
    background: #7a2de0;
    transform: translateY(-1px);
}

.btn-discord {
    background: #5865f2;
    color: #fff;
}

.btn-discord:hover {
    background: #4752c4;
    transform: translateY(-1px);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-sm {
    padding: 10px 18px;
    font-size: 13px;
}

/* ─── Forms ──────────────────────────────────────────────────────────── */

.form-group {
    margin-bottom: 16px;
}

.form-group label,
.form-label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}

.form-group input:not([type="checkbox"]):not([type="radio"]),
.form-group textarea,
.form-group select,
.form-control {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 14px;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
    line-height: 1.5;
}

.form-group select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238888a0' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.form-group input:not([type="checkbox"]):not([type="radio"]):focus,
.form-group textarea:focus,
.form-group select:focus,
.form-control:focus {
    outline: none;
    border-color: var(--accent);
}

.form-group input::placeholder,
.form-group textarea::placeholder,
.form-control::placeholder {
    color: var(--text-muted);
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* ─── Flash / info / error messages ──────────────────────────────────── */

.flash,
.info-msg,
.error-msg {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 16px;
    line-height: 1.5;
}

.flash-error,
.error-msg {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: var(--red);
}

.flash-success {
    background: rgba(0, 184, 148, 0.1);
    border: 1px solid rgba(0, 184, 148, 0.3);
    color: var(--green);
}

.flash-info,
.info-msg {
    background: rgba(108, 92, 231, 0.1);
    border: 1px solid rgba(108, 92, 231, 0.3);
    color: var(--accent-light);
}

.flash-warn {
    background: rgba(253, 203, 110, 0.1);
    border: 1px solid rgba(253, 203, 110, 0.3);
    color: var(--yellow);
}

/* ─── Usage bar ──────────────────────────────────────────────────────── */

.usage-track {
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}

.usage-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--accent);
    transition: width 0.5s ease;
}

.usage-fill.warn { background: var(--yellow); }
.usage-fill.full { background: var(--red); }

/* ─── Status badges (jobs list) ──────────────────────────────────────── */

.job-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    margin-left: 16px;
}

.badge-pending,
.badge-cancelled { background: rgba(136, 136, 160, 0.15); color: var(--text-muted); }
.badge-running { background: rgba(253, 203, 110, 0.15); color: var(--yellow); }
.badge-completed { background: rgba(0, 184, 148, 0.15); color: var(--green); }
.badge-failed { background: rgba(231, 76, 60, 0.15); color: var(--red); }
