/* ─── VVM Bot Premium Panel CSS ─── */
:root {
    --bg: #0a0b14;
    --surface: #111320;
    --surface2: #161829;
    --border: rgba(255,255,255,0.07);
    --text: #f0f2ff;
    --muted: #6b7280;
    --cyan: #22d3ee;
    --violet: #a855f7;
    --green: #22c55e;
    --orange: #f97316;
    --red: #ef4444;
    --nav-h: 65px;
    --header-h: 60px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
    font-size: 15px;
    overflow: hidden;
}

/* ─── GLOW BG ─── */
.glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.12;
    pointer-events: none;
    z-index: 0;
}
.glow-1 { width: 400px; height: 400px; background: var(--cyan);   top: -100px; right: -100px; }
.glow-2 { width: 350px; height: 350px; background: var(--violet); bottom: 60px; left: -80px; }
.glow-3 { width: 200px; height: 200px; background: var(--orange); top: 50%; left: 50%; }

/* ─── LOADING ─── */
#loading-screen {
    position: fixed; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 20px; z-index: 100;
    background: var(--bg);
}
#loading-screen p { color: var(--muted); font-size: 14px; }
.loader-ring {
    width: 44px; height: 44px;
    border: 3px solid var(--border);
    border-top-color: var(--cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── APP WRAPPER ─── */
.app { position: fixed; inset: 0; display: flex; flex-direction: column; z-index: 1; }
.hidden { display: none !important; }

/* ─── BOTTOM NAV ─── */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--nav-h);
    background: rgba(17,19,32,0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 50;
}
.nav-btn {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: var(--muted);
    font-size: 10px;
    font-weight: 500;
    transition: color 0.2s;
}
.nav-btn .nav-icon { font-size: 20px; line-height: 1; }
.nav-btn.active { color: var(--cyan); }
.nav-btn.active .nav-icon { filter: drop-shadow(0 0 6px var(--cyan)); }

/* ─── MAIN CONTENT ─── */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px calc(var(--nav-h) + 16px);
    -webkit-overflow-scrolling: touch;
}

/* ─── TAB PAGES ─── */
.tab-page { display: none; animation: fadeIn 0.25s ease; }
.tab-page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ─── PAGE HEADER ─── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-top: 8px;
}
.page-header h1 { font-size: 22px; font-weight: 700; }
.subtitle { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ─── AVATAR ─── */
.avatar-wrap .avatar {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, var(--cyan), var(--violet));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}

/* ─── LIMIT BANNER ─── */
.limit-banner {
    background: linear-gradient(135deg, rgba(34,211,238,0.1), rgba(168,85,247,0.1));
    border: 1px solid rgba(34,211,238,0.2);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.limit-icon { font-size: 28px; }
.limit-label { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.limit-value { font-size: 15px; font-weight: 600; color: var(--cyan); }

/* ─── STATS ROW ─── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 24px;
}
.stat-mini {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
}
.stat-mini.accent { border-color: rgba(168,85,247,0.3); background: rgba(168,85,247,0.07); }
.stat-mini-icon { font-size: 22px; }
.stat-mini-num { font-size: 18px; font-weight: 700; color: var(--text); }
.stat-mini-label { font-size: 10px; color: var(--muted); }

/* ─── SECTION TITLE ─── */
.section-title { font-size: 14px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 12px; }

/* ─── ADMIN SECTION ─── */
.admin-section { margin-bottom: 24px; }

/* Dashboard'dagi "Admin Panel" kirish tugmasi (adminlarga ko'rinadi) */
.admin-entry {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 24px;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.admin-entry:active { transform: scale(0.98); background: var(--surface2); }

/* Admin bo'limlar menyusi */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}
.admin-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text);
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.admin-card:active { transform: scale(0.94); background: var(--surface2); }
.admin-card-icon { font-size: 22px; }

/* Bo'lim ichidagi elementlar */
.admin-h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    margin: 14px 0 8px;
}
.admin-h3:first-child { margin-top: 0; }

.admin-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 7px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}
.admin-row:last-child { border-bottom: none; }
.admin-row span { color: var(--muted); }
.admin-row b { word-break: break-word; text-align: right; }

.admin-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 8px;
}
.admin-item-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
}
.admin-item-main b { word-break: break-word; }
.muted-sm { color: var(--muted); font-size: 11px; word-break: break-all; }

.admin-pager { display: flex; gap: 8px; margin: 12px 0; }

