/* ─── Variables ───────────────────────────────────────────────────────────── */
:root {
    --bg:          #0d0d12;
    --surface:     #16161f;
    --surface2:    #1e1e2a;
    --surface3:    #252535;
    --border:      #30304a;
    --border2:     #3e3e5e;
    --text:        #eeeef8;
    --text2:       #c4c4de;
    --muted:       #9898b8;
    --accent:      #5b7fff;
    --accent-h:    #7a96ff;
    --accent-dim:  rgba(91,127,255,.14);
    --success:     #22c55e;
    --success-dim: rgba(34,197,94,.14);
    --warning:     #f59e0b;
    --warning-dim: rgba(245,158,11,.14);
    --danger:      #ef4444;
    --danger-dim:  rgba(239,68,68,.14);
    --sidebar-w:   248px;
    --radius:      10px;
    --radius-lg:   14px;
}

/* ─── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-h); }
img { max-width: 100%; }

/* ─── Login ───────────────────────────────────────────────────────────────── */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 50% 0%, rgba(91,127,255,.12) 0%, transparent 70%), var(--bg);
}
.login-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 44px 40px;
    width: 400px;
    max-width: 95vw;
}
.login-logo { text-align: center; margin-bottom: 36px; }
.login-icon {
    width: 60px; height: 60px;
    background: var(--accent-dim);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; color: var(--accent);
    margin: 0 auto 16px;
}
.login-logo h1 { font-size: 26px; font-weight: 800; color: var(--text); letter-spacing: -.5px; }
.login-logo p  { color: var(--text2); font-size: 13px; margin-top: 4px; }

/* ─── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    font-size: 11px; font-weight: 700;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: .6px;
    margin-bottom: 7px;
}
.form-control {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(91,127,255,.15);
}
.form-control::placeholder { color: var(--muted); }
.form-control:disabled { opacity: .5; cursor: not-allowed; }
textarea.form-control  { resize: vertical; min-height: 88px; }
select.form-control    { cursor: pointer; }
.input-icon { position: relative; }
.input-icon > i {
    position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
    color: var(--muted); font-size: 13px; pointer-events: none;
}
.input-icon .form-control { padding-left: 36px; }
.form-hint { font-size: 12px; color: var(--text2); margin-top: 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 20px;
    border-radius: var(--radius);
    font-size: 13px; font-weight: 600;
    border: none; cursor: pointer;
    transition: all .18s;
    white-space: nowrap;
    text-decoration: none;
    font-family: inherit;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--accent);  color: #fff; }
.btn-primary:hover  { background: var(--accent-h); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(91,127,255,.35); }
.btn-success  { background: var(--success); color: #fff; }
.btn-success:hover  { background: #16a34a; color: #fff; transform: translateY(-1px); }
.btn-danger   { background: var(--danger);  color: #fff; }
.btn-danger:hover   { background: #dc2626; color: #fff; }
.btn-warning  { background: var(--warning); color: #000; }
.btn-warning:hover  { background: #d97706; }
.btn-ghost    { background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover    { background: var(--surface3); color: var(--text); }
.btn-sm  { padding: 5px 12px; font-size: 12px; border-radius: 7px; }
.btn-lg  { padding: 12px 28px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }

/* ─── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px; border-radius: var(--radius);
    margin-bottom: 18px; font-size: 13px;
    display: flex; align-items: center; gap: 8px;
}
.alert-danger  { background: var(--danger-dim);  border: 1px solid rgba(239,68,68,.3);   color: #fca5a5; }
.alert-success { background: var(--success-dim); border: 1px solid rgba(34,197,94,.3);   color: #86efac; }
.alert-warning { background: var(--warning-dim); border: 1px solid rgba(245,158,11,.3);  color: #fcd34d; }
.alert-info    { background: var(--accent-dim);  border: 1px solid rgba(91,127,255,.3);  color: #93b4ff; }

/* ─── Layout ──────────────────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

/* ─── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; height: 100vh;
    overflow-y: auto; overflow-x: hidden;
    z-index: 100;
}
.sidebar-logo {
    padding: 22px 18px 18px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
}
.sidebar-logo-icon {
    width: 38px; height: 38px;
    background: var(--accent-dim);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: var(--accent); font-size: 17px;
    flex-shrink: 0;
}
.sidebar-logo h2  { font-size: 18px; font-weight: 800; color: var(--text); letter-spacing: -.3px; }
.sidebar-logo span{ font-size: 11px; color: var(--text2); display: block; margin-top: 1px; }
.sidebar-section  { padding: 18px 10px 6px; }
.sidebar-section-title {
    font-size: 10px; font-weight: 700;
    color: #7878a0;
    text-transform: uppercase; letter-spacing: 1px;
    padding: 0 8px; margin-bottom: 6px;
}
.sidebar-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--text2);
    font-size: 13px; font-weight: 500;
    transition: all .15s;
    margin-bottom: 1px;
}
.sidebar-nav a:hover   { background: var(--surface2); color: var(--text); }
.sidebar-nav a.active  { background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.sidebar-nav a i       { width: 16px; text-align: center; font-size: 14px; flex-shrink: 0; }
.sidebar-user {
    margin-top: auto; padding: 14px;
    border-top: 1px solid var(--border);
}
.sidebar-user-info {
    display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.sidebar-avatar {
    width: 34px; height: 34px;
    background: var(--accent);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; color: #fff;
    flex-shrink: 0;
}
.sidebar-user-name  { font-size: 13px; font-weight: 600; color: var(--text); }
.sidebar-user-role  { font-size: 11px; color: var(--text2); }

/* ─── Main content ────────────────────────────────────────────────────────── */
.main { margin-left: var(--sidebar-w); flex: 1; padding: 32px 36px; min-width: 0; }

