/* ================================================
   META DASHBOARD — STYLESHEET
   Dark industrial aesthetic · ENESE
   ================================================ */

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

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:        #0a0c10;
    --surface:   #111318;
    --surface2:  #181b22;
    --border:    #1e2230;
    --border2:   #262c3a;
    --accent:    #1877F2;
    --accent2:   #0d5fd4;
    --accent-gl: rgba(24,119,242,0.12);
    --text:      #e8eaf0;
    --text2:     #8892a4;
    --text3:     #555f72;
    --green:     #00c97a;
    --red:       #ff4d6a;
    --yellow:    #f5a623;
    --sidebar-w: 220px;
    --radius:    10px;
    --font-head: 'Syne', sans-serif;
    --font-body: 'DM Sans', sans-serif;
}

html, body { height: 100%; font-family: var(--font-body); background: var(--bg); color: var(--text); }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ══════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════ */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; overflow: hidden; }

.login-bg {
    position: fixed; inset: 0; z-index: 0;
}
.login-grid {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(24,119,242,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(24,119,242,0.04) 1px, transparent 1px);
    background-size: 40px 40px;
}
.login-glow {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(24,119,242,0.15) 0%, transparent 70%);
    pointer-events: none;
}

.login-container {
    position: relative; z-index: 1;
    display: flex; flex-direction: column; align-items: center; gap: 20px;
    padding: 24px;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: 16px;
    padding: 40px;
    width: 100%; max-width: 400px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.03);
    animation: cardIn 0.5s cubic-bezier(0.22,1,0.36,1) both;
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

.login-logo {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 28px;
    font-family: var(--font-head);
    font-size: 15px; color: var(--text2);
    letter-spacing: 0.02em;
}
.login-logo strong { color: var(--text); }
.logo-icon {
    width: 36px; height: 36px;
    background: var(--accent-gl);
    border: 1px solid rgba(24,119,242,0.3);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
}

.login-title {
    font-family: var(--font-head);
    font-size: 26px; font-weight: 800;
    color: var(--text); margin-bottom: 6px;
}
.login-subtitle { font-size: 14px; color: var(--text2); margin-bottom: 28px; }

.alert {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 16px; border-radius: var(--radius);
    font-size: 13px; margin-bottom: 20px;
}
.alert-error { background: rgba(255,77,106,0.1); border: 1px solid rgba(255,77,106,0.3); color: var(--red); }

.login-form { display: flex; flex-direction: column; gap: 18px; }

.form-group { display: flex; flex-direction: column; gap: 7px; }
.form-group label { font-size: 12px; font-weight: 500; color: var(--text2); letter-spacing: 0.05em; text-transform: uppercase; }

.form-group input,
.input-pass input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    padding: 12px 14px;
    font-family: var(--font-body);
    font-size: 14px; color: var(--text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus,
.input-pass input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-gl);
}

.input-pass { position: relative; }
.input-pass input { padding-right: 42px; }
.pass-toggle {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer;
    color: var(--text3); transition: color 0.2s;
}
.pass-toggle:hover { color: var(--text2); }

.btn-login {
    width: 100%; padding: 13px;
    background: var(--accent);
    color: #fff; border: none; border-radius: var(--radius);
    font-family: var(--font-head); font-size: 15px; font-weight: 700;
    cursor: pointer; letter-spacing: 0.02em;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 4px 20px rgba(24,119,242,0.35);
}
.btn-login:hover { background: var(--accent2); box-shadow: 0 6px 28px rgba(24,119,242,0.5); }
.btn-login:active { transform: scale(0.98); }

.login-footer { font-size: 12px; color: var(--text3); }

/* ══════════════════════════════════════
   DASHBOARD LAYOUT
══════════════════════════════════════ */
.dashboard-body { 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; bottom: 0;
    z-index: 100;
}

.sidebar-logo {
    display: flex; align-items: center; gap: 10px;
    padding: 20px 18px;
    font-family: var(--font-head);
    font-size: 14px; color: var(--text2);
    border-bottom: 1px solid var(--border);
}
.sidebar-logo strong { color: var(--text); }

.sidebar-nav { flex: 1; padding: 16px 10px; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 8px;
    font-size: 14px; color: var(--text2);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--accent-gl); color: var(--accent); border: 1px solid rgba(24,119,242,0.2); }

.sidebar-user {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 14px;
    border-top: 1px solid var(--border);
}
.user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--accent); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-head); font-size: 13px; font-weight: 700;
    flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { display: block; font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { display: block; font-size: 11px; color: var(--text3); }
.logout-btn {
    color: var(--text3); text-decoration: none;
    display: flex; align-items: center; padding: 6px;
    border-radius: 6px; transition: color 0.15s, background 0.15s;
}
.logout-btn:hover { color: var(--red); background: rgba(255,77,106,0.08); }

/* MAIN */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1; padding: 24px;
    display: flex; flex-direction: column; gap: 20px;
    min-width: 0;
}

/* TOPBAR */
.topbar { display: flex; align-items: flex-start; justify-content: space-between; }
.page-title { font-family: var(--font-head); font-size: 24px; font-weight: 800; color: var(--text); }
.page-subtitle { font-size: 13px; color: var(--text3); display: block; margin-top: 2px; }
.date-badge {
    display: flex; align-items: center; gap: 7px;
    background: var(--surface); border: 1px solid var(--border2);
    padding: 8px 14px; border-radius: var(--radius);
    font-size: 13px; color: var(--text2);
}

