/* =========================================================
   Shaxsiy Cloud — Dark / Gold Theme
   ========================================================= */
:root {
    --bg-0: #0a0a0c;
    --bg-1: #111114;
    --bg-2: #17171b;
    --bg-3: #1f1f24;
    --bg-card: #16161a;
    --border: #2a2a30;
    --border-light: #333338;
    --gold: #d4af37;
    --gold-light: #f0d878;
    --gold-dark: #a8842a;
    --text-1: #f2f2f0;
    --text-2: #b8b8bd;
    --text-3: #7c7c84;
    --danger: #e5484d;
    --success: #2fbf71;
    --info: #4098d7;
    --radius: 10px;
    --radius-lg: 16px;
    --shadow: 0 8px 30px rgba(0,0,0,.45);
    --transition: .18s ease;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    background: var(--bg-0);
    color: var(--text-1);
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
::selection { background: rgba(212,175,55,.35); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dark); }

/* Icons */
.icon { width: 18px; height: 18px; flex-shrink: 0; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 40px; height: 40px; }
.icon-xl { width: 56px; height: 56px; }
svg.icon path, svg.icon rect, svg.icon circle, svg.icon ellipse { fill: none; }

/* =========================================================
   AUTH (LOGIN) SAHIFASI
   ========================================================= */
.auth-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(circle at 20% 20%, rgba(212,175,55,.08), transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(212,175,55,.06), transparent 40%),
        var(--bg-0);
    padding: 20px;
}
.auth-wrap { width: 100%; max-width: 400px; }
.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    box-shadow: var(--shadow);
}
.auth-logo { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--gold); margin-bottom: 6px; }
.auth-logo h1 { margin: 0; color: var(--text-1); font-size: 24px; font-weight: 700; letter-spacing: .3px; }
.auth-logo h1 span { color: var(--gold); }
.auth-sub { text-align: center; color: var(--text-3); margin: 4px 0 26px; font-size: 13px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.input-group {
    display: flex; align-items: center; gap: 10px;
    background: var(--bg-2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 12px 14px;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.input-group:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212,175,55,.12); }
.input-group svg { color: var(--text-3); }
.input-group input, .input-group select {
    flex: 1; background: transparent; border: none; outline: none; color: var(--text-1); font-size: 14px;
}
.auth-footnote { text-align: center; color: var(--text-3); font-size: 12px; margin: 20px 0 0; }

.alert { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px; }
.alert-error { background: rgba(229,72,77,.12); color: #ff8a8d; border: 1px solid rgba(229,72,77,.35); }
.alert-success { background: rgba(47,191,113,.12); color: #6fe3a3; border: 1px solid rgba(47,191,113,.35); }

/* =========================================================
   TUGMALAR
   ========================================================= */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--bg-3); color: var(--text-1); font-size: 13.5px; font-weight: 600;
    transition: all var(--transition); white-space: nowrap;
}
.btn:hover { background: var(--border-light); }
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; }
.btn-gold { background: linear-gradient(135deg, var(--gold-light), var(--gold) 60%, var(--gold-dark)); color: #1a1408; border: none; font-weight: 700; }
.btn-gold:hover { filter: brightness(1.08); }
.btn-outline { background: transparent; border: 1px solid var(--gold-dark); color: var(--gold-light); }
.btn-outline:hover { background: rgba(212,175,55,.1); }
.btn-danger { background: rgba(229,72,77,.14); color: #ff8a8d; border: 1px solid rgba(229,72,77,.4); }
.btn-danger:hover { background: rgba(229,72,77,.25); }
.btn-ghost { background: transparent; border: 1px solid transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-3); color: var(--text-1); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-icon { padding: 8px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* =========================================================
   APP LAYOUT
   ========================================================= */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 250px; flex-shrink: 0; background: var(--bg-1); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; padding: 20px 14px; gap: 22px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; color: var(--gold); }
.brand h2 { font-size: 17px; margin: 0; color: var(--text-1); font-weight: 700; }
.brand h2 span { color: var(--gold); }

.nav-section-title { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); padding: 0 10px; margin-bottom: 6px; }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px;
    color: var(--text-2); font-weight: 500; transition: all var(--transition); cursor: pointer; border: none; background: transparent; width: 100%; text-align: left; font-size: 13.5px;
}
.nav-item:hover { background: var(--bg-3); color: var(--text-1); }
.nav-item.active { background: rgba(212,175,55,.12); color: var(--gold-light); }
.nav-item.active svg { color: var(--gold); }
.nav-item .count { margin-left: auto; font-size: 11px; background: var(--bg-3); padding: 1px 7px; border-radius: 20px; color: var(--text-3); }

