/* ============================================================================
   DESIGN SYSTEM — modern dark theme (slate + indigo)
   ----------------------------------------------------------------------------
   Every page (including the admin area) styles itself with these variables and
   shared component classes, so the whole product is re-themed from this one
   block. Images pop against the dark surfaces — the norm for pro photo/video
   tools. Legacy variable names are kept so older inline styles still work.
============================================================================ */

:root {
    /* Surfaces */
    --bg-page: #0e1220;          /* deep slate-navy */
    --bg-panel: #161b2c;         /* cards / panels */
    --bg-card: #161b2c;
    --bg-card-hover: #1c2338;
    --border: #262d42;
    --border-strong: #343d57;

    /* Brand */
    --accent: #6d74f5;           /* bright indigo — readable as text on dark AND as a button bg */
    --accent-hover: #8b90ff;
    --accent-soft: rgba(109, 116, 245, 0.16);
    --accent-ink: #ffffff;       /* text placed on the accent color */
    --accent-2: #a855f7;         /* violet, used in gradients */
    --grad-brand: linear-gradient(92deg, #6366f1, #a855f7);

    /* Text */
    --text: #e8ebf5;
    --text-muted: #99a2ba;

    /* Status (brightened for dark, with translucent soft tints) */
    --danger: #f87171;
    --danger-hover: #ef4444;
    --danger-soft: rgba(248, 113, 113, 0.14);
    --success: #34d399;
    --success-soft: rgba(52, 211, 153, 0.14);
    --warning: #fbbf24;
    --warning-soft: rgba(251, 191, 36, 0.14);

    /* Inputs get their own inset surface so fields read as recessed on cards */
    --input-bg: #0f1424;

    /* Effects */
    --shadow-lg: 0 24px 50px -18px rgba(0, 0, 0, 0.65);
    --shadow-md: 0 12px 30px -14px rgba(0, 0, 0, 0.55);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 8px;

    --font: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ============================================================
   Base
============================================================ */
* { box-sizing: border-box; }
html { font-size: 15px; scroll-behavior: smooth; }
@media (min-width: 768px) { html { font-size: 16px; } }

html, body { height: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    background: radial-gradient(1200px 600px at 50% -10%, #141a2e 0%, var(--bg-page) 55%);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4, h5 { color: var(--text); font-weight: 700; letter-spacing: -0.01em; }

::selection { background: var(--accent-soft); color: var(--text); }

/* Themed scrollbar to match the dark surfaces */
* { scrollbar-color: #343d57 transparent; }
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-thumb { background: #343d57; border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #454f6e; background-clip: content-box; }

/* ============================================================
   Top navigation
============================================================ */
.topbar {
    background: rgba(14, 18, 32, 0.78);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 12px clamp(16px, 3vw, 32px);
    display: flex;
    align-items: center;
    gap: 18px;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.18rem;
    color: var(--text);
    letter-spacing: -0.02em;
    white-space: nowrap;
}
.brand:hover { color: var(--text); text-decoration: none; }
.brand .brand-mark {
    width: 30px; height: 30px;
    border-radius: 9px;
    background: var(--grad-brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
    flex: 0 0 30px;
}

.nav-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    margin-left: auto;
}
.nav-link {
    color: var(--text-muted);
    padding: 8px 13px;
    border-radius: var(--radius-sm);
    font-size: 0.93rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}
.nav-link:hover {
    color: var(--text);
    background: var(--accent-soft);
    text-decoration: none;
}
.nav-link.active { color: var(--accent); background: var(--accent-soft); }
.nav-link.logout { color: var(--danger); }
.nav-link.logout:hover { background: var(--danger-soft); color: var(--danger-hover); }
.nav-link.cta {
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 600;
    margin-left: 6px;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}
.nav-link.cta:hover { background: var(--accent-hover); color: var(--accent-ink); }

/* Mobile nav */
.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    cursor: pointer;
    color: var(--text);
    margin-left: auto;
}
@media (max-width: 860px) {
    .nav-toggle { display: inline-flex; }
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-panel);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-md);
        flex-direction: column;
        align-items: stretch;
        padding: 10px clamp(16px, 3vw, 32px) 16px;
        gap: 4px;
    }
    .nav-links .nav-link { padding: 11px 13px; }
    .topbar.nav-open .nav-links { display: flex; }
}

/* Credit balance chip */
.credit-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 13px;
    background: var(--accent-soft);
    border: 1px solid #dcdffc;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
    transition: border-color 0.15s, background 0.15s;
}
.credit-chip:hover { border-color: var(--accent); background: #e4e7fd; text-decoration: none; }
.credit-chip .count { color: var(--text); font-weight: 700; }
.credit-chip.empty {
    background: var(--danger-soft);
    border-color: #fecdca;
    color: var(--danger);
}
.credit-chip.empty .count { color: var(--danger); }
.credit-chip svg { display: block; }

/* ============================================================
   Page shell & footer
============================================================ */
.page-shell {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: clamp(22px, 3.5vw, 40px) clamp(16px, 3vw, 32px);
    flex: 1 0 auto;
}

.site-footer {
    margin-top: auto;
    border-top: 1px solid var(--border);
    background: var(--bg-panel);
    color: var(--text-muted);
    font-size: 0.88rem;
}
.site-footer .footer-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px clamp(16px, 3vw, 32px);
    display: flex;
    flex-wrap: wrap;
    gap: 18px 36px;
    align-items: center;
    justify-content: space-between;
}
.site-footer .footer-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: var(--text);
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent); }
.site-footer .footer-note { width: 100%; font-size: 0.8rem; color: #8a91a5; }

/* ============================================================
   Panels, cards & buttons
============================================================ */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.btn-primary-accent {
    background: var(--accent);
    color: var(--accent-ink);
    border: none;
    padding: 11px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-block;
    text-align: center;
    text-decoration: none;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}
.btn-primary-accent:hover { background: var(--accent-hover); color: var(--accent-ink); text-decoration: none; }
.btn-primary-accent:active { transform: translateY(1px); }
.btn-primary-accent:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-danger {
    background: var(--danger);
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.92rem;
}
.btn-danger:hover { background: var(--danger-hover); }

.btn-ghost {
    background: var(--bg-panel);
    color: var(--text);
    border: 1px solid var(--border-strong);
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
    display: inline-block;
    text-align: center;
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.btn-ghost:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

.icon-btn {
    background: var(--bg-panel);
    border: 1px solid var(--border-strong);
    color: var(--text);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.icon-btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.icon-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================================
   Badges & progress
============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-muted);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-warning .dot { animation: pulse 1.4s infinite; }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

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

.progress-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.09);
    border-radius: 999px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--grad-brand);
    transition: width 0.4s ease;
}
.progress-fill.complete { background: linear-gradient(90deg, #059669, #34d399); }

/* ============================================================
   Forms
============================================================ */
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="search"],
textarea, select {
    background: var(--input-bg);
    border: 1px solid var(--border-strong);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 10px 13px;
    font-size: 0.95rem;
    font-family: var(--font);
    width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder, textarea::placeholder { color: #6b7488; }
/* Dark dropdown options (native selects render their own list) */
select option { background: var(--bg-panel); color: var(--text); }

.field { margin-bottom: 15px; }
.field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}
.field-error { color: var(--danger); font-size: 0.8rem; margin-top: 4px; display: block; }

.summary-error {
    background: var(--danger-soft);
    border: 1px solid #fecdca;
    color: var(--danger-hover);
    padding: 11px 14px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    margin-bottom: 16px;
}
.summary-error ul { margin: 0; padding-left: 18px; }

.banner {
    padding: 11px 14px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    margin-bottom: 18px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.banner svg { flex: 0 0 18px; margin-top: 2px; }
.banner.success { background: var(--success-soft); border: 1px solid #abefc6; color: var(--success); }
.banner.error { background: var(--danger-soft); border: 1px solid #fecdca; color: var(--danger-hover); }
.banner.info { background: var(--accent-soft); border: 1px solid #dcdffc; color: var(--accent-hover); }

/* ============================================================
   Toasts
============================================================ */
.toast {
    position: fixed;
    top: 24px;
    right: 24px;
    min-width: 260px;
    max-width: 380px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 0.92rem;
    font-weight: 500;
    z-index: 2000;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    background: #1c2338;
    color: var(--text);
    border: 1px solid var(--border-strong);
}
.toast.show { transform: translateX(0); }
.toast.success { background: #06371f; color: #a7f3d0; border-color: #0b5b34; }
.toast.error { background: #3f1113; color: #fecaca; border-color: #7a271a; }
.toast.info { background: #1c2338; color: var(--text); border-color: var(--border-strong); }

/* ============================================================
   Shared marketing blocks (hero, sections, eyebrows)
============================================================ */
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 13px;
    background: var(--accent-soft);
    border: 1px solid #dcdffc;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.02em;
}
.eyebrow .dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--accent);
}
.grad-text {
    background: var(--grad-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section { max-width: 1280px; margin: 0 auto 72px; }
.section-head { text-align: center; margin-bottom: 40px; }
.section-head .eyebrow { margin-bottom: 14px; }
.section-head h2 {
    font-size: clamp(1.7rem, 3vw, 2.3rem);
    margin: 0 0 10px;
}
.section-head p {
    max-width: 620px;
    margin: 0 auto;
    color: var(--text-muted);
    font-size: 1.04rem;
    line-height: 1.6;
}

/* ============================================================
   Tables (account, admin)
============================================================ */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.data-table th {
    text-align: left;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-card-hover); }

/* ============================================================
   Utilities
============================================================ */
.aspect-square { aspect-ratio: 1 / 1; }

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    display: inline-block;
    vertical-align: middle;
    animation: spinner-rotate 0.7s linear infinite;
}
@keyframes spinner-rotate { to { transform: rotate(360deg); } }

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem var(--bg-page), 0 0 0 0.25rem var(--accent);
}

/* Modal (shared shape used by Albums / ViewAlbums) */
.modal-shell {
    display: none;
    position: fixed;
    z-index: 1500;
    inset: 0;
    background: rgba(20, 26, 46, 0.45);
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-shell.open { display: flex; }
.modal-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 440px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}
