/**
 * StoryTely - Design System v3.0
 * PHP 8.4 pur - Plus Jakarta Sans - Dark UI
 */

[x-cloak] { display: none !important; }

/* ──────────────────────────────────────
   CSS VARIABLES
   ────────────────────────────────────── */
:root {
    --bg:       #09090f;
    --bg2:      #0f0f1a;
    --bg3:      #141422;
    --bg4:      #1c1c30;
    --acc:      #7c6cf5;
    --acc2:     #a296f8;
    --acc3:     #c8bffe;
    --acc-dim:  rgba(124,108,245,.15);
    --acc-glow: rgba(124,108,245,.3);
    --teal:     #26d9a9;
    --gold:     #f5c842;
    --blu:      #0ea5e9;
    --tx:       #f0f0f8;
    --tx2:      rgba(240,240,248,.65);
    --tx3:      rgba(240,240,248,.35);
    --bdr:      rgba(255,255,255,.07);
    --bdr2:     rgba(255,255,255,.13);
    --r:        10px;
    --r2:       16px;
    --r3:       24px;
    --danger:   #ef4444;
    --success:  #22c55e;
    --warning:  #f59e0b;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--tx);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--acc); text-decoration: none; }
a:hover { color: var(--acc2); }

img { max-width: 100%; display: block; }

/* ──────────────────────────────────────
   TYPOGRAPHY
   ────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--tx);
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.125rem; }

.text-muted { color: var(--tx2); }
.text-dim   { color: var(--tx3); }
.text-acc   { color: var(--acc); }
.text-teal  { color: var(--teal); }
.text-gold  { color: var(--gold); }
.text-blu   { color: var(--blu); }

/* ──────────────────────────────────────
   BUTTONS
   ────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--r);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1.4;
}

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

.btn-primary {
    background: var(--acc);
    color: #fff;
}
.btn-primary:hover:not(:disabled) {
    background: var(--acc2);
    box-shadow: 0 0 20px var(--acc-glow);
}

.btn-secondary {
    background: var(--bg4);
    color: var(--tx);
    border: 1px solid var(--bdr2);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--bg3);
    border-color: var(--acc);
}

.btn-ghost {
    background: transparent;
    color: var(--tx2);
    border: 1px solid var(--bdr);
}
.btn-ghost:hover:not(:disabled) {
    color: var(--tx);
    border-color: var(--bdr2);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover:not(:disabled) {
    opacity: 0.9;
}

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.875rem 1.75rem; font-size: 1rem; }

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

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

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--bg2);
    border: 1px solid var(--bdr2);
    border-radius: var(--r);
    color: var(--tx);
    font-family: inherit;
    font-size: 0.9375rem;
    transition: border-color 0.2s;
    outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--acc);
    box-shadow: 0 0 0 3px var(--acc-dim);
}

.form-input::placeholder { color: var(--tx3); }

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

.form-error {
    font-size: 0.8125rem;
    color: var(--danger);
    margin-top: 0.25rem;
}

/* ──────────────────────────────────────
   CARDS
   ────────────────────────────────────── */
.card {
    background: var(--bg2);
    border: 1px solid var(--bdr);
    border-radius: var(--r2);
    padding: 1.5rem;
    transition: border-color 0.2s;
}

.card:hover {
    border-color: var(--bdr2);
}

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

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
}

/* ──────────────────────────────────────
   BADGES & PILLS
   ────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-acc    { background: var(--acc-dim); color: var(--acc2); }
.badge-teal   { background: rgba(38,217,169,.15); color: var(--teal); }
.badge-gold   { background: rgba(245,200,66,.15); color: var(--gold); }
.badge-blu    { background: rgba(14,165,233,.15); color: var(--blu); }
.badge-danger { background: rgba(239,68,68,.15); color: var(--danger); }

/* ──────────────────────────────────────
   STATUS DOTS (storyboard tracks)
   ────────────────────────────────────── */
.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.dot-pending    { background: var(--tx3); }
.dot-generating { background: var(--gold); animation: pulse 1.5s infinite; }
.dot-done-img   { background: var(--acc); }
.dot-done-vid   { background: var(--blu); }
.dot-done-vox   { background: var(--teal); }
.dot-failed     { background: var(--danger); }

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

/* ──────────────────────────────────────
   TRACKS (shot editor)
   ────────────────────────────────────── */
.track {
    border-radius: var(--r);
    padding: 1rem;
    background: var(--bg3);
    border: 1px solid var(--bdr);
}

.track-image { border-top: 3px solid var(--acc); }
.track-video { border-top: 3px solid var(--blu); }
.track-voice { border-top: 3px solid var(--teal); }

