/* ═══════════════════════════════════════════════════════════
   design.css — Video Flow Design System
   Shared across all dashboard pages
═══════════════════════════════════════════════════════════ */

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ── Tokens ────────────────────────────────────────────── */
:root {
    --bg:       #F3F4FA;
    --surface:  #FFFFFF;
    --raised:   #F9FAFC;

    --ink:      #0D0E1A;
    --ink-2:    #4A4C6A;
    --ink-3:    #9597B4;
    --ink-4:    #C8CAE0;

    --indigo:   #4F40E8;
    --indigo-l: #EEF0FF;
    --indigo-m: rgba(79,64,232,0.12);

    --green:    #12B76A;
    --green-l:  #ECFDF5;
    --blue:     #2E90FA;
    --blue-l:   #EFF8FF;
    --amber:    #F79009;
    --amber-l:  #FFFAEB;
    --violet:   #7C3AED;
    --violet-l: #F5F3FF;
    --teal:     #0E9384;
    --teal-l:   #F0FDF9;
    --red:      #E04141;
    --red-l:    #FEF2F2;

    --border:   #E4E6F0;
    --shadow-sm: 0 1px 3px rgba(13,14,26,0.06), 0 1px 2px rgba(13,14,26,0.04);
    --shadow-md: 0 4px 16px rgba(13,14,26,0.08), 0 1px 3px rgba(13,14,26,0.04);

    --sidebar-w:   248px;
    --r:    8px;
    --r-lg: 14px;
}

/* ── Base ──────────────────────────────────────────────── */
body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 1.125rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden;
    min-width: 0;
    text-decoration: none;
}

.logo-mark {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: var(--indigo);
    border-radius: var(--r);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-mark-text {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 800;
    font-size: 0.75rem;
    color: white;
    letter-spacing: 0.04em;
}

.logo-words {
    overflow: hidden;
    white-space: nowrap;
}

.logo-name {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--ink);
    line-height: 1.2;
}

.logo-tagline {
    font-size: 0.6875rem;
    color: var(--ink-3);
    font-weight: 400;
}

.nav-items {
    flex: 1;
    padding: 0.75rem 0.625rem;
    overflow-y: auto;
    scrollbar-width: none;
}

.nav-items::-webkit-scrollbar { display: none; }

.nav-group-label {
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-4);
    padding: 0.625rem 0.5rem 0.375rem;
    white-space: nowrap;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.625rem;
    border-radius: var(--r);
    color: var(--ink-2);
    text-decoration: none;
    margin-bottom: 1px;
    transition: all 0.14s;
    cursor: pointer;
    white-space: nowrap;
    font-size: 0.875rem;
    font-weight: 500;
    position: relative;
}

.nav-item:hover {
    background: var(--raised);
    color: var(--ink);
}

.nav-item.active {
    background: var(--indigo-l);
    color: var(--indigo);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    background: var(--indigo);
    border-radius: 0 3px 3px 0;
}

.nav-item svg,
.nav-item i {
    width: 17px;
    height: 17px;
    min-width: 17px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 0.875rem 0.625rem;
    border-top: 1px solid var(--border);
}

.status-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--green-l);
    border-radius: var(--r);
    white-space: nowrap;
    overflow: hidden;
}

.status-dot {
    width: 7px;
    height: 7px;
    min-width: 7px;
    border-radius: 50%;
    background: var(--green);
    animation: breathe 2.4s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.status-text {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--green);
}

/* ── Main Content Layout ───────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
}

/* ── Page ──────────────────────────────────────────────── */
.page {
    padding: 2.5rem 2.25rem;
    max-width: 1360px;
}

/* ── Page Header ───────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 2rem;
    gap: 1rem;
}


.page-title {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--ink);
    line-height: 1.15;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding-top: 0.375rem;
    flex-shrink: 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.badge-live {
    background: var(--green-l);
    color: var(--green);
    border: 1px solid rgba(18,183,106,0.2);
}

.badge-live-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    animation: breathe 2s ease-in-out infinite;
}

.badge-secondary {
    background: var(--raised);
    color: var(--ink-3);
    border: 1px solid var(--border);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Panel ─────────────────────────────────────────────── */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
    overflow: hidden;
    animation: slideUp 0.4s ease both;
}