/* Bazalarni belgilash uchun checkbox */
.db-check {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    flex-shrink: 0;
    accent-color: var(--accent, #5b8cff);
}

.btn-sm.danger { border-color: #e5484d; color: #e5484d; }
.btn-primary.danger { background: #e5484d; }

/* Ko'p qatorli textarea inputlar */
textarea.input {
    resize: vertical;
    min-height: 70px;
    font-family: inherit;
    line-height: 1.5;
}
.admin-entry-icon  { font-size: 18px; }
.admin-entry-txt   { flex: 1; text-align: left; }
.admin-entry-arrow { color: var(--muted); font-size: 20px; }

/* ─── QUICK ACTIONS ─── */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 24px;
}
.action-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text);
    font-size: 11px;
    font-weight: 500;
}
.action-card:active { transform: scale(0.94); background: var(--surface2); }
.action-icon { font-size: 24px; }

/* ─── CARDS ─── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 16px;
}

/* ─── FORM ─── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; font-weight: 500; }
.input {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
}
.input:focus { border-color: var(--cyan); }
.input::placeholder { color: var(--muted); }
.field-hint { display: block; margin-top: 6px; font-size: 11px; color: var(--muted); line-height: 1.4; }
textarea.input { resize: none; }
select.input { cursor: pointer; }
select.input option { background: var(--surface2); }

/* ─── TOGGLE BUTTONS ─── */
.toggle-row { display: flex; gap: 8px; flex-wrap: wrap; }
.toggle-btn {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 14px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.toggle-btn.active {
    background: rgba(34,211,238,0.15);
    border-color: var(--cyan);
    color: var(--cyan);
}

/* ─── BUTTONS ─── */
.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--cyan), var(--violet));
    border: none;
    border-radius: 12px;
    padding: 14px;
    color: #fff;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    margin-top: 4px;
}
.btn-primary:active { opacity: 0.8; transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-sm {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    color: var(--muted);
    cursor: pointer;
    font-size: 16px;
}

/* ─── FILE UPLOAD ─── */
.file-upload {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface2);
    border: 1px dashed var(--border);
    border-radius: 10px;
    padding: 14px;
    cursor: pointer;
    color: var(--muted);
    font-size: 13px;
    transition: border-color 0.2s;
}
.file-upload:hover { border-color: var(--cyan); }

/* ─── DATABASE CARDS ─── */
.db-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}
/* Yuqori qator: ikonka + nom (to'liq enlik) + soni */
.db-card-top { display: flex; align-items: center; gap: 12px; }
.db-card-icon { font-size: 24px; flex-shrink: 0; }
.db-card-info { flex: 1; min-width: 0; }
.db-card-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-card-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.db-card-badge {
    background: rgba(34,211,238,0.12);
    color: var(--cyan);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}
/* Pastki qator: amal tugmalari — endi to'liq nom bilan (CSV/JSON/Ulashish) */
.db-card-actions { display: flex; gap: 8px; align-items: center; }
.db-delete-btn {
    background: rgba(239,68,68,0.12);
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--red);
    cursor: pointer;
    font-size: 14px;
    margin-left: auto;   /* o'chirish tugmasi o'ngga suriladi */
}
.db-export-btn {
    background: rgba(34,211,238,0.1);
    border: 1px solid rgba(34,211,238,0.2);
    border-radius: 8px;
    padding: 7px 11px;
    color: var(--cyan);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.btn-danger {
    width: 100%;
    margin-top: 10px;
    background: rgba(239,68,68,0.15);
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: 10px;
    padding: 10px;
    color: var(--red);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

/* ─── SKELETON ─── */
.skeleton-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    height: 70px;
    margin-bottom: 10px;
    animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.7; }
}

/* ─── INFO CARD ─── */
.info-card {
    background: rgba(34,211,238,0.08);
    border: 1px solid rgba(34,211,238,0.2);
    border-radius: 12px;
    padding: 14px;
    font-size: 13px;
    color: var(--cyan);
    margin-top: 12px;
}

/* Status qutisi: uzun matn o'raladi, yangi qatorlar saqlanadi, juda uzun bo'lsa
   scroll bo'ladi (ekranga sig'maslik muammosini hal qiladi). */
.status-box {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
    max-height: 45vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ─── TOAST ─── */
.toast {
    position: fixed;
    top: 20px; left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    z-index: 200;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    animation: slideDown 0.3s ease;
    white-space: nowrap;
}
@keyframes slideDown { from { top: -10px; opacity: 0; } to { top: 20px; opacity: 1; } }

/* ─── EMPTY STATE ─── */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }
