/* ============================================================
   BakiKu — Personal Finance Tracker
   Design: Minimalist Fintech, White + Red
   ============================================================ */

:root {
    --primary:        #E63946;
    --primary-dark:   #C1121F;
    --primary-light:  rgba(230, 57, 70, 0.08);
    --sidebar-bg:     #12121E;
    --sidebar-text:   rgba(255, 255, 255, 0.65);
    --sidebar-active-bg: rgba(230, 57, 70, 0.15);
    --sidebar-active: #E63946;
    --sidebar-width:  255px;
    --content-bg:     #F5F6FA;
    --card-bg:        #FFFFFF;
    --text-primary:   #111827;
    --text-secondary: #6B7280;
    --border:         #E5E7EB;
    --income:         #10B981;
    --commitment:     #3B82F6;
    --expense:        #F59E0B;
    --savings:        #059669;
    --hangus:         #E63946;
    --efficiency:     #06B6D4;
    --balance:        #8B5CF6;
    --radius:         12px;
    --radius-sm:      8px;
    --shadow:         0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.06);
    --shadow-sm:      0 1px 3px rgba(0,0,0,0.08);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--content-bg);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
}

/* ============================================================
   AUTH PAGES
   ============================================================ */

.auth-body {
    background: linear-gradient(135deg, #12121E 0%, #1C1C2E 60%, #E63946 200%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-wrapper {
    width: 100%;
    max-width: 420px;
    padding: 24px;
}

.auth-card {
    background: #fff;
    border-radius: 20px;
    padding: 40px 36px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.auth-brand {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo {
    width: 180px;
    height: auto;
    margin: 0 auto;
    display: block;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--text-secondary);
    font-size: 13px;
}

.auth-footer a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.auth-card .form-control {
    border-radius: var(--radius-sm);
    border-color: var(--border);
    font-size: 14px;
    padding: 10px 14px;
}

.auth-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230,57,70,0.12);
}

/* ============================================================
   APP LAYOUT
   ============================================================ */

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 8px;
    text-align: center;
}

.sidebar-logo {
    width: 130px;
    height: auto;
    display: block;
    margin: 0 auto;
    background: #fff;
    border-radius: 10px;
    padding: 8px 14px;
}

.brand-tagline {
    font-size: 10px;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 500;
}

/* Sidebar Nav */
.sidebar-nav {
    list-style: none;
    padding: 8px 12px;
    flex: 1;
}

.nav-item { margin-bottom: 2px; }

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active);
    font-weight: 600;
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.06);
    margin: 8px 0;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
    text-transform: uppercase;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
}

.logout-btn {
    background: none;
    border: none;
    padding: 0;
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    font-weight: 500;
    transition: color 0.15s;
}

.logout-btn:hover { color: var(--primary); }

/* ---- Main Content ---- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    overflow-x: hidden;
}

.page-content {
    padding: 32px 28px 48px;
}

/* ============================================================
   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-primary);
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
}

.month-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.month-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 110px;
    text-align: center;
}

/* ============================================================
   METRIC CARDS
   ============================================================ */

.metric-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 22px 20px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0,0,0,0.04);
    height: 100%;
    position: relative;
}

.metric-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 14px;
}

.metric-icon.income     { background: rgba(16,185,129,0.12); color: var(--income); }
.metric-icon.commitment { background: rgba(59,130,246,0.12); color: var(--commitment); }
.metric-icon.expense    { background: rgba(245,158,11,0.12); color: var(--expense); }
.metric-icon.balance    { background: rgba(139,92,246,0.12); color: var(--balance); }
.metric-icon.savings    { background: rgba(5,150,105,0.12); color: var(--savings); }
.metric-icon.hangus     { background: rgba(230,57,70,0.12); color: var(--hangus); }
.metric-icon.efficiency { background: rgba(6,182,212,0.12); color: var(--efficiency); }

.metric-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.metric-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.metric-formula {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 6px;
}

.metric-action {
    display: inline-block;
    margin-top: 10px;
    font-size: 12px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.metric-action:hover { text-decoration: underline; }

/* Hangus card highlight */
.hangus-card {
    border-color: rgba(230,57,70,0.2);
    background: linear-gradient(135deg, #fff 0%, rgba(230,57,70,0.03) 100%);
}

/* Efficiency bar */
.efficiency-bar {
    background: var(--border);
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
}

.efficiency-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--efficiency), #3B82F6);
    border-radius: 4px;
    transition: width 0.6s ease;
}

/* Semantic colors */
.income-text     { color: var(--income) !important; }
.commitment-text { color: var(--commitment) !important; }
.expense-text    { color: var(--expense) !important; }
.savings-text    { color: var(--savings) !important; }
.hangus-text     { color: var(--hangus) !important; }
.efficiency-text { color: var(--efficiency) !important; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* ============================================================
   SECTIONS & CARDS
   ============================================================ */

.card-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0,0,0,0.04);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.summary-bar {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.summary-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.summary-value {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

/* ============================================================
   UPCOMING BILLS
   ============================================================ */

.bill-list { display: flex; flex-direction: column; gap: 8px; }

.bill-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--content-bg);
    border: 1px solid var(--border);
}

.bill-item.overdue {
    background: rgba(230,57,70,0.04);
    border-color: rgba(230,57,70,0.2);
}

.bill-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.bill-due  { font-size: 11px; color: var(--text-secondary); margin-top: 1px; }
.bill-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.bill-amount { font-size: 13px; font-weight: 700; color: var(--text-primary); }

.bill-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.overdue-badge  { background: rgba(230,57,70,0.12); color: var(--hangus); }
.today-badge    { background: rgba(245,158,11,0.12); color: var(--expense); }
.upcoming-badge { background: rgba(59,130,246,0.1);  color: var(--commitment); }

