/* FinanzApp — Design System */
/* Aesthetic: Refined dark financial dashboard, editorial typography */

:root {
    --bg-base:      #0a0b0f;
    --bg-card:      #111318;
    --bg-elevated:  #181b22;
    --bg-hover:     #1e2229;
    --border:       #23272f;
    --border-light: #2d323c;

    --text-primary:   #f0f2f7;
    --text-secondary: #8a92a6;
    --text-muted:     #4a5163;

    --accent:       #c8f135;   /* Lime electric — eje visual */
    --accent-dim:   #8aab1f;
    --accent-bg:    rgba(200,241,53,0.08);

    --green:  #22c55e;
    --red:    #f43f5e;
    --blue:   #3b82f6;
    --purple: #8b5cf6;
    --orange: #f97316;
    --yellow: #f59e0b;

    --green-bg:  rgba(34,197,94,0.1);
    --red-bg:    rgba(244,63,94,0.1);
    --blue-bg:   rgba(59,130,246,0.1);
    --purple-bg: rgba(139,92,246,0.1);

    --sidebar-w: 240px;
    --radius:    12px;
    --radius-sm: 8px;
    --radius-lg: 16px;

    --font-display: 'Syne', sans-serif;
    --font-body:    'DM Sans', sans-serif;

    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
}

/* ─── Reset ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    font-family: var(--font-body);
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
img { max-width: 100%; }

/* ─── App Shell ──────────────────────────────────── */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    padding: 24px 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 24px 28px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}
.brand-icon {
    width: 36px; height: 36px;
    background: var(--accent);
    color: #000;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 900;
    font-family: var(--font-display);
}
.brand-name {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 18px;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s ease;
    cursor: pointer;
}
.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.nav-item.active {
    background: var(--accent-bg);
    color: var(--accent);
    font-weight: 600;
}
.nav-icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
    opacity: 0.9;
}

.sidebar-footer {
    padding: 16px 16px 0;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}
.user-chip {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
}
.user-avatar {
    width: 30px; height: 30px;
    background: var(--accent);
    color: #000;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    font-weight: 800;
    font-family: var(--font-display);
    flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-currency { font-size: 11px; color: var(--text-muted); }
.logout-btn {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 16px;
    transition: all 0.15s;
    flex-shrink: 0;
}
.logout-btn:hover { background: var(--red-bg); color: var(--red); }

/* ─── Main Content ───────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-height: 100vh;
}
.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 36px 32px;
}

/* ─── Page Header ────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 32px;
    gap: 16px;
}
.page-title {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}
.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ─── Cards ──────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.card-title {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

/* ─── Stat Cards ─────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--accent-color, var(--accent));
}
.stat-card:hover { border-color: var(--border-light); }
.stat-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.stat-value {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 6px;
}
.stat-value.positive { color: var(--green); }
.stat-value.negative { color: var(--red); }
.stat-change {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}
.stat-icon {
    position: absolute;
    right: 20px; top: 50%;
    transform: translateY(-50%);
    font-size: 36px;
    opacity: 0.07;
}

/* ─── Grid Layouts ───────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* ─── Tables ─────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
td {
    padding: 14px 16px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }

/* ─── Badges ─────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.badge-green  { background: var(--green-bg); color: var(--green); }
.badge-red    { background: var(--red-bg);   color: var(--red);   }
.badge-blue   { background: var(--blue-bg);  color: var(--blue);  }
.badge-purple { background: var(--purple-bg);color: var(--purple);}
.badge-accent { background: var(--accent-bg);color: var(--accent);}

/* ─── Buttons ────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
    white-space: nowrap;
    font-family: var(--font-body);
}
.btn-primary {
    background: var(--accent);
    color: #000;
}
.btn-primary:hover { background: #d4ff3a; transform: translateY(-1px); }
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--border-light); color: var(--text-primary); background: var(--bg-hover); }
.btn-danger {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid transparent;
}
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ─── Forms ──────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 7px;
}
.form-control {
    width: 100%;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 10px 14px;
    font-size: 14px;
    font-family: var(--font-body);
    transition: border-color 0.15s;
    outline: none;
}
.form-control:focus { border-color: var(--accent); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control option { background: var(--bg-elevated); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 8px; }

/* ─── Modal ──────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 200;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s;
    backdrop-filter: blur(4px);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.2s;
    box-shadow: var(--shadow);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px;
}
.modal-title {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.3px;
}
.modal-close {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border: none; background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer; font-size: 18px;
    transition: all 0.15s;
}
.modal-close:hover { background: var(--red-bg); color: var(--red); }

/* ─── Progress Bar ───────────────────────────────── */
.progress-bar {
    height: 8px;
    background: var(--bg-elevated);
    border-radius: 999px;
    overflow: hidden;
    margin: 8px 0;
}
.progress-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--accent);
    transition: width 0.5s ease;
}
.progress-fill.warning { background: var(--orange); }
.progress-fill.danger  { background: var(--red); }
.progress-fill.success { background: var(--green); }

/* ─── Empty State ────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.empty-text { font-size: 14px; }

/* ─── Alert ──────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.alert-error   { background: var(--red-bg); color: var(--red); border: 1px solid rgba(244,63,94,0.2); }
.alert-success { background: var(--green-bg); color: var(--green); border: 1px solid rgba(34,197,94,0.2); }

/* ─── Amount Colors ──────────────────────────────── */
.amount-positive { color: var(--green); font-weight: 700; }
.amount-negative { color: var(--red);   font-weight: 700; }

/* ─── Category Pill ──────────────────────────────── */
.cat-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* ─── Auth Pages ─────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-base);
    padding: 20px;
}
.auth-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
}
.auth-logo {
    display: flex; align-items: center; gap: 12px;
    justify-content: center;
    margin-bottom: 32px;
}
.auth-logo-icon {
    width: 48px; height: 48px;
    background: var(--accent);
    color: #000;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; font-weight: 900;
    font-family: var(--font-display);
}
.auth-logo-name {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -1px;
}
.auth-title {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}
.auth-subtitle {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 28px;
}
.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-secondary);
}
.auth-footer a { color: var(--accent); font-weight: 600; }
.auth-footer a:hover { text-decoration: underline; }

/* ─── Tab Switcher ───────────────────────────────── */
.tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 24px;
    width: fit-content;
}
.tab-btn {
    padding: 8px 20px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-body);
}
.tab-btn.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* ─── Filters bar ────────────────────────────────── */
.filters-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.filters-bar .form-control {
    width: auto;
    min-width: 140px;
}

/* ─── Scrollbar ──────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Responsive ─────────────────────────────────── */
@media (max-width: 900px) {
    :root { --sidebar-w: 64px; }
    .brand-name, .nav-item span:not(.nav-icon), .user-info, .logout-btn { display: none; }
    .sidebar-brand { justify-content: center; padding: 0 0 20px; }
    .sidebar-footer { justify-content: center; padding: 12px 0 0; }
    .user-chip { padding: 6px; gap: 0; background: transparent; }
    .nav-item { justify-content: center; padding: 12px; }
    .nav-icon { font-size: 18px; }
    .content-wrapper { padding: 24px 20px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .page-header { flex-direction: column; }
}
