/* ============================================
   SJ88 TiktokAi2026 WebApp — Design System
   Modern dark theme with glassmorphism
   ============================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ---------- CSS Variables ---------- */
:root {
    /* Background layers */
    --bg-deep:       #030a14;
    --bg-base:       #071426;
    --bg-surface:    #0d1b32;
    --bg-elevated:   #122444;
    --bg-card:       rgba(13, 27, 50, 0.7);
    --bg-glass:      rgba(13, 27, 50, 0.45);

    /* Borders */
    --border-subtle: rgba(59, 130, 246, 0.12);
    --border-default: rgba(59, 130, 246, 0.2);
    --border-strong: rgba(59, 130, 246, 0.35);

    /* Text */
    --text-primary:   #e6edf5;
    --text-secondary: #94a3b8;
    --text-muted:     #64748b;
    --text-inverted:  #0f172a;

    /* Accents */
    --accent-gold:    #ffd84d;
    --accent-gold-dim: rgba(255, 216, 77, 0.15);
    --accent-blue:    #3b82f6;
    --accent-blue-dim: rgba(59, 130, 246, 0.15);
    --accent-cyan:    #22d3ee;
    --accent-cyan-dim: rgba(34, 211, 238, 0.15);
    --accent-purple:  #a78bfa;
    --accent-purple-dim: rgba(167, 139, 250, 0.15);

    /* Status */
    --success:        #42d392;
    --success-dim:    rgba(66, 211, 146, 0.15);
    --error:          #ff6b7a;
    --error-dim:      rgba(255, 107, 122, 0.12);
    --warn:           #ffbd59;
    --warn-dim:       rgba(255, 189, 89, 0.12);
    --info:           #60a5fa;
    --info-dim:       rgba(96, 165, 250, 0.12);

    /* Layout */
    --sidebar-width:  280px;
    --header-height:  72px;
    --radius-sm:      8px;
    --radius-md:      12px;
    --radius-lg:      18px;
    --radius-xl:      24px;

    /* Shadows */
    --shadow-card:    0 4px 24px rgba(0, 0, 0, 0.3), 0 1px 4px rgba(0, 0, 0, 0.2);
    --shadow-elevated: 0 8px 40px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-glow-gold: 0 0 20px rgba(255, 216, 77, 0.15);
    --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.15);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-main);
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
    transition: background 0.4s ease, color 0.4s ease;
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { color: var(--accent-cyan); }
.text-muted { color: var(--text-muted); }

/* Theme transition overlay */
body.theme-transitioning::before {
    content: '';
    position: fixed;
    inset: 0;
    background: transparent;
    z-index: 9999;
    pointer-events: none;
    animation: themeFlash 0.4s ease-out forwards;
}

@keyframes themeFlash {
    0% { opacity: 0; }
    20% { opacity: 1; background: rgba(255,255,255,0.05); }
    100% { opacity: 0; }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.4); }

/* ---------- App Shell ---------- */
.app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ---------- Auth Screen ---------- */
.auth-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 15%, rgba(59, 130, 246, 0.22), transparent 36%),
        radial-gradient(circle at 85% 10%, rgba(34, 211, 238, 0.16), transparent 30%),
        radial-gradient(circle at 80% 80%, rgba(167, 139, 250, 0.16), transparent 36%),
        linear-gradient(180deg, #030a14 0%, #071426 100%);
}

.auth-card {
    width: 100%;
    max-width: 430px;
    background: rgba(13, 27, 50, 0.82);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 28px 24px 24px;
    box-shadow: var(--shadow-elevated);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.auth-brand-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-gold), #ff9500);
    display: grid;
    place-items: center;
    font-size: 20px;
    box-shadow: var(--shadow-glow-gold);
}