/* ============================================================
   PAYDAY SIMULATOR
   ============================================================ */

.payday-info { text-align: center; }

.payday-count {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: var(--primary-light);
    border-radius: var(--radius);
    padding: 20px 32px;
    border: 1px solid rgba(230,57,70,0.15);
}

.payday-number {
    font-size: 52px;
    font-weight: 900;
    color: var(--primary);
    line-height: 1;
    letter-spacing: -2px;
}

.payday-label {
    font-size: 11px;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.payday-detail { text-align: left; }

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.detail-row:last-child { border-bottom: none; }
.detail-label { font-size: 13px; color: var(--text-secondary); }
.detail-value { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.detail-value.highlight { color: var(--primary); font-size: 16px; }

/* ============================================================
   QUICK ACTIONS
   ============================================================ */

.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
    border: 1px solid;
}

.quick-action-btn.income     { background: rgba(16,185,129,0.08); color: var(--income);     border-color: rgba(16,185,129,0.2); }
.quick-action-btn.expense    { background: rgba(245,158,11,0.08); color: var(--expense);    border-color: rgba(245,158,11,0.2); }
.quick-action-btn.savings    { background: rgba(5,150,105,0.08);  color: var(--savings);    border-color: rgba(5,150,105,0.2); }
.quick-action-btn.reflection { background: rgba(139,92,246,0.08); color: var(--balance);    border-color: rgba(139,92,246,0.2); }

.quick-action-btn:hover { opacity: 0.8; transform: translateY(-1px); }

/* ============================================================
   TABLE
   ============================================================ */

.data-table {
    width: 100%;
    margin: 0;
    font-size: 13px;
}

.data-table thead th {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    padding: 10px 12px;
    background: transparent;
    white-space: nowrap;
}

.data-table tbody td {
    padding: 12px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    vertical-align: middle;
    color: var(--text-primary);
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover td {
    background: rgba(0,0,0,0.015);
}

.row-inactive { opacity: 0.45; }

.text-truncate-cell {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Trend table */
.trend-table { font-size: 12px; }
.trend-table tbody td { padding: 10px 12px; }

/* ============================================================
   CATEGORY CHIPS
   ============================================================ */

.category-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.category-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--content-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12px;
}

.chip-name { color: var(--text-secondary); font-weight: 500; }
.chip-value { color: var(--text-primary); font-weight: 700; }

/* ============================================================
   BADGES
   ============================================================ */

.badge-category {
    display: inline-block;
    background: rgba(59,130,246,0.1);
    color: var(--commitment);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.badge-hangus {
    display: inline-block;
    background: rgba(230,57,70,0.1);
    color: var(--hangus);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

/* ============================================================
   ACTION BUTTONS
   ============================================================ */

.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.15s ease;
    background: none;
    margin: 0 2px;
}

.btn-action.edit   { color: var(--commitment); background: rgba(59,130,246,0.08); }
.btn-action.delete { color: var(--hangus);     background: rgba(230,57,70,0.08); }

.btn-action.edit:hover   { background: rgba(59,130,246,0.18); }
.btn-action.delete:hover { background: rgba(230,57,70,0.18); }

/* Status Toggle */
.status-toggle {
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: rgba(0,0,0,0.03);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.status-toggle.active {
    background: rgba(16,185,129,0.1);
    border-color: rgba(16,185,129,0.3);
    color: var(--income);
}

/* ============================================================
   FORMS
   ============================================================ */

.form-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0,0,0,0.04);
    max-width: 760px;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.required { color: var(--primary); }

.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--border);
    font-size: 14px;
    padding: 9px 13px;
    color: var(--text-primary);
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230,57,70,0.1);
    outline: none;
}

.info-box {
    background: rgba(59,130,246,0.06);
    border: 1px solid rgba(59,130,246,0.2);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 13px;
    color: #1e40af;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    border-radius: var(--radius-sm);
    padding: 8px 18px;
    transition: all 0.15s ease;
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
}

.btn-primary.btn-lg { padding: 12px 20px; font-size: 15px; border-radius: var(--radius); }

.btn-outline-secondary {
    border-color: var(--border);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
    border-radius: var(--radius-sm);
    padding: 8px 18px;
    background: #fff;
}

.btn-outline-secondary:hover {
    background: var(--content-bg);
    border-color: #9CA3AF;
    color: var(--text-primary);
}

.btn-outline-primary {
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
    font-size: 13px;
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: #fff;
}

.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ============================================================
   SETTINGS
   ============================================================ */

.profile-info-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.profile-info-row:last-child { border-bottom: none; }
.profile-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.profile-value { font-size: 13px; font-weight: 700; color: var(--text-primary); }

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

/* ============================================================
   ALERTS
   ============================================================ */

.alert {
    border-radius: var(--radius-sm);
    border: none;
    font-size: 13px;
    font-weight: 500;
}

.alert-success {
    background: rgba(16,185,129,0.1);
    color: #065f46;
    border-left: 3px solid var(--income);
}

.alert-danger {
    background: rgba(230,57,70,0.08);
    color: #991b1b;
    border-left: 3px solid var(--primary);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 640px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .page-content { padding: 20px 16px 40px; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .metric-value { font-size: 18px; }
    .quick-actions { grid-template-columns: 1fr; }
}

@media (min-width: 641px) and (max-width: 900px) {
    :root { --sidebar-width: 200px; }
    .brand-name { font-size: 14px; }
    .sidebar-nav .nav-link { font-size: 12px; padding: 8px 10px; }
}
