/* UVIOM Media console: dependency-free design system (light + dark). */

:root {
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-2: #f1f3f9;
    --border: #e3e6ef;
    --text: #151a2d;
    --muted: #5d6479;
    --faint: #8a90a3;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-soft: #eef0ff;
    --success: #0f9d58;
    --success-soft: #e6f6ee;
    --warning: #b7791f;
    --warning-soft: #fdf5e4;
    --danger: #d93a3a;
    --danger-soft: #fdecec;
    --info: #0b7cc1;
    --info-soft: #e7f3fb;
    --code-bg: #0f1422;
    --code-text: #e3e8f6;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
    --radius: 12px;
    --radius-sm: 8px;
    --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Bengali", sans-serif;
    --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, "Liberation Mono", monospace;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0c0f19;
        --surface: #141927;
        --surface-2: #1b2133;
        --border: #262d42;
        --text: #e8ebf5;
        --muted: #a2a9bf;
        --faint: #767e96;
        --primary: #8b85ff;
        --primary-hover: #a09bff;
        --primary-soft: #232250;
        --success: #3ecf8e;
        --success-soft: #11291f;
        --warning: #f0b453;
        --warning-soft: #2c2413;
        --danger: #ff6b6b;
        --danger-soft: #331819;
        --info: #4db3f0;
        --info-soft: #11283a;
        --code-bg: #0a0d16;
        --shadow: 0 1px 2px rgba(0, 0, 0, .4);
        --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #0c0f19; --surface: #141927; --surface-2: #1b2133; --border: #262d42; --text: #e8ebf5;
    --muted: #a2a9bf; --faint: #767e96; --primary: #8b85ff; --primary-hover: #a09bff; --primary-soft: #232250;
    --success: #3ecf8e; --success-soft: #11291f; --warning: #f0b453; --warning-soft: #2c2413;
    --danger: #ff6b6b; --danger-soft: #331819; --info: #4db3f0; --info-soft: #11283a; --code-bg: #0a0d16;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font);
    -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.08rem; } h4 { font-size: .95rem; }
p { margin: 0 0 1em; }
code, pre, kbd { font-family: var(--mono); font-size: .86em; }
:not(pre) > code { background: var(--surface-2); border: 1px solid var(--border); padding: .1em .38em; border-radius: 5px; word-break: break-word; }
pre {
    background: var(--code-bg); color: var(--code-text); padding: 14px 16px; border-radius: var(--radius-sm);
    overflow-x: auto; margin: 0 0 1em; line-height: 1.5; font-size: .82rem;
}
hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
img { max-width: 100%; }

/* ---- Layout ----------------------------------------------------------- */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.container-narrow { max-width: 440px; }
main { flex: 1; padding: 28px 0 48px; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
.topbar .container { display: flex; align-items: center; gap: 20px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); font-size: 1.02rem; }
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff;
    background: linear-gradient(135deg, #6366f1, #06b6d4); font-size: .85rem; font-weight: 800;
}
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a {
    color: var(--muted); padding: 7px 11px; border-radius: 8px; font-weight: 500; font-size: .92rem;
    display: inline-flex; align-items: center; gap: 6px;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.nav-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.nav-user { color: var(--muted); font-size: .88rem; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count-pill { background: var(--danger); color: #fff; border-radius: 999px; font-size: .7rem; padding: 0 6px; font-weight: 700; line-height: 1.5; }

.footer { border-top: 1px solid var(--border); color: var(--faint); font-size: .85rem; padding: 18px 0; }
.footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { color: var(--muted); margin: 0; }
.page-head h1 { margin-bottom: 4px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); }
.split { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: minmax(0, 1fr); } }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: .85rem; } .mono { font-family: var(--mono); }
.text-right { text-align: right; } .nowrap { white-space: nowrap; } .break { word-break: break-all; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; } .mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.hidden { display: none !important; }

/* ---- Cards ------------------------------------------------------------ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 20px; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

.stat { padding: 16px 18px; }
.stat-label { color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 1.65rem; font-weight: 700; margin-top: 4px; letter-spacing: -.02em; }
.stat-hint { color: var(--faint); font-size: .8rem; }

/* ---- Buttons ---------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent;
    background: var(--primary); color: #fff; padding: 9px 16px; border-radius: 9px; font: 600 .9rem var(--font);
    cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, opacity .15s; white-space: nowrap;
}
.btn:hover { background: var(--primary-hover); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-success { background: var(--success); }
.btn-success:hover { background: var(--success); opacity: .9; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: var(--danger); opacity: .9; }
.btn-outline-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-outline-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 6px 11px; font-size: .82rem; border-radius: 7px; }
.btn-block { width: 100%; }
form.inline { display: inline; }

/* ---- Forms ------------------------------------------------------------ */
.field { margin-bottom: 16px; }
.field label, .label { display: block; font-weight: 600; font-size: .87rem; margin-bottom: 6px; }
.input, select.input, textarea.input {
    width: 100%; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface);
    color: var(--text); font: .93rem var(--font);
}
textarea.input { min-height: 80px; resize: vertical; }
.input.mono { font-family: var(--mono); font-size: .85rem; }
.input:focus { border-color: var(--primary); }
.help { color: var(--faint); font-size: .8rem; margin-top: 5px; }
.error-text { color: var(--danger); font-size: .82rem; margin-top: 5px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: .9rem; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.checks { display: flex; gap: 16px; flex-wrap: wrap; }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; min-width: 0; }

