/* ─── Base ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background-color: var(--color-bg, #FAFAFA);
    color: var(--color-text, #0A1931);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.bg-app { background-color: var(--color-bg); }

/* ─── Navbar ───────────────────────────────────────────────────────────────── */
.app-navbar {
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 8px rgba(10,25,49,0.06);
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: var(--color-secondary);
    font-weight: 800;
    font-size: 1rem;
    margin-right: 8px;
    flex-shrink: 0;
}

.brand-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--color-primary);
    letter-spacing: -0.02em;
}

/* ─── Buttons ──────────────────────────────────────────────────────────────── */
.btn-primary {
    background: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    color: #fff !important;
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.2s;
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--color-primary-light) !important;
    border-color: var(--color-primary-light) !important;
    box-shadow: 0 4px 16px rgba(10,25,49,0.2) !important;
    transform: translateY(-1px);
}

.btn-secondary-gold {
    background: var(--color-secondary);
    border-color: var(--color-secondary);
    color: var(--color-primary);
    font-weight: 600;
    border-radius: 10px;
}
.btn-secondary-gold:hover {
    background: var(--color-secondary-light);
    border-color: var(--color-secondary-light);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    border-radius: 10px;
    font-weight: 500;
}
.btn-ghost:hover {
    background: var(--color-bg);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* ─── Cards ────────────────────────────────────────────────────────────────── */
.card {
    border: 1px solid var(--color-border);
    border-radius: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    background: var(--color-surface);
}
.card-hover {
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}
.card-hover:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(10,25,49,0.1);
}

/* ─── Form controls ────────────────────────────────────────────────────────── */
.form-control, .form-select {
    border-radius: 12px;
    border-color: var(--color-border);
    padding: 0.65rem 1rem;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(10,25,49,0.08);
}
.input-group-text {
    border-radius: 12px;
    border-color: var(--color-border);
    background: var(--color-bg);
    color: var(--color-muted);
}

/* ─── Page layout ──────────────────────────────────────────────────────────── */
.page-with-nav { padding-top: 1.5rem; }

.page-header {
    margin-bottom: 1.75rem;
}
.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: -0.03em;
    margin: 0;
}
.page-header p {
    color: var(--color-muted);
    margin: 0.25rem 0 0;
    font-size: 0.9rem;
}

/* ─── Stats cards ──────────────────────────────────────────────────────────── */
.stat-card {
    padding: 1.25rem 1.5rem;
    border-radius: 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
}
.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
}
.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--color-primary);
    letter-spacing: -0.04em;
    line-height: 1;
}
.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--color-muted);
    margin-top: 0.25rem;
}

/* ─── Avatar ───────────────────────────────────────────────────────────────── */
.avatar-sm {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: var(--color-secondary);
    font-weight: 700;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
}

/* ─── Credit badge ─────────────────────────────────────────────────────────── */
.credit-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, var(--color-secondary), var(--color-secondary-light));
    color: var(--color-primary);
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.8rem;
}

/* ─── Status badges ────────────────────────────────────────────────────────── */
.badge-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.badge-queued      { background: #EEF2FF; color: #4F46E5; }
.badge-processing  { background: #FEF3C7; color: #D97706; }
.badge-completed   { background: #D1FAE5; color: #065F46; }
.badge-failed      { background: #FEE2E2; color: #991B1B; }
.badge-draft       { background: #F3F4F6; color: #6B7280; }

/* ─── Progress bar ─────────────────────────────────────────────────────────── */
.progress { border-radius: 100px; height: 6px; }
.progress-bar {
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    border-radius: 100px;
    transition: width 0.6s ease;
}

/* ─── Toast notifications ──────────────────────────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 80px;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
@media (min-width: 992px) {
    #toast-container { bottom: 1.5rem; }
}
.toast-item {
    background: var(--color-primary);
    color: #fff;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    animation: slideUp 0.3s ease;
    max-width: 320px;
}
.toast-item.toast-success { background: var(--color-success); }
.toast-item.toast-error   { background: var(--color-danger); }
.toast-item.toast-warning { background: var(--color-warning); color: var(--color-primary); }
@keyframes slideUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── Auth pages ───────────────────────────────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(160deg, var(--color-primary) 0%, #142847 50%, #0f1f3d 100%);
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 24px;
    padding: 2.5rem 2rem;
    box-shadow: 0 24px 64px rgba(0,0,0,0.2);
}
.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: var(--color-secondary);
    font-weight: 900;
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
}

/* ─── Password toggle ──────────────────────────────────────────────────────── */
.password-toggle {
    position: relative;
}
.password-toggle .toggle-eye {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--color-muted);
    padding: 4px;
    z-index: 5;
}
.password-toggle .toggle-eye:hover { color: var(--color-primary); }

/* ─── Video card ───────────────────────────────────────────────────────────── */
.video-card {
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    transition: transform 0.2s, box-shadow 0.2s;
}
.video-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(10,25,49,0.1);
}
.video-card .video-thumb {
    aspect-ratio: 9/16;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    position: relative;
    overflow: hidden;
    max-height: 200px;
}
.video-card .video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.video-card .video-thumb .play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.3);
    opacity: 0;
    transition: opacity 0.2s;
}
.video-card:hover .play-overlay { opacity: 1; }
.video-card .video-info { padding: 1rem; }

/* ─── Divider with text ────────────────────────────────────────────────────── */
.divider-text {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--color-muted);
    font-size: 0.8rem;
}
.divider-text::before, .divider-text::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

/* ─── Spinner ──────────────────────────────────────────────────────────────── */
.spinner-primary {
    border-color: rgba(10,25,49,0.1);
    border-top-color: var(--color-primary);
}

/* ─── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}
.empty-state .empty-icon {
    font-size: 3.5rem;
    color: var(--color-border);
    margin-bottom: 1rem;
}
.empty-state h5 { color: var(--color-primary); font-weight: 700; }
.empty-state p  { color: var(--color-muted); font-size: 0.9rem; }

/* ─── Step indicator ───────────────────────────────────────────────────────── */
.step-indicator {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 2rem;
}
.step-item {
    display: flex;
    align-items: center;
    flex: 1;
}
.step-item:last-child { flex: 0; }
.step-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-border);
    color: var(--color-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
    transition: all 0.3s;
}
.step-dot.active  { background: var(--color-primary); color: #fff; }
.step-dot.done    { background: var(--color-success);  color: #fff; }
.step-line {
    flex: 1;
    height: 2px;
    background: var(--color-border);
    transition: background 0.3s;
}
.step-line.done { background: var(--color-success); }

/* ─── Responsive tables → cards ────────────────────────────────────────────── */
@media (max-width: 767px) {
    .table-responsive-cards thead { display: none; }
    .table-responsive-cards tbody tr {
        display: block;
        background: var(--color-surface);
        border: 1px solid var(--color-border);
        border-radius: 12px;
        padding: 1rem;
        margin-bottom: 0.75rem;
    }
    .table-responsive-cards tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.35rem 0;
        border: none;
        font-size: 0.875rem;
    }
    .table-responsive-cards tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--color-muted);
        font-size: 0.75rem;
    }
}