.panel-header {
    padding: 1rem 1.375rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--raised);
}

.panel-title {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.panel-body {
    padding: 1.375rem;
}

.panel-header-actions {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

/* ── Buttons ───────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.125rem;
    border-radius: var(--r);
    border: none;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--indigo);
    color: white;
    border: 1px solid var(--indigo);
}

.btn-primary:hover:not(:disabled) {
    background: #3f32c0;
    border-color: #3f32c0;
}

.btn-secondary {
    background: var(--surface);
    color: var(--ink-2);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--raised);
    color: var(--ink);
    border-color: var(--ink-4);
}

.btn-danger {
    background: var(--red);
    color: white;
    border: 1px solid var(--red);
}

.btn-danger:hover:not(:disabled) {
    background: #c73535;
    border-color: #c73535;
}

.btn-success {
    background: var(--green);
    color: white;
    border: 1px solid var(--green);
}

.btn-success:hover:not(:disabled) {
    background: #0ea05d;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ── Form Elements ─────────────────────────────────────── */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--ink-2);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    color: var(--ink);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9375rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px var(--indigo-m);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239597B4' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

.form-textarea {
    resize: vertical;
    min-height: 90px;
}

.control-label {
    display: block;
    font-size: 0.8125rem;
    color: var(--ink-3);
    font-weight: 500;
    margin-bottom: 0.375rem;
}

/* ── Status Badges ─────────────────────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.status-badge.active,
.status-badge.started {
    background: var(--green-l);
    color: var(--green);
    border: 1px solid rgba(18,183,106,0.2);
}

.status-badge.archived,
.status-badge.finished {
    background: var(--raised);
    color: var(--ink-3);
    border: 1px solid var(--border);
}

.status-badge.deleted {
    background: var(--red-l);
    color: var(--red);
    border: 1px solid rgba(224,65,65,0.2);
}

.status-badge.in-production {
    background: var(--blue-l);
    color: var(--blue);
    border: 1px solid rgba(46,144,250,0.2);
}

/* ── Toast ─────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 300;
    padding: 0.875rem 1.25rem;
    border-radius: var(--r-lg);
    font-size: 0.9375rem;
    font-weight: 500;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
    max-width: 340px;
    box-shadow: var(--shadow-md);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    background: var(--green);
    color: white;
}

.toast.error {
    background: var(--red);
    color: white;
}

/* ── Modal ─────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(13,14,26,0.4);
    backdrop-filter: blur(2px);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 2rem;
    width: 100%;
    max-width: 520px;
    margin: 1rem;
    box-shadow: var(--shadow-md);
    animation: slideUp 0.22s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.modal-title {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ink);
}

.modal-close {
    background: none;
    border: none;
    color: var(--ink-3);
    cursor: pointer;
    font-size: 1.375rem;
    line-height: 1;
    padding: 0;
    transition: color 0.15s;
}

.modal-close:hover { color: var(--ink); }

.confirm-msg {
    color: var(--ink-2);
    margin-bottom: 1.5rem;
    line-height: 1.6;
    font-size: 0.9375rem;
}

.confirm-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* ── Spinner ───────────────────────────────────────────── */
.spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid var(--border);
    border-top-color: var(--indigo);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty / Loading States ────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 5rem 2rem;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.empty-title {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 0.5rem;
}

.empty-subtitle {
    color: var(--ink-3);
    font-size: 0.9375rem;
    margin-bottom: 2rem;
}

.loading {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--ink-3);
    font-size: 0.9375rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.loading .spinner {
    width: 32px;
    height: 32px;
    border-width: 3px;
}

/* ── Controls Bar ──────────────────────────────────────── */
.controls-bar {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

/* ── Filter / Tab Bar ──────────────────────────────────── */
.filter-bar {
    display: flex;
    gap: 0.375rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-tab {
    padding: 0.4rem 1rem;
    border-radius: 6px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--ink-2);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: 'DM Sans', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.filter-tab:hover {
    background: var(--raised);
    color: var(--ink);
    border-color: var(--ink-4);
}

.filter-tab.active {
    background: var(--indigo);
    color: white;
    border-color: var(--indigo);
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-w) !important;
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0 !important;
    }
    .page {
        padding: 1.5rem 1rem;
    }
    .page-title {
        font-size: 1.625rem;
    }
}