.auth-brand h1 {
    font-size: 19px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.auth-brand p {
    margin-top: 3px;
    font-size: 13px;
    color: var(--text-muted);
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 18px;
}

.auth-tab {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: rgba(59, 130, 246, 0.05);
    color: var(--text-secondary);
    padding: 9px 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.auth-tab:hover {
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.auth-tab.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.22), rgba(37, 99, 235, 0.12));
    color: var(--text-primary);
    border-color: rgba(59, 130, 246, 0.45);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.auth-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.auth-field input {
    width: 100%;
    background: rgba(15, 23, 42, 0.76);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 11px 12px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.auth-field input::placeholder {
    color: var(--text-muted);
}

.auth-field input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}

.auth-remember {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
    font-size: 13px;
    color: var(--text-secondary);
    -webkit-user-select: none;
    user-select: none;
}

.auth-remember input {
    width: 15px;
    height: 15px;
    accent-color: var(--accent-blue);
}

.auth-submit {
    width: 100%;
    justify-content: center;
    padding: 11px 16px;
    margin-top: 6px;
}

.auth-error {
    margin-top: 2px;
    font-size: 12px;
    border: 1px solid rgba(255, 107, 122, 0.38);
    background: rgba(255, 107, 122, 0.12);
    color: #ffd0d6;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}

/* ---------- Sidebar ---------- */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: linear-gradient(180deg, #0a1628 0%, #0d1e38 100%);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-normal);
    z-index: 100;
}

.sidebar-backdrop {
    display: none;
}

.sidebar-header {
    padding: 24px 20px 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-gold), #ff9500);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: var(--shadow-glow-gold);
}

.sidebar-logo-text h1 {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.sidebar-logo-text span {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.app-version-pill {
    display: inline-flex;
    width: fit-content;
    margin-top: 7px;
    padding: 4px 9px;
    border: 1px solid rgba(34, 211, 238, 0.55);
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.16), rgba(59, 130, 246, 0.22));
    color: #a7f3ff !important;
    font-size: 11px !important;
    font-weight: 900 !important;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    box-shadow: 0 0 18px rgba(34, 211, 238, 0.16);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 12px 12px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    margin: 2px 0;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    position: relative;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    -webkit-user-select: none;
    user-select: none;
}

.nav-item:hover {
    background: rgba(59, 130, 246, 0.08);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.25);
    color: var(--text-primary);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--accent-blue);
    border-radius: 0 3px 3px 0;
}

.nav-item.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    background: var(--accent-blue-dim);
    color: var(--accent-blue);
}

.nav-badge.gold {
    background: var(--accent-gold-dim);
    color: var(--accent-gold);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-subtle);
}

.sidebar-footer-text {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}

/* ---------- Main Area ---------- */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-base);
}

/* ---------- Header ---------- */
.header {
    height: var(--header-height);
    min-height: var(--header-height);
    background: linear-gradient(180deg, rgba(10, 22, 40, 0.95), rgba(10, 22, 40, 0.8));
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mobile-menu-btn {
    display: none;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--border-default);
    background: rgba(59, 130, 246, 0.1);
    color: var(--text-primary);
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.mobile-menu-btn:hover {
    background: rgba(59, 130, 246, 0.18);
    border-color: var(--border-strong);
}

.header-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.header-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 400;
}

.header-version-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 10px;
    border: 1px solid rgba(34, 211, 238, 0.45);
    border-radius: 999px;
    background: rgba(14, 165, 233, 0.12);
    color: #9eeaff;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 8px 5px 11px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.42);
    border: 1px solid var(--border-subtle);
}

.header-user-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.2;
}

.header-user-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-user-role {
    margin-top: 1px;
    font-size: 10px;
    color: var(--text-muted);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--success-dim);
    border: 1px solid rgba(66, 211, 146, 0.2);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--success);
}

.header-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

.header-credit {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--accent-gold-dim);
    border: 1px solid rgba(255, 216, 77, 0.2);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-gold);
}

.encoder-policy-banner {
    margin: 14px 28px 0;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(245, 158, 11, 0.36);
    background: rgba(245, 158, 11, 0.12);
    color: #ffd79a;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.encoder-policy-banner .status-badge.warn {
    background: rgba(245, 158, 11, 0.18);
}