/* ─── Page header ─────────────────────────────────────────────────────────── */
.page-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 28px; gap: 16px;
}
.page-title    { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -.4px; }
.page-subtitle { font-size: 13px; color: var(--text2); margin-top: 3px; }

/* ─── Cards ───────────────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 26px;
    margin-bottom: 24px;
}
.card-title {
    font-size: 15px; font-weight: 700; color: var(--text);
    margin-bottom: 20px;
    display: flex; align-items: center; gap: 8px;
}
.card-title i { color: var(--accent); }

/* ─── Stats grid ──────────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px; margin-bottom: 28px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex; align-items: center; gap: 16px;
    transition: border-color .2s;
}
.stat-card:hover { border-color: var(--border2); }
.stat-icon {
    width: 50px; height: 50px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 21px; flex-shrink: 0;
}
.stat-icon.blue   { background: var(--accent-dim);  color: var(--accent); }
.stat-icon.green  { background: var(--success-dim); color: var(--success); }
.stat-icon.yellow { background: var(--warning-dim); color: var(--warning); }
.stat-icon.red    { background: var(--danger-dim);  color: var(--danger); }
.stat-icon.purple { background: rgba(168,85,247,.14); color: #a855f7; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 12px; color: var(--text2); font-weight: 500; }

/* ─── Tables ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table  { width: 100%; border-collapse: collapse; }
thead th {
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .5px;
    color: var(--text2); padding: 10px 14px;
    text-align: left; border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
tbody td      { padding: 13px 14px; border-bottom: 1px solid var(--border); font-size: 13px; color: #dcdcf0; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }
.table-empty {
    text-align: center; padding: 48px 20px !important;
    color: var(--muted) !important;
}
.table-empty i { font-size: 28px; display: block; margin-bottom: 10px; opacity: .4; }

/* ─── Badges ──────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 9px; border-radius: 20px;
    font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-success { background: var(--success-dim); color: var(--success); }
.badge-danger  { background: var(--danger-dim);  color: var(--danger); }
.badge-warning { background: var(--warning-dim); color: var(--warning); }
.badge-info    { background: var(--accent-dim);  color: var(--accent); }
.badge-muted   { background: var(--surface3);    color: var(--text2); }
.badge-purple  { background: rgba(168,85,247,.14); color: #a855f7; }

/* ─── Stars ───────────────────────────────────────────────────────────────── */
.stars { display: inline-flex; gap: 2px; }
.stars .fa-star { color: var(--warning); }
.stars .fa-star.empty { color: var(--border2); }