/* ---- Alerts / badges -------------------------------------------------- */
.alert { padding: 12px 16px; border-radius: 10px; border: 1px solid; margin-bottom: 18px; font-size: .92rem; }
.alert-success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 35%, transparent); color: var(--success); }
.alert-error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.alert-warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 35%, transparent); color: var(--warning); }
.alert-info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 35%, transparent); color: var(--info); }
.alert strong { color: inherit; }

.badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .75rem;
    font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge-approved, .badge-ready, .badge-public { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge-pending, .badge-processing { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge-suspended, .badge-failed { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-private, .badge-admin { background: var(--primary-soft); color: var(--primary); border-color: transparent; }

.method { display: inline-block; min-width: 58px; text-align: center; font: 700 .72rem var(--mono); padding: 3px 7px; border-radius: 6px; letter-spacing: .02em; }
.m-get { background: var(--success-soft); color: var(--success); }
.m-post { background: var(--info-soft); color: var(--info); }
.m-patch { background: var(--warning-soft); color: var(--warning); }
.m-delete { background: var(--danger-soft); color: var(--danger); }
.m-head { background: var(--surface-2); color: var(--muted); }

/* ---- Tables ----------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.kv { width: 100%; border-collapse: collapse; font-size: .88rem; }
.kv th { text-align: left; color: var(--muted); font-weight: 500; padding: 7px 12px 7px 0; width: 38%; vertical-align: top; white-space: nowrap; }
.kv td { padding: 7px 0; word-break: break-word; }
.kv tr + tr th, .kv tr + tr td { border-top: 1px dashed var(--border); }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-icon { font-size: 2rem; margin-bottom: 6px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs a, .tabs button {
    background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; color: var(--muted);
    font: 600 .9rem var(--font); cursor: pointer; white-space: nowrap; margin-bottom: -1px;
}
.tabs a:hover, .tabs button:hover { color: var(--text); text-decoration: none; }
.tabs .active { color: var(--primary); border-bottom-color: var(--primary); }

.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-size: .87rem; }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

.token-box { display: flex; gap: 8px; align-items: center; background: var(--code-bg); color: var(--code-text); padding: 12px 14px; border-radius: 10px; }
.token-box code { background: none; border: 0; color: inherit; flex: 1; word-break: break-all; font-size: .85rem; }

/* ---- Home / auth ------------------------------------------------------ */
.hero { padding: 56px 0 30px; text-align: center; }
.hero h1 { font-size: clamp(1.9rem, 4.5vw, 2.9rem); letter-spacing: -.03em; margin-bottom: 14px; }
.hero p.lead { font-size: 1.1rem; color: var(--muted); max-width: 680px; margin: 0 auto 26px; }
.gradient-text { background: linear-gradient(135deg, #6366f1, #06b6d4); -webkit-background-clip: text; background-clip: text; color: transparent; }
.feature { padding: 20px; }
.feature-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-size: 1.1rem; margin-bottom: 10px; }
.feature h3 { margin-bottom: 6px; }
.feature p { color: var(--muted); font-size: .92rem; margin: 0; }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: step; position: relative; padding: 0 0 18px 44px; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.auth-card { margin-top: 30px; }
.auth-card h1 { font-size: 1.45rem; }

/* ---- Media Lab ---------------------------------------------------------- */
.lab { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 18px; align-items: start; }
@media (max-width: 1080px) { .lab { grid-template-columns: minmax(0, 1fr); } }
.lab > *, .split > *, .docs > *, .grid > * { min-width: 0; }
.dropzone {
    display: block; border: 2px dashed var(--border); border-radius: var(--radius); padding: 26px 16px; text-align: center; cursor: pointer;
    background: var(--surface-2); transition: border-color .15s, background .15s; color: var(--muted);
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.dropzone strong { color: var(--text); display: block; margin-bottom: 4px; }
.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, #6366f1, #06b6d4); transition: width .15s; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.media-tile {
    border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); cursor: pointer;
    text-align: left; padding: 0; font: inherit; color: inherit; transition: border-color .15s, transform .15s;
}
.media-tile:hover { border-color: var(--primary); transform: translateY(-1px); }
.media-tile.selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.media-thumb { aspect-ratio: 4 / 3; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; color: var(--faint); font-size: 1.8rem; }
.media-thumb img, .media-thumb video { width: 100%; height: 100%; object-fit: cover; }
.media-thumb video, .variant .pic video { pointer-events: none; }
.media-meta { padding: 8px 10px; font-size: .78rem; }
.media-meta .name { font-weight: 600; font-size: .83rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }

.variant-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.variant { border: 1px solid var(--border); border-radius: 9px; overflow: hidden; font-size: .76rem; background: var(--surface-2); }
.variant .pic { height: 84px; display: grid; place-items: center; background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 14px 14px; }
.variant .pic img, .variant .pic video { max-height: 84px; max-width: 100%; }
.variant .info { padding: 6px 8px; }
.variant .info b { display: block; font-size: .8rem; }

.stages { list-style: none; display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 0; font-size: .82rem; font-weight: 600; color: var(--faint); }
.stages li { display: flex; align-items: center; gap: 7px; }
.stages li + li::before { content: ''; width: 28px; height: 2px; border-radius: 2px; background: var(--border); }
.stages .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--border); font-size: .72rem; }
.stages li.active { color: var(--primary); }
.stages li.active .dot { border-color: var(--primary); animation: step-pulse 1.2s ease-in-out infinite; }
.stages li.done { color: var(--success); }
.stages li.done .dot { background: var(--success); border-color: var(--success); color: #fff; }
.stages li.done + li::before { background: var(--success); }
.stages li.failed { color: var(--danger); }
.stages li.failed .dot { background: var(--danger); border-color: var(--danger); color: #fff; }
@keyframes step-pulse { 50% { box-shadow: 0 0 0 4px var(--primary-soft); } }

.player { width: 100%; border-radius: 10px; background: #000; max-height: 280px; }
.sticky { position: sticky; top: 76px; }

.console { background: var(--code-bg); color: var(--code-text); border-radius: 10px; font: .78rem/1.55 var(--mono); max-height: 260px; overflow: auto; padding: 10px 12px; }
.console .line { display: flex; gap: 8px; white-space: nowrap; }
.console .ok { color: #3ecf8e; } .console .warn { color: #f0b453; } .console .err { color: #ff6b6b; } .console .dim { color: #7c849c; }
.hex { font: .76rem/1.5 var(--mono); background: var(--surface-2); border-radius: 8px; padding: 10px; word-break: break-all; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 4px 10px; font: 600 .76rem var(--mono); cursor: pointer; }
.chip:hover { border-color: var(--primary); color: var(--primary); }

/* ---- Docs --------------------------------------------------------------- */
.docs { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 32px; align-items: start; }
@media (max-width: 900px) { .docs { grid-template-columns: 1fr; } .docs-nav { position: static !important; max-height: none !important; } }
.docs-nav { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow-y: auto; font-size: .9rem; }
.docs-nav h4 { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin: 18px 0 6px; }
.docs-nav a { display: block; color: var(--muted); padding: 4px 10px; border-radius: 6px; border-left: 2px solid transparent; }
.docs-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.docs-content section { scroll-margin-top: 80px; padding-bottom: 12px; }
.docs-content h2 { padding-top: 14px; border-top: 1px solid var(--border); margin-top: 26px; }
.docs-content section:first-child h2 { border-top: 0; margin-top: 0; padding-top: 0; }
.docs-content h3 { margin-top: 22px; }
.docs-content table.table { margin-bottom: 1em; }
.endpoint { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); margin: 14px 0; overflow: hidden; }
.endpoint-head { display: flex; gap: 10px; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.endpoint-head code { background: none; border: 0; font-size: .9rem; font-weight: 600; padding: 0; }
.endpoint-head .auth { margin-left: auto; }
.endpoint-body { padding: 14px; font-size: .92rem; }
.endpoint-body > :last-child { margin-bottom: 0; }
.callout { border-left: 3px solid var(--primary); background: var(--primary-soft); padding: 12px 16px; border-radius: 0 8px 8px 0; margin: 0 0 1em; font-size: .92rem; }

@media (max-width: 640px) {
    main { padding-top: 18px; }
    .card-body { padding: 16px; }
    .nav-user { display: none; }
    .topbar .container { gap: 10px; padding-top: 8px; padding-bottom: 8px; }
    .nav { order: 3; flex-basis: 100%; }
}