.storage-box { margin-top: auto; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.storage-box .label { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-3); margin-bottom: 8px; }
.progress-track { height: 7px; background: var(--bg-3); border-radius: 20px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--gold-dark), var(--gold)); border-radius: 20px; transition: width .4s ease; }
.progress-fill.warn { background: linear-gradient(90deg, #b5851f, #e5484d); }
.storage-box .sub { margin-top: 8px; font-size: 11px; color: var(--text-3); }

.user-box { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius); background: var(--bg-2); border: 1px solid var(--border); }
.user-box .avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--gold-light), var(--gold-dark)); display: flex; align-items: center; justify-content: center; color: #1a1408; font-weight: 700; flex-shrink: 0; }
.user-box .info { flex: 1; min-width: 0; }
.user-box .info b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-box .info small { color: var(--text-3); font-size: 11px; }

/* Main content */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; gap: 16px; padding: 16px 26px; border-bottom: 1px solid var(--border);
    background: var(--bg-1); position: sticky; top: 0; z-index: 20;
}
.breadcrumb { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 14px; color: var(--text-2); flex: 1; min-width: 0; }
.breadcrumb .crumb { display: flex; align-items: center; gap: 4px; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.breadcrumb .crumb:hover { background: var(--bg-3); color: var(--gold-light); }
.breadcrumb .crumb.current { color: var(--text-1); font-weight: 600; }
.breadcrumb .sep { color: var(--text-3); width: 15px; height: 15px; }

.search-box { display: flex; align-items: center; gap: 8px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 20px; padding: 8px 14px; width: 240px; }
.search-box input { background: transparent; border: none; outline: none; color: var(--text-1); width: 100%; font-size: 13px; }
.search-box svg { color: var(--text-3); }

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.view-toggle { display: flex; background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.view-toggle button { background: transparent; border: none; padding: 8px 10px; color: var(--text-3); }
.view-toggle button.active { background: var(--bg-3); color: var(--gold); }

.content { padding: 24px 26px; flex: 1; }
.content-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.content-header h2 { margin: 0; font-size: 19px; }
.content-header .muted { color: var(--text-3); font-size: 12.5px; margin-top: 3px; }

.filter-chips { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.chip {
    display: flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 20px;
    border: 1px solid var(--border); background: var(--bg-2); color: var(--text-2); font-size: 12.5px; font-weight: 600;
}
.chip.active { background: rgba(212,175,55,.14); border-color: var(--gold-dark); color: var(--gold-light); }
.chip svg { width: 14px; height: 14px; }

/* File/Folder grid */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.file-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 16px 14px; display: flex; flex-direction: column; align-items: center; gap: 10px;
    cursor: pointer; position: relative; transition: all var(--transition); text-align: center;
}
.file-card:hover { border-color: var(--gold-dark); transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,.35); }
.file-card .thumb {
    width: 100%; height: 90px; border-radius: 10px; background: var(--bg-2);
    display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--gold);
}
.file-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-card .thumb svg { width: 34px; height: 34px; }
.file-card.folder .thumb { color: var(--gold-light); }
.file-card .fname { font-size: 12.5px; font-weight: 600; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card .fmeta { font-size: 10.5px; color: var(--text-3); }
.file-card .card-menu-btn {
    position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.4); border-radius: 6px; padding: 4px;
    color: var(--text-2); opacity: 0; transition: opacity var(--transition);
}
.file-card:hover .card-menu-btn { opacity: 1; }
.file-card .share-badge { position: absolute; top: 8px; left: 8px; color: var(--gold); background: rgba(0,0,0,.4); border-radius: 6px; padding: 4px; }
.file-card .share-badge svg { width: 13px; height: 13px; }