/* ---------- Content Area ---------- */
.content-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 28px;
    background: radial-gradient(ellipse at 20% 0%, rgba(59, 130, 246, 0.04) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 100%, rgba(167, 139, 250, 0.03) 0%, transparent 60%),
                var(--bg-base);
}

/* ---------- Page Header ---------- */
.page-header {
    margin-bottom: 28px;
}

.page-header h2 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--accent-gold) 0%, #ff9500 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-header p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* Dashboard stats/analytics styles moved to /static/css/views/dashboard.css in Phase 5.1. */

/* ---------- Panel / Card ---------- */
.panel {
    background: var(--bg-card);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 20px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.panel-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-body {
    padding: 20px 24px;
}

.panel-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ---------- Grid Layouts ---------- */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

@media (max-width: 1200px) {
    .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* Phase 6: Jobs top styles moved to /static/css/views/jobs-history.css */
/* ---------- Status Badge ---------- */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 14px;
}

.status-badge.done    { background: var(--success-dim); color: var(--success); }
.status-badge.running { background: var(--info-dim); color: var(--info); }
.status-badge.error   { background: var(--error-dim); color: var(--error); }
.status-badge.created { background: rgba(148, 163, 184, 0.12); color: var(--text-secondary); }
.status-badge.queued  { background: var(--warn-dim); color: var(--warn); }
.status-badge.cancelled { background: rgba(148, 163, 184, 0.08); color: var(--text-muted); }

.status-badge .badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-badge.running .badge-dot {
    animation: pulse 1.5s infinite;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-user-select: none;
    user-select: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), #2563eb);
    color: white;
    border-color: rgba(59, 130, 246, 0.5);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4f8ff7, var(--accent-blue));
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-default);
}

.btn-outline:hover {
    background: rgba(59, 130, 246, 0.08);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-icon {
    padding: 8px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--text-primary);
    border-color: var(--border-default);
}

/* ---------- Progress Bar ---------- */
.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan));
    border-radius: 3px;
    transition: width var(--transition-slow);
}

/* ---------- Timeline / Feed ---------- */
.feed-item {
    display: flex;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 13px;
}

.feed-item:last-child { border-bottom: none; }

.feed-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}

.feed-dot.info  { background: var(--accent-blue); }
.feed-dot.warn  { background: var(--warn); }
.feed-dot.error { background: var(--error); }
.feed-dot.ok    { background: var(--success); }

.feed-content { flex: 1; }
.feed-content strong { color: var(--text-primary); }
.feed-time { color: var(--text-muted); font-size: 11px; margin-top: 4px; }

/* Phase 6: Incidents CSS moved to /static/css/views/incidents.css */

/* Phase 6: Monitor CSS moved to /static/css/views/monitor.css */

/* Phase 6: Admin CSS moved to /static/css/views/admin.css */

/* Phase 6: Settings/Profile/Notifications CSS moved to /static/css/views/settings.css */
/* ---------- Density: Compact ---------- */
body.density-compact .header {
    padding-top: 0;
    padding-bottom: 0;
}

body.density-compact .content-area {
    padding: 20px;
}

body.density-compact .panel-header {
    padding: 14px 18px;
}

body.density-compact .panel-body {
    padding: 14px 18px;
}

body.density-compact .job-row {
    padding-top: 10px;
    padding-bottom: 10px;
}

/* ---------- Connection Status ---------- */
.ws-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

.ws-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
}

.ws-dot.connected { background: var(--success); }
.ws-dot.disconnected { background: var(--error); }