/* ──────────────────────────────────────
   LAYOUT HELPERS
   ────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.flex   { display: flex; }
.grid   { display: grid; }
.gap-1  { gap: 0.25rem; }
.gap-2  { gap: 0.5rem; }
.gap-3  { gap: 0.75rem; }
.gap-4  { gap: 1rem; }
.gap-6  { gap: 1.5rem; }
.gap-8  { gap: 2rem; }

.items-center   { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.flex-col        { flex-direction: column; }
.flex-wrap       { flex-wrap: wrap; }
.flex-1          { flex: 1; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.p-4  { padding: 1rem; }
.p-6  { padding: 1.5rem; }

.text-center { text-align: center; }
.text-sm     { font-size: 0.875rem; }
.text-xs     { font-size: 0.75rem; }
.text-lg     { font-size: 1.125rem; }
.font-bold   { font-weight: 700; }
.font-medium { font-weight: 500; }

.hidden { display: none !important; }

/* ──────────────────────────────────────
   AUTH CONTAINER
   ────────────────────────────────────── */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.auth-card {
    background: var(--bg2);
    border: 1px solid var(--bdr);
    border-radius: var(--r3);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}

/* ──────────────────────────────────────
   STORYBOARD LAYOUT (3 columns)
   ────────────────────────────────────── */
.storyboard {
    display: grid;
    grid-template-columns: 240px 1fr 320px;
    height: calc(100vh - 56px);
    overflow: hidden;
}

.storyboard-scenes {
    background: var(--bg2);
    border-right: 1px solid var(--bdr);
    overflow-y: auto;
    padding: 1rem;
}

.storyboard-main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.storyboard-bible {
    background: var(--bg2);
    border-left: 1px solid var(--bdr);
    overflow-y: auto;
    padding: 1rem;
    transition: transform 0.3s ease;
}

/* ──────────────────────────────────────
   FILMSTRIP
   ────────────────────────────────────── */
.filmstrip {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    overflow-x: auto;
    background: var(--bg3);
    border-bottom: 1px solid var(--bdr);
}

.filmstrip-item {
    flex-shrink: 0;
    width: 120px;
    border-radius: var(--r);
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.2s;
}

.filmstrip-item.active {
    border-color: var(--acc);
}

.filmstrip-item:hover {
    border-color: var(--bdr2);
}

.filmstrip-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--bg4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.filmstrip-dots {
    display: flex;
    gap: 4px;
    padding: 0.375rem;
    justify-content: center;
    background: var(--bg2);
}

/* ──────────────────────────────────────
   NAVBAR
   ────────────────────────────────────── */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 1.5rem;
    background: var(--bg2);
    border-bottom: 1px solid var(--bdr);
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--tx);
}

.navbar-brand span {
    color: var(--acc);
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ──────────────────────────────────────
   CREDIT BADGE
   ────────────────────────────────────── */
.credit-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: var(--acc-dim);
    border-radius: 100px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--acc2);
}

/* ──────────────────────────────────────
   TABLES
   ────────────────────────────────────── */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--bdr);
}

.table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--tx3);
}

.table tr:hover td {
    background: var(--bg3);
}

/* ──────────────────────────────────────
   MODALS
   ────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
}

.modal {
    background: var(--bg2);
    border: 1px solid var(--bdr2);
    border-radius: var(--r3);
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

/* ──────────────────────────────────────
   NOTIFICATIONS / TOASTS
   ────────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.75rem 1.25rem;
    border-radius: var(--r);
    font-size: 0.875rem;
    font-weight: 500;
    animation: slideIn 0.3s ease;
    min-width: 280px;
}

.toast-success { background: rgba(34,197,94,.15); color: var(--success); border: 1px solid rgba(34,197,94,.3); }
.toast-error   { background: rgba(239,68,68,.15); color: var(--danger); border: 1px solid rgba(239,68,68,.3); }
.toast-info    { background: var(--acc-dim); color: var(--acc2); border: 1px solid var(--acc-glow); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

/* ──────────────────────────────────────
   LOADING / SKELETON
   ────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, var(--bg3) 25%, var(--bg4) 50%, var(--bg3) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--r);
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--bdr2);
    border-top-color: var(--acc);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ──────────────────────────────────────
   SCROLLBAR
   ────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bdr2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--tx3); }

/* ──────────────────────────────────────
   RESPONSIVE
   ────────────────────────────────────── */
@media (max-width: 1024px) {
    .storyboard {
        grid-template-columns: 1fr;
    }
    .storyboard-scenes,
    .storyboard-bible {
        display: none;
    }
}

@media (max-width: 640px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.375rem; }
    .container { padding: 0 1rem; }
    .auth-card { padding: 1.5rem; }
}