/* List view */
.file-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.file-row {
    display: grid; grid-template-columns: 30px 1fr 110px 160px 40px; align-items: center; gap: 14px;
    padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background var(--transition);
}
.file-row:last-child { border-bottom: none; }
.file-row:hover { background: var(--bg-2); }
.file-row .ftype-icon { color: var(--gold); }
.file-row .fname { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .fsize, .file-row .fdate { font-size: 12px; color: var(--text-3); }
.file-list .list-head { display: grid; grid-template-columns: 30px 1fr 110px 160px 40px; gap: 14px; padding: 10px 16px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); background: var(--bg-2); }

.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 70px 20px; color: var(--text-3); gap: 12px; }
.empty-state svg { width: 54px; height: 54px; opacity: .4; }

/* Context menu / dropdown */
.dropdown-menu {
    position: fixed; background: var(--bg-3); border: 1px solid var(--border-light); border-radius: 10px;
    box-shadow: var(--shadow); padding: 6px; min-width: 190px; z-index: 200; display: none;
}
.dropdown-menu.open { display: block; }
.dropdown-menu button {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 7px;
    background: transparent; border: none; color: var(--text-1); font-size: 13px; text-align: left;
}
.dropdown-menu button:hover { background: var(--bg-2); }
.dropdown-menu button.danger { color: #ff8a8d; }
.dropdown-menu button.danger:hover { background: rgba(229,72,77,.12); }
.dropdown-menu hr { border: none; border-top: 1px solid var(--border); margin: 5px 0; }

/* Modals */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.65); backdrop-filter: blur(3px);
    display: none; align-items: center; justify-content: center; z-index: 500; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius-lg);
    width: 100%; max-width: 440px; padding: 24px; box-shadow: var(--shadow); max-height: 90vh; overflow-y: auto;
}
.modal.modal-lg { max-width: 700px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h3 { margin: 0; font-size: 16.5px; display: flex; align-items: center; gap: 10px; }
.modal-head h3 svg { color: var(--gold); }
.modal-close { color: var(--text-3); padding: 4px; border-radius: 6px; }
.modal-close:hover { background: var(--bg-3); color: var(--text-1); }
.modal-body { display: flex; flex-direction: column; gap: 14px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.field input[type=text], .field input[type=password], .field input[type=number], .field select {
    background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; color: var(--text-1); outline: none;
}
.field input:focus, .field select:focus { border-color: var(--gold); }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

/* Share modal specifics */
.share-link-box { display: flex; gap: 8px; align-items: center; background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.share-link-box input { flex: 1; background: transparent; border: none; color: var(--gold-light); outline: none; font-size: 12.5px; }
.qr-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px; background: #fff; border-radius: 12px; }
.expiry-row { display: flex; align-items: center; gap: 10px; color: var(--gold); }

/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); display: none; align-items: center; justify-content: center; z-index: 600; flex-direction: column; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 90vw; max-height: 82vh; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.6); }
.lightbox .lb-close { position: absolute; top: 20px; right: 24px; color: #fff; background: rgba(255,255,255,.1); padding: 10px; border-radius: 50%; }
.lightbox .lb-title { color: #ddd; margin-top: 14px; font-size: 13px; }

/* Media modal (video/audio) */
.media-modal { background: var(--bg-card); border-radius: var(--radius-lg); padding: 20px; max-width: 800px; width: 100%; }
.media-modal video, .media-modal audio { width: 100%; border-radius: 10px; background: #000; }

/* Toast */
.toast-wrap { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 999; }
.toast {
    display: flex; align-items: center; gap: 10px; background: var(--bg-3); border: 1px solid var(--border-light);
    padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: 13px; min-width: 240px;
    animation: slideIn .25s ease;
}
.toast.success { border-color: rgba(47,191,113,.5); }
.toast.success svg { color: var(--success); }
.toast.error { border-color: rgba(229,72,77,.5); }
.toast.error svg { color: var(--danger); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Drag & drop */
.dropzone-active::after {
    content: 'Fayllarni shu yerga tashlang'; position: fixed; inset: 0; background: rgba(212,175,55,.08);
    border: 3px dashed var(--gold); display: flex; align-items: center; justify-content: center;
    color: var(--gold-light); font-size: 22px; font-weight: 700; z-index: 400; pointer-events: none;
}

/* Upload progress */
.upload-progress-wrap { position: fixed; bottom: 20px; left: 20px; width: 300px; background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); z-index: 900; display: none; }
.upload-progress-wrap.open { display: block; }
.upload-progress-wrap .up-title { font-size: 12.5px; font-weight: 600; margin-bottom: 8px; display: flex; justify-content: space-between; }
.upload-item { font-size: 11.5px; color: var(--text-2); margin-bottom: 6px; }
.upload-item .bar { height: 5px; background: var(--bg-2); border-radius: 10px; overflow: hidden; margin-top: 3px; }
.upload-item .bar-fill { height: 100%; background: var(--gold); transition: width .2s; }

/* Editor page */
.editor-body { background: var(--bg-0); }
.editor-topbar { display: flex; align-items: center; gap: 14px; padding: 14px 22px; border-bottom: 1px solid var(--border); background: var(--bg-1); }
.editor-topbar .fname-badge { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--gold-light); }
.editor-topbar .spacer { flex: 1; }
.CodeMirror { height: calc(100vh - 60px) !important; font-size: 14px; }

/* Admin page */
.admin-table-wrap { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
table.admin-table { width: 100%; border-collapse: collapse; }
table.admin-table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); background: var(--bg-2); padding: 12px 16px; }
table.admin-table td { padding: 12px 16px; border-top: 1px solid var(--border); font-size: 13px; }
table.admin-table tr:hover td { background: rgba(255,255,255,.015); }
.role-badge { padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.role-badge.admin { background: rgba(212,175,55,.15); color: var(--gold-light); }
.role-badge.user { background: rgba(64,152,215,.15); color: #7fc0ec; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; display: flex; align-items: center; gap: 14px; }
.stat-card .ic { width: 44px; height: 44px; border-radius: 12px; background: rgba(212,175,55,.12); display: flex; align-items: center; justify-content: center; color: var(--gold); flex-shrink: 0; }
.stat-card .val { font-size: 20px; font-weight: 700; }
.stat-card .lbl { font-size: 11.5px; color: var(--text-3); }
.mini-progress { width: 90px; height: 6px; background: var(--bg-2); border-radius: 20px; overflow: hidden; display: inline-block; vertical-align: middle; margin-left: 8px; }
.mini-progress span { display: block; height: 100%; background: var(--gold); }

/* Responsive */
@media (max-width: 900px) {
    .sidebar { position: fixed; left: -260px; z-index: 300; transition: left .2s; box-shadow: var(--shadow); }
    .sidebar.open { left: 0; }
    .search-box { width: 140px; }
    .file-row { grid-template-columns: 26px 1fr 40px; }
    .file-row .fsize, .file-row .fdate { display: none; }
    .list-head { grid-template-columns: 26px 1fr 40px; }
    .list-head span:nth-child(3), .list-head span:nth-child(4) { display: none; }
}
.hamburger { display: none; }
@media (max-width: 900px) { .hamburger { display: flex; } }
