@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Syne:wght@600;700;800&display=swap');

:root {
    --navy-950: #0A1628;
    --navy-900: #0F2038;
    --navy-800: #16304F;
    --navy-700: #1E3F66;
    --navy-100: #E9EEF5;
    --gold-500: #C9A961;
    --gold-400: #D9BE7F;
    --gold-100: #F5EDD8;
    --ink: #101828;
    --muted: #667085;
    --border: #E4E7EC;
    --surface: #FFFFFF;
    --bg: #F7F8FA;
    --danger: #E15241;
    --success: #2F855A;
    --radius: 12px;
    --shadow-sm: 0 1px 2px rgba(16,24,40,.06);
    --shadow-md: 0 4px 16px rgba(16,24,40,.08);
    --shadow-lg: 0 12px 40px rgba(10,22,40,.16);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .brand, .font-display {
    font-family: 'Syne', sans-serif;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--gold-100); }

/* ===== Layout ===== */
.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}
@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .sidebar.open { display: flex; position: fixed; z-index: 50; inset: 0 20% 0 0; }
}

.sidebar {
    background: linear-gradient(180deg, var(--navy-950), var(--navy-900));
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 24px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 28px;
    font-weight: 700;
    font-size: 19px;
    letter-spacing: .3px;
}
.sidebar .brand .mark {
    width: 34px; height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
    display: flex; align-items: center; justify-content: center;
    color: var(--navy-950);
    font-weight: 800;
    font-size: 16px;
}
.sidebar .brand .sub { display:block; font-family:'DM Sans',sans-serif; font-weight:400; font-size:11px; color:#93A2BD; letter-spacing:.5px; text-transform:uppercase;}

.nav-group { margin-bottom: 22px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: #7488A6; padding: 0 10px 8px; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 10px;
    color: #C7D2E3; font-size: 14.5px; font-weight: 500;
    margin-bottom: 2px;
    transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(201,169,97,.16); color: var(--gold-400); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.storage-box {
    margin-top: auto;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 12px;
    padding: 14px;
}
.storage-box .bar { height: 6px; border-radius: 4px; background: rgba(255,255,255,.1); overflow: hidden; margin: 8px 0; }
.storage-box .bar-fill { height: 100%; background: linear-gradient(90deg, var(--gold-500), var(--gold-400)); }
.storage-box small { color: #93A2BD; font-size: 12px; }

.user-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 10px; border-radius: 10px;
    margin-top: 10px;
}
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 13px;
    flex-shrink: 0;
}
.user-chip .meta { min-width: 0; }
.user-chip .name { font-size: 13.5px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .role { font-size: 11.5px; color: #93A2BD; text-transform: capitalize; }
.user-chip .logout { margin-left: auto; color: #93A2BD; }
.user-chip .logout:hover { color: var(--gold-400); }

/* ===== Main content ===== */
.main { padding: 22px 28px 60px; max-width: 1400px; }
.topbar {
    display: flex; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap;
}
.searchbar {
    flex: 1; min-width: 220px;
    display: flex; align-items: center; gap: 10px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; padding: 10px 14px;
}
.searchbar input { border: none; outline: none; flex: 1; font-size: 14.5px; background: transparent; }
.searchbar svg { width: 17px; height: 17px; color: var(--muted); }

.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 16px; border-radius: 10px; border: none;
    font-size: 14px; font-weight: 600;
    transition: transform .1s, box-shadow .15s, background .15s;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--navy-900); color: #fff; }
.btn-primary:hover { background: var(--navy-800); box-shadow: var(--shadow-md); }
.btn-gold { background: linear-gradient(135deg, var(--gold-400), var(--gold-500)); color: var(--navy-950); }
.btn-gold:hover { box-shadow: 0 6px 18px rgba(201,169,97,.35); }
.btn-ghost { background: var(--surface); border: 1px solid var(--border); color: var(--ink); }
.btn-ghost:hover { border-color: var(--navy-700); }
.btn-danger { background: #FEEBEA; color: var(--danger); }
.btn-sm { padding: 7px 12px; font-size: 13px; }

.breadcrumb { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; font-size: 14.5px; color: var(--muted); }
.breadcrumb a { color: var(--navy-700); font-weight: 500; }
.breadcrumb a:hover { color: var(--gold-500); }
.breadcrumb .sep { color: #C0C6D1; }
.breadcrumb .current { color: var(--ink); font-weight: 600; }

.page-title { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.page-sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }

/* Dropzone */
.dropzone {
    border: 1.5px dashed var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 26px;
    text-align: center;
    margin-bottom: 24px;
    transition: border-color .15s, background .15s;
}
.dropzone.drag-over { border-color: var(--gold-500); background: var(--gold-100); }
.dropzone svg { width: 30px; height: 30px; color: var(--gold-500); margin-bottom: 8px; }
.dropzone p { margin: 0; font-size: 14px; color: var(--muted); }
.dropzone strong { color: var(--navy-800); }

/* Grid of folders/files */
.section-label { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 22px 0 12px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }

.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px; position: relative; cursor: pointer;
    transition: box-shadow .15s, border-color .15s, transform .1s;
}
.card:hover { box-shadow: var(--shadow-md); border-color: #D8DCE4; transform: translateY(-1px); }
.card .icon-wrap { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.card .icon-wrap svg { width: 22px; height: 22px; }
.card .name { font-size: 14px; font-weight: 600; margin: 0 0 4px; word-break: break-word; line-height: 1.35; }
.card .meta { font-size: 12px; color: var(--muted); }
.card .thumb { width: 100%; height: 90px; object-fit: cover; border-radius: 8px; margin-bottom: 10px; background: var(--bg); }
.card .more-btn {
    position: absolute; top: 10px; right: 10px;
    width: 26px; height: 26px; border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    color: var(--muted); background: transparent; border: none;
}
.card .more-btn:hover { background: var(--bg); color: var(--ink); }
.card .more-btn svg { width: 16px; height: 16px; }

.folder-card .icon-wrap { background: var(--navy-100); color: var(--navy-800); }

/* List rows (used inside modals for move/search results) */
.row-list { display: flex; flex-direction: column; gap: 4px; }
.row-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; }
.row-item:hover { background: var(--bg); }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state svg { width: 46px; height: 46px; color: #D8DCE4; margin-bottom: 12px; }
.empty-state strong { display: block; color: var(--ink); font-size: 15.5px; margin-bottom: 4px; }

/* Context menu */
.ctx-menu {
    position: fixed; z-index: 200; background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 190px; display: none;
}
.ctx-menu.open { display: block; }
.ctx-menu button {
    width: 100%; text-align: left; background: none; border: none; padding: 9px 10px;
    font-size: 13.5px; border-radius: 7px; display: flex; align-items: center; gap: 10px; color: var(--ink);
}
.ctx-menu button:hover { background: var(--bg); }
.ctx-menu button.danger { color: var(--danger); }
.ctx-menu button svg { width: 15px; height: 15px; color: var(--muted); }
.ctx-menu hr { border: none; border-top: 1px solid var(--border); margin: 5px 0; }

/* Modal */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(10,22,40,.5); backdrop-filter: blur(2px);
    display: none; align-items: center; justify-content: center; z-index: 300; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--surface); border-radius: 16px; width: 100%; max-width: 440px;
    padding: 24px; box-shadow: var(--shadow-lg); max-height: 88vh; overflow-y: auto;
}
.modal h3 { margin: 0 0 4px; font-size: 17px; }
.modal p.desc { color: var(--muted); font-size: 13.5px; margin: 0 0 16px; }
.modal input[type=text], .modal input[type=email], .modal input[type=password], .modal select {
    width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 9px; font-size: 14px; margin-bottom: 12px; font-family: inherit;
}
.modal input:focus, .modal select:focus { outline: none; border-color: var(--navy-700); }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.modal-preview img, .modal-preview iframe { width: 100%; border-radius: 10px; border: none; }

/* Toast */
.toast-wrap { position: fixed; bottom: 20px; right: 20px; z-index: 400; display: flex; flex-direction: column; gap: 10px; }
.toast {
    background: var(--navy-950); color: #fff; padding: 12px 16px; border-radius: 10px;
    font-size: 13.5px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px;
    animation: slideIn .2s ease;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--navy-950); border-left: 3px solid var(--gold-500); }
@keyframes slideIn { from { opacity: 0; transform: translateX(10px);} to {opacity:1; transform: translateX(0);} }

/* Progress */
.upload-progress { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }
.upload-progress .name { font-size: 13px; font-weight: 500; margin-bottom: 6px; display:flex; justify-content:space-between; }
.upload-progress .bar { height: 5px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.upload-progress .bar-fill { height: 100%; background: var(--gold-500); width: 0%; transition: width .1s; }

/* Login page */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at 20% 20%, var(--navy-800), var(--navy-950) 60%);
    padding: 20px;
}
.login-card {
    background: var(--surface); border-radius: 18px; padding: 38px 34px; width: 100%; max-width: 380px;
    box-shadow: var(--shadow-lg);
}
.login-card .mark { width: 46px; height: 46px; border-radius: 12px; background: linear-gradient(135deg, var(--gold-400), var(--gold-500)); display:flex; align-items:center; justify-content:center; color: var(--navy-950); font-weight:800; margin-bottom: 18px; }
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card p.desc { color: var(--muted); font-size: 13.5px; margin: 0 0 22px; }
.login-card label { font-size: 13px; font-weight: 600; margin-bottom: 6px; display: block; }
.login-card .field { margin-bottom: 16px; }
.login-card .error-box { background: #FEEBEA; color: var(--danger); padding: 10px 12px; border-radius: 9px; font-size: 13px; margin-bottom: 16px; }
.login-card button[type=submit] { width: 100%; padding: 12px; justify-content: center; margin-top: 4px; }

.mobile-topbar { display: none; }
@media (max-width: 900px) {
    .mobile-topbar {
        display: flex; align-items: center; justify-content: space-between;
        background: var(--navy-950); color: #fff; padding: 14px 18px; position: sticky; top: 0; z-index: 40;
    }
    .mobile-topbar button { background: none; border: none; color: #fff; }
    .main { padding: 18px 16px 50px; }
}
