/* ============================================================
   ZEILAB CDN — o'z dizayn tizimi (frameworksiz)
   ============================================================ */

:root {
    --bg: #05070d;
    --bg-dot: #0b1020;
    --surface: #0d1220;
    --surface-2: #111a2e;
    --surface-3: #161f36;
    --border: #1c2740;
    --border-soft: #141c2f;
    --text: #e8ecf5;
    --text-dim: #8b96ad;
    --text-faint: #57617a;
    --accent: #3d7fff;
    --accent-soft: rgba(61, 127, 255, 0.12);
    --accent-2: #22d3ee;
    --danger: #f0475f;
    --danger-soft: rgba(240, 71, 95, 0.12);
    --success: #16c79a;
    --success-soft: rgba(22, 199, 154, 0.12);
    --warning: #f5a524;
    --warning-soft: rgba(245, 165, 36, 0.12);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
    background-color: var(--bg);
    background-image:
        radial-gradient(circle at 1px 1px, rgba(255,255,255,0.05) 1px, transparent 0);
    background-size: 22px 22px;
    color: var(--text);
    font-family: var(--font-ui);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
::selection { background: var(--accent-soft); color: var(--text); }

.hidden { display: none !important; }

/* ---------- Layout shell ---------- */
.shell {
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
    padding: 14px 14px 48px;
    min-height: 100vh;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(13,18,32,0.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-bottom: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
    width: 36px; height: 36px; border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 0 1px rgba(34,211,238,0.15), 0 6px 18px rgba(61,127,255,0.4);
    flex-shrink: 0;
}
.brand-mark .ic { width: 18px; height: 18px; color: #fff; }
.brand-name { font-size: 13px; font-weight: 800; letter-spacing: .2px; line-height: 1.1; }
.brand-sub { font-size: 10px; color: var(--text-dim); font-family: var(--font-mono); }

.user-chip { display: flex; align-items: center; gap: 8px; }
.user-chip span { font-size: 12px; font-weight: 600; color: var(--text-dim); max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Buttons ---------- */
.btn {
    border: none; border-radius: var(--radius-sm);
    padding: 11px 16px; font-size: 12.5px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    transition: transform .08s ease, opacity .15s ease, background .15s ease;
    white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn .ic { width: 15px; height: 15px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 18px rgba(61,127,255,0.28); }
.btn-primary:hover { background: #2f70f2; }
.btn-ghost { background: var(--surface-3); color: var(--text); }
.btn-ghost:hover { background: #1c2740; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-dim); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success { background: var(--success-soft); color: var(--success); }
.btn-sm { padding: 7px 10px; font-size: 11px; }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: 11px; flex-shrink: 0; }
.btn:disabled { opacity: .5; pointer-events: none; }

/* ---------- Tabs ---------- */
.tabs {
    display: grid; gap: 6px;
    background: rgba(13,18,32,0.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border);
    padding: 6px; border-radius: var(--radius-md); margin-bottom: 14px;
}
.tab {
    padding: 10px 4px; border-radius: var(--radius-sm);
    text-align: center; font-size: 11.5px; font-weight: 700;
    color: var(--text-dim); display: flex; align-items: center; justify-content: center; gap: 5px;
    transition: background .15s, color .15s;
}
.tab .ic { width: 14px; height: 14px; }
.tab.active { background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(61,127,255,0.3); }
.tab.amber.active { background: var(--warning); color: #1a1305; box-shadow: 0 4px 14px rgba(245,165,36,0.3); }

/* ---------- Cards ---------- */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 18px;
}
.card-tight { padding: 12px; border-radius: var(--radius-md); }

/* ---------- Dropzone ---------- */
.dropzone {
    border: 1.5px dashed var(--border); border-radius: var(--radius-md);
    padding: 34px 16px; text-align: center; cursor: pointer;
    background: rgba(0,0,0,0.15); transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-icon {
    width: 46px; height: 46px; border-radius: 16px; margin: 0 auto 12px;
    background: var(--accent-soft); color: var(--accent-2);
    box-shadow: 0 0 0 1px rgba(34,211,238,0.15), 0 0 24px rgba(34,211,238,0.15);
    display: flex; align-items: center; justify-content: center;
}
.dropzone-icon .ic { width: 20px; height: 20px; }
.dropzone-title { font-size: 12.5px; font-weight: 700; margin-bottom: 4px; }
.dropzone-sub { font-size: 11px; color: var(--text-faint); }

/* ---------- Forms ---------- */
.field { margin-bottom: 12px; }
.field label {
    display: block; font-size: 10.5px; font-weight: 700; color: var(--text-dim);
    text-transform: none; margin-bottom: 6px;
}
.input, textarea.input, select.input {
    width: 100%; background: rgba(0,0,0,0.35); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 10px 12px; font-size: 12.5px; color: var(--text);
    outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--accent); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.search-box { position: relative; margin-bottom: 12px; }
.search-box .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-faint); }
.search-box .input { padding-left: 34px; }

/* ---------- Progress ---------- */
.progress-wrap { background: var(--surface-3); border-radius: 999px; height: 6px; overflow: hidden; }
.progress-bar { background: linear-gradient(90deg, var(--accent), var(--accent-2)); height: 100%; border-radius: 999px; transition: width .15s; }

/* ---------- File / list rows ---------- */
.file-row {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 12px; margin-bottom: 8px;
}
.file-main { display: flex; align-items: center; gap: 10px; overflow: hidden; }
.file-icon {
    width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface-3); color: var(--accent-2);
}
.file-icon .ic { width: 16px; height: 16px; }
.file-info { overflow: hidden; }
.file-name { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 10px; color: var(--text-faint); font-family: var(--font-mono); }
.file-actions { display: flex; gap: 6px; flex-shrink: 0; }

.folder-chip {
    display: flex; align-items: center; gap: 8px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 12px; margin-bottom: 8px;
    font-size: 12px; font-weight: 700;
}
.folder-chip .ic { width: 16px; height: 16px; color: var(--warning); }
.folder-chip .count { margin-left: auto; font-size: 10px; color: var(--text-faint); font-family: var(--font-mono); font-weight: 600; }

/* ---------- Empty state ---------- */
.empty {
    text-align: center; padding: 36px 16px; color: var(--text-faint);
    border: 1px dashed var(--border-soft); border-radius: var(--radius-md); font-size: 11.5px;
}
.empty .ic { width: 26px; height: 26px; margin-bottom: 8px; opacity: .5; }

/* ---------- Badges / pills ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    background: var(--surface-3); color: var(--text-dim);
    font-size: 10.5px; font-weight: 700; padding: 5px 10px; border-radius: 999px;
}
.badge .ic { width: 11px; height: 11px; }
.badge-accent { background: var(--accent-soft); color: var(--accent-2); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-success { background: var(--success-soft); color: var(--success); }

/* ---------- Stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 12px 8px; text-align: center;
}
.stat-num { font-family: var(--font-mono); font-size: 17px; font-weight: 800; color: var(--text); }
.stat-label { font-size: 9.5px; color: var(--text-faint); margin-top: 2px; }

.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.bar-label { width: 46px; font-size: 10.5px; color: var(--text-dim); flex-shrink: 0; font-weight: 700; }
.bar-track { flex: 1; height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.bar-val { width: 30px; text-align: right; font-size: 10px; font-family: var(--font-mono); color: var(--text-faint); flex-shrink: 0; }

/* ---------- Modal ---------- */
.overlay {
    position: fixed; inset: 0; background: rgba(2,4,10,0.82); backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 60;
}
.modal { width: 100%; max-width: 380px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h3 { font-size: 13px; font-weight: 800; margin: 0; }
.modal-close { width: 28px; height: 28px; border-radius: 9px; background: var(--surface-3); border: none; color: var(--text-dim); display: flex; align-items: center; justify-content: center; }
.divider-text { text-align: center; font-size: 9.5px; color: var(--text-faint); font-weight: 700; letter-spacing: .3px; margin: 14px 0; position: relative; }

/* ---------- Toast ---------- */
#toastHost { position: fixed; left: 0; right: 0; bottom: 18px; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 80; pointer-events: none; }
.toast {
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
    font-size: 12px; font-weight: 600; padding: 10px 16px; border-radius: 999px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4); display: flex; align-items: center; gap: 8px;
    animation: toastIn .2s ease;
}
.toast .ic { width: 14px; height: 14px; flex-shrink: 0; }
.toast.success { border-color: rgba(22,199,154,0.35); }
.toast.success .ic { color: var(--success); }
.toast.error { border-color: rgba(240,71,95,0.35); }
.toast.error .ic { color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px);} to { opacity: 1; transform: translateY(0);} }

/* ---------- Result card ---------- */
.result-card { background: var(--success-soft); border: 1px solid rgba(22,199,154,0.3); border-radius: var(--radius-md); padding: 14px; }
.result-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 12px; font-weight: 800; color: var(--success); }
.result-head .ic { width: 15px; height: 15px; }
.result-url { display: flex; align-items: center; background: rgba(0,0,0,0.35); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 8px; }
.result-url input { background: transparent; border: none; outline: none; color: var(--accent-2); font-size: 11px; font-family: var(--font-mono); padding: 6px 8px; flex: 1; min-width: 0; }

/* ---------- Player page ---------- */
.player-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px 16px; }
.player-card { width: 100%; max-width: 400px; }
.player-media {
    width: 100%; border-radius: var(--radius-md); overflow: hidden;
    background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center;
    max-height: 62vh; margin-bottom: 16px;
}
.player-media img, .player-media video { width: 100%; height: 100%; max-height: 62vh; object-fit: contain; display: block; }
.player-media.is-audio { flex-direction: column; padding: 28px 16px; gap: 14px; }
.player-media.is-audio .ic { width: 34px; height: 34px; color: var(--accent-2); }
.player-media audio { width: 100%; }
.player-media.is-doc { flex-direction: column; padding: 40px 16px; gap: 10px; color: var(--text-faint); }
.player-media.is-doc .ic { width: 30px; height: 30px; }
.player-lock { text-align: center; padding: 8px 4px 4px; }
.player-lock-icon {
    width: 52px; height: 52px; border-radius: 18px; margin: 0 auto 14px;
    background: var(--accent-soft); color: var(--accent-2);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 0 1px rgba(34,211,238,0.15), 0 8px 24px rgba(61,127,255,0.18);
}
.player-lock-icon .ic { width: 22px; height: 22px; }

/* ---------- Misc ---------- */
.row-between { display: flex; align-items: center; justify-content: space-between; }
.section-title { font-size: 11.5px; font-weight: 800; color: var(--text-dim); margin: 4px 0 10px; display: flex; align-items: center; gap: 6px; }
.section-title .ic { width: 13px; height: 13px; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
.spinner {
    width: 15px; height: 15px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.25); border-top-color: #fff;
    animation: spin .6s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.footer-note { text-align: center; font-size: 10px; color: var(--text-faint); margin-top: 18px; }

@media (max-width: 360px) {
    .stat-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .stat-num { font-size: 14px; }
}