/* ---------- Toast ---------- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-elevated);
    animation: slideIn 0.3s ease-out;
    max-width: 380px;
}

.toast.success { background: rgba(66, 211, 146, 0.15); border: 1px solid rgba(66, 211, 146, 0.3); }
.toast.error   { background: rgba(255, 107, 122, 0.15); border: 1px solid rgba(255, 107, 122, 0.3); }
.toast.info    { background: rgba(59, 130, 246, 0.15); border: 1px solid rgba(59, 130, 246, 0.3); }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(30px); }
}

/* ---------- Loading Skeleton ---------- */
.skeleton {
    background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-elevated) 50%, var(--bg-surface) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .mobile-menu-btn {
        display: inline-flex;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(78vw, 280px);
        min-width: min(78vw, 280px);
        transform: translateX(-105%);
        transition: transform var(--transition-normal);
        box-shadow: var(--shadow-elevated);
        z-index: 110;
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(3, 10, 20, 0.58);
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--transition-fast);
        z-index: 105;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .main-area {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .content-area { padding: 16px; }
    .theme-settings-grid { grid-template-columns: 1fr; }
    .theme-field-full { grid-column: auto; }
    .template-form-grid { grid-template-columns: 1fr; }
    .template-field-full { grid-column: auto; }
    .template-toolbar { flex-wrap: wrap; }
    .language-settings-row .form-select { width: 100%; max-width: 220px; }
    .share-profile-actions .btn { flex: 1 1 auto; justify-content: center; }
    .jobs-batch-controls { width: 100%; }
    .jobs-batch-controls .form-select { width: 100%; max-width: 120px; }
    .header-subtitle { display: none; }
    .header-version-badge {
        min-height: 24px;
        padding: 4px 8px;
        font-size: 11px;
    }
    .header {
        height: auto;
        min-height: var(--header-height);
        padding: 10px 14px;
        align-items: flex-start;
        gap: 10px;
    }
    .header-right {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
    }
    .encoder-policy-banner {
        margin: 10px 16px 0;
    }
    .header-user-role {
        display: none;
    }
    .header-credit,
    .header-status {
        padding: 5px 10px;
    }
}

@media (max-width: 600px) {
    .sidebar {
        width: min(86vw, 240px);
        min-width: min(86vw, 240px);
    }
    .theme-scale-row { gap: 8px; }
    .theme-scale-row span { min-width: 50px; }
    .template-toolbar .form-select { max-width: 100%; width: 100%; }
    .template-actions .btn { flex: 1 1 auto; justify-content: center; }
    .language-settings-row .form-select { width: 100%; max-width: 100%; }
    .language-settings-row .btn { width: 100%; justify-content: center; }
    .share-profile-actions .btn { width: 100%; justify-content: center; }
    .jobs-batch-controls .btn { flex: 1 1 auto; justify-content: center; }
    .jobs-batch-result { width: 100%; }
    .share-target-row { width: 100%; }
    .share-target-btn {
        flex: 1 1 calc(50% - 6px);
        text-align: center;
    }
    .auth-screen {
        padding: 16px;
    }
    .auth-card {
        padding: 24px 16px 18px;
    }
    .header {
        padding: 10px;
    }
    .header-left {
        min-width: 0;
    }
    .header-title {
        font-size: 17px;
    }
    .header-right {
        gap: 8px;
    }
    .header-status span:last-child,
    .header-credit span:first-child {
        display: none;
    }
    .header-user {
        padding: 4px 6px 4px 8px;
    }
    .header-user-name {
        max-width: 84px;
    }
}

/* ============================================
   Phase 2: AI AutoCut Step Flow
   ============================================ */

/* ---------- Utilities ---------- */
.hidden { display: none !important; }
.view-hidden { display: none; }
.panel-mt { margin-top: 16px; }
.btn-row { margin-top: 20px; display: flex; gap: 12px; align-items: center; }

/* ---------- Form Select ---------- */
.form-select {
    background: var(--bg-deep);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    width: 100%;
    font-family: inherit;
    font-size: 14px;
    transition: border-color var(--transition-fast);
}
.form-select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

/* AI AutoCut step/dropzone CSS moved to /static/css/views/aiautocut.css */