/* Star rating input (radio trick - reverse order via flex-direction) */
.star-rating { display: flex; flex-direction: row-reverse; gap: 4px; }
.star-rating input[type="radio"] { display: none; }
.star-rating label {
    cursor: pointer; font-size: 28px;
    color: var(--border2);
    transition: color .12s;
    font-family: "Font Awesome 6 Free"; font-weight: 900;
}
.star-rating label::before { content: "\f005"; }
.star-rating label:hover,
.star-rating label:hover ~ label,
.star-rating input:checked ~ label { color: var(--warning); }

/* ─── Progress bar ────────────────────────────────────────────────────────── */
.progress { height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s; }
.progress-bar.green  { background: var(--success); }
.progress-bar.yellow { background: var(--warning); }
.progress-bar.red    { background: var(--danger); }

/* ─── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.65); backdrop-filter: blur(4px);
    z-index: 1000; align-items: center; justify-content: center;
    padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 30px; width: 500px;
    max-width: 100%; max-height: 90vh; overflow-y: auto;
    animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity:0; transform:translateY(10px) scale(.98); } }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px;
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close {
    background: none; border: none; color: var(--muted);
    cursor: pointer; font-size: 20px; padding: 4px; line-height: 1;
    border-radius: 6px; transition: all .15s;
}
.modal-close:hover { background: var(--surface2); color: var(--text); }

/* ─── Utilities ───────────────────────────────────────────────────────────── */
.d-flex        { display: flex; }
.align-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-muted   { color: var(--text2); }
.text-accent  { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-sm      { font-size: 12px; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ─── Divider ─────────────────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ─── Limit bar ───────────────────────────────────────────────────────────── */
.limit-bar {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 20px;
}
.limit-bar-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8px;
}
.limit-bar-label { font-size: 12px; font-weight: 600; color: var(--text2); }
.limit-bar-value { font-size: 13px; font-weight: 700; }

/* ─── Upload zone ─────────────────────────────────────────────────────────── */
.upload-zone {
    display: block;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 24px 28px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s, box-shadow .2s;
    background: var(--surface2);
    position: relative;
}
.upload-zone:hover, .upload-zone.drag {
    border-color: var(--accent);
    background: var(--accent-dim);
    box-shadow: 0 0 0 4px rgba(91,127,255,.08);
}
.upload-zone.has-file {
    border-color: var(--success);
    background: var(--success-dim);
}
.upload-zone input[type="file"] { display: none; }

.upload-zone-icon {
    width: 64px; height: 64px;
    background: var(--accent-dim);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
    transition: transform .2s;
}
.upload-zone:hover .upload-zone-icon { transform: translateY(-2px); }
.upload-zone.has-file .upload-zone-icon { background: var(--success-dim); }
.upload-zone-icon i {
    font-size: 28px;
    color: var(--accent);
}
.upload-zone.has-file .upload-zone-icon i { color: var(--success); }

.upload-zone-title {
    font-size: 14px; font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}
.upload-zone-title strong { color: var(--accent); }
.upload-zone.has-file .upload-zone-title strong { color: var(--success); }

.upload-zone-sub {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 0;
}

.upload-filename {
    margin-top: 12px;
    font-size: 13px; font-weight: 600;
    color: var(--success);
    display: none;
}
.upload-filename.visible { display: block; }

.upload-zone-hint {
    margin-top: 14px;
    font-size: 11px;
    color: var(--muted);
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.upload-zone-hint code {
    background: var(--surface3);
    border: 1px solid var(--border2);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 11px;
    color: var(--text2);
    font-family: monospace;
}

/* ─── Topbar dentro de main (mobile) ─────────────────────────────────────── */
.topbar {
    display: none;
    align-items: center; justify-content: space-between;
    padding: 14px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    margin: -32px -36px 28px;
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    :root { --sidebar-w: 220px; }
    .main { padding: 24px; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform .25s; }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; padding: 16px; }
    .topbar { display: flex; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .grid-2, .form-row { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; }
}