/* FILTERS */
.filters-bar {
    display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
}
.filter-group { display: flex; flex-direction: column; gap: 7px; }
.filter-label { font-size: 11px; font-weight: 500; color: var(--text3); letter-spacing: 0.06em; text-transform: uppercase; }

.select-wrapper { position: relative; }
.select-wrapper select {
    appearance: none;
    background: var(--bg); border: 1px solid var(--border2);
    border-radius: 8px; padding: 9px 34px 9px 12px;
    font-family: var(--font-body); font-size: 14px; color: var(--text);
    cursor: pointer; outline: none; min-width: 200px;
    transition: border-color 0.2s;
}
.select-wrapper select:focus { border-color: var(--accent); }
.select-arrow {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    pointer-events: none; color: var(--text3);
}

.date-input {
    background: var(--bg); border: 1px solid var(--border2);
    border-radius: 8px; padding: 9px 12px;
    font-family: var(--font-body); font-size: 14px; color: var(--text);
    outline: none; cursor: pointer;
    transition: border-color 0.2s;
    color-scheme: dark;
}
.date-input:focus { border-color: var(--accent); }

.btn-reset {
    display: flex; align-items: center; gap: 7px;
    background: transparent; border: 1px solid var(--border2);
    border-radius: 8px; padding: 9px 14px;
    font-family: var(--font-body); font-size: 13px; color: var(--text2);
    cursor: pointer; transition: all 0.15s;
}
.btn-reset:hover { border-color: var(--text3); color: var(--text); }

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

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    transition: border-color 0.2s, transform 0.2s;
}
.kpi-card:hover { border-color: var(--border2); transform: translateY(-2px); }
.kpi-card.skeleton { height: 96px; animation: pulse 1.5s ease-in-out infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.kpi-label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; }
.kpi-value { font-family: var(--font-head); font-size: 26px; font-weight: 800; color: var(--text); line-height: 1; margin-bottom: 6px; }
.kpi-sub { font-size: 11px; color: var(--text3); }
.kpi-dot {
    display: inline-block; width: 7px; height: 7px; border-radius: 50%;
    margin-right: 5px; background: var(--accent);
}
.kpi-dot.green { background: var(--green); }
.kpi-dot.yellow { background: var(--yellow); }

/* TABLE */
.table-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.table-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}
.table-title { font-family: var(--font-head); font-size: 16px; font-weight: 700; }
.table-actions { display: flex; align-items: center; gap: 12px; }
.record-count { font-size: 12px; color: var(--text3); }

.btn-export {
    display: flex; align-items: center; gap: 7px;
    background: transparent; border: 1px solid var(--border2);
    border-radius: 7px; padding: 7px 13px;
    font-family: var(--font-body); font-size: 12px; color: var(--text2);
    cursor: pointer; transition: all 0.15s;
}
.btn-export:hover { border-color: var(--accent); color: var(--accent); }

.table-wrapper { overflow-x: auto; }

.metrics-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.metrics-table th {
    background: var(--surface2);
    padding: 11px 14px;
    text-align: left;
    font-size: 11px; font-weight: 600;
    color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 1;
}
.metrics-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text2); white-space: nowrap;
    transition: background 0.1s;
}
.metrics-table td:first-child { color: var(--text); font-weight: 500; }
.metrics-table tr:last-child td { border-bottom: none; }
.metrics-table tr:hover td { background: var(--surface2); }

.empty-state { text-align: center; padding: 60px 20px !important; color: var(--text3) !important; }
.empty-icon { font-size: 36px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* FORM CARD */
.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
}
.form-card-title {
    font-family: var(--font-head);
    font-size: 16px; font-weight: 700;
    margin-bottom: 20px;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px; margin-bottom: 24px;
}
.form-hint { font-size: 11px; color: var(--text3); margin-top: 4px; display: block; }
.portfolio-form .form-group input {
    width: 100%;
    background: var(--bg); border: 1px solid var(--border2);
    border-radius: 8px; padding: 11px 14px;
    font-family: var(--font-body); font-size: 14px; color: var(--text);
    outline: none; transition: border-color 0.2s;
}
.portfolio-form .form-group input:focus { border-color: var(--accent); }
.btn-submit {
    display: flex; align-items: center; gap: 8px;
    background: var(--accent); color: #fff;
    border: none; border-radius: var(--radius);
    padding: 12px 24px;
    font-family: var(--font-head); font-size: 14px; font-weight: 700;
    cursor: pointer; transition: background 0.2s;
}
.btn-submit:hover { background: var(--accent2); }
.code-id {
    font-family: monospace; font-size: 12px;
    background: var(--bg); padding: 3px 7px;
    border-radius: 4px; color: var(--accent);
}
.badge {
    display: inline-block; padding: 3px 10px;
    border-radius: 20px; font-size: 11px; font-weight: 600;
}
.badge-green { background: rgba(0,201,122,0.12); color: var(--green); }
.badge-red   { background: rgba(255,77,106,0.12); color: var(--red); }
.btn-delete {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px; color: var(--red);
    text-decoration: none; padding: 4px 8px;
    border-radius: 6px; transition: background 0.15s;
}
.btn-delete:hover { background: rgba(255,77,106,0.1); }
@media (max-width: 768px) { .form-row { grid-template-columns: 1fr; } }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
    :root { --sidebar-w: 0px; }
    .sidebar { display: none; }
    .main-content { padding: 16px; margin-left: 0; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
}