/* Phase 6: Folder Manager CSS moved to /static/css/views/foldermanager.css */

/* Phase 6: Upload progress CSS moved to /static/css/core/upload-progress.css */

/* ---------- Sidebar footer margin ---------- */
.sidebar-footer-mt { margin-top: 8px; }

/* ---------- Utility classes ---------- */
.view-hidden { display: none; }
.hidden { display: none !important; }
.btn-row { display: flex; gap: 12px; margin-bottom: 20px; }

/* ============================================
   Phase 3: Smart Auto + TTS + VEO
   ============================================ */

/* Phase 6: Smart Auto CSS moved to /static/css/views/smartauto.css */
/* Phase 6: TTS CSS moved to /static/css/views/tts.css */
/* Phase 6: VEO CSS moved to /static/css/views/veo.css */

/* ============================================
   Phase 4: Easy VDO + AI Command
   ============================================ */

/* Phase 6: Easy VDO CSS moved to /static/css/views/easyvdo.css */
/* Phase 6: AI Command CSS moved to /static/css/views/aicommand.css */

/* Phase 6: Upload resilience CSS moved to /static/css/core/upload-resilience.css */

/* Phase 6: Jobs/History CSS moved to /static/css/views/jobs-history.css */
/* Phase 6: Product Output Manager CSS moved to /static/css/views/product-output-manager.css */

/* ---------- Mobile Bottom Navigation ---------- */
.bottom-nav {
    display: none; /* Hidden on desktop */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: linear-gradient(180deg, rgba(10, 22, 40, 0.98), rgba(7, 20, 38, 0.99));
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-subtle);
    z-index: 1000;
    padding: 0 8px;
    justify-content: space-around;
    align-items: center;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-muted);
    min-width: 56px;
    flex: 1;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item:hover {
    color: var(--text-secondary);
}

.bottom-nav-item.active {
    color: var(--accent-blue);
}

.bottom-nav-icon {
    font-size: 22px;
    line-height: 1;
}

.bottom-nav-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Active indicator dot */
.bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 6px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent-blue);
}

/* Show bottom nav only on mobile */
@media (max-width: 768px), (orientation: portrait) {
    .bottom-nav {
        display: flex;
    }
    
    /* Add padding to content area to avoid overlap with bottom nav */
    .content-area {
        padding-bottom: calc(64px + 20px);
    }
    
    /* Keep sidebar available as an off-canvas drawer; bottom nav remains the mobile shortcut bar. */
    .sidebar {
        display: flex;
    }
    
    .main-area {
        width: 100%;
    }
    
    /* Show mobile menu button */
    .mobile-menu-btn {
        display: inline-flex !important;
    }
}

/* Extra small screens */
@media (max-width: 380px) {
    .bottom-nav {
        height: 56px;
        padding: 0 4px;
    }
    
    .bottom-nav-item {
        padding: 6px 8px;
        min-width: 48px;
    }
    
    .bottom-nav-icon {
        font-size: 20px;
    }
    
    .bottom-nav-label {
        font-size: 9px;
    }
    
    .content-area {
        padding-bottom: calc(56px + 16px);
    }
}

/* ---------- Empty State ---------- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    min-height: 200px;
}

.empty-state-icon {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.8;
}

.empty-state-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state-description {
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 320px;
    line-height: 1.5;
    margin-bottom: 20px;
}

.empty-state-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--accent-blue), #2563eb);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.empty-state-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

/* ---------- Loading Overlay ---------- */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 10, 20, 0.85);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(59, 130, 246, 0.2);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Hide by default */
.empty-state.hidden,
.loading-overlay.hidden {
    display: none;
}

/* AB Roll layout/status CSS moved to /static/css/views/abroll.css */

/* Phase 6: Shared form/dropzone CSS moved to /static/css/core/forms.css */

/* Phase 6: Batch AB Roll CSS moved to /static/css/views/batch-abroll.css */
