/* assets/css/style.css */
/* Material 3 Expressive Dark Theme Stylesheet for MoneyJournal */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    /* Color Palette - Dark Scheme (Material 3 Violet/Purple Core) */
    --bg-base: #0c0a0f;
    --bg-surface: #141218;
    --bg-surface-variant: #211f26;
    --bg-surface-tint: #2a2831;
    
    --color-primary: #d0bcff;
    --color-on-primary: #381e72;
    --color-primary-container: #4f378b;
    --color-on-primary-container: #eaddff;
    
    --color-secondary: #ccc2dc;
    --color-on-secondary: #332d41;
    --color-secondary-container: #4a4458;
    
    --color-tertiary: #efb8c8;
    --color-on-tertiary: #492532;
    
    --color-error: #ffb4ab;
    --color-error-container: #850004;
    --color-on-error-container: #ffdad6;
    
    --color-success: #a6f0c6;
    --color-success-container: #005331;
    --color-on-success-container: #c1ffd9;

    --color-info: #a8efff;
    --color-info-container: #004f58;

    --text-primary: #e6e1e5;
    --text-secondary: #cabfc9;
    --text-muted: #938f99;
    
    --border-outline: rgba(255, 255, 255, 0.08);
    --border-outline-focus: #d0bcff;

    /* Shadows & Elevations */
    --shadow-1: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 3px 6px rgba(0, 0, 0, 0.3), 0 3px 6px rgba(0, 0, 0, 0.4);
    --shadow-3: 0 10px 20px rgba(0, 0, 0, 0.4), 0 6px 6px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 2px 8px rgba(0, 0, 0, 0.15);

    /* Animation Transitions */
    --transition-standard: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0, 0, 0.2, 1);
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

a, button, select, input, textarea, [role="button"] {
    outline: none;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    overflow-x: hidden;
    min-height: 100vh;
}

h1, h2, h3, h4, .outfit-font {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--color-on-primary-container);
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
    background: var(--bg-surface-variant);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-container);
}

/* Layout Framework */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: 280px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-outline);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    transition: var(--transition-standard);
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px 32px 16px;
}

.brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-tertiary));
    color: var(--bg-base);
    font-size: 24px;
    font-weight: 800;
}

.brand-name {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(to right, #ffffff, var(--color-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    width: 100%;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    border-radius: 28px; /* M3 Expressive Pill shape */
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition-standard);
    cursor: pointer;
}

.nav-link:hover {
    background-color: var(--bg-surface-variant);
    color: var(--text-primary);
}

.nav-link.active {
    background-color: var(--color-primary-container);
    color: var(--color-on-primary-container);
    font-weight: 600;
}

.nav-link .material-symbols-rounded {
    font-size: 24px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-outline);
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 32px 48px 100px 48px;
    min-height: 100vh;
    transition: var(--transition-standard);
}

/* Mobile Top/Bottom Navigation */
.mobile-nav {
    display: none;
}

/* Page Header & View Filters */
.header-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    gap: 20px;
    flex-wrap: wrap;
}

.page-title-group {
    display: flex;
    flex-direction: column;
}

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

.header-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    background-color: var(--bg-surface);
    padding: 6px 8px;
    border-radius: 32px;
    border: 1px solid var(--border-outline);
}

.month-picker {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon-m3 {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-icon-m3:hover {
    background-color: var(--bg-surface-variant);
}

.month-display {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 16px;
    padding: 0 8px;
    min-width: 100px;
    text-align: center;
    text-transform: capitalize;
}

.view-selector {
    display: flex;
    background-color: var(--bg-surface-variant);
    padding: 4px;
    border-radius: 24px;
}

.view-option {
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-standard);
}

.view-option.active {
    background-color: var(--color-primary);
    color: var(--bg-base);
    box-shadow: var(--shadow-1);
}

/* Cards & Grid Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px;
    margin-bottom: 24px;
}

.card-m3 {
    background-color: var(--bg-surface);
    border-radius: 28px; /* M3 Card style */
    border: 1px solid var(--border-outline);
    padding: 24px;
    box-shadow: var(--shadow-1);
    transition: var(--transition-standard);
    position: relative;
    overflow: hidden;
}

.card-m3:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

/* Custom glowing borders for summary cards */
.card-summary-net {
    background: linear-gradient(135deg, var(--bg-surface), #181423);
    border-color: rgba(208, 188, 255, 0.15);
    box-shadow: var(--shadow-glow);
}

.card-summary-net::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--color-primary), var(--color-tertiary));
}

.card-summary-income {
    border-left: 4px solid var(--color-success);
}

.card-summary-expense {
    border-left: 4px solid var(--color-error);
}

.card-title {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-value {
    font-family: 'Outfit', sans-serif;
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
    line-height: 1.1;
}

.card-value.income-text {
    color: var(--color-success);
}
.card-value.expense-text {
    color: var(--color-error);
}

.card-desc {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Colspan utilities */
.col-12 { grid-column: span 12; }
.col-8 { grid-column: span 8; }
.col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; }
.col-3 { grid-column: span 3; }

/* FAB (Floating Action Button) */
.fab-m3 {
    position: fixed;
    bottom: 32px;
    right: 48px;
    width: 64px;
    height: 64px;
    border-radius: 20px; /* Expressive rounded-square M3 shape */
    background: linear-gradient(135deg, var(--color-primary), var(--color-tertiary));
    color: var(--bg-base);
    border: none;
    box-shadow: var(--shadow-3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 90;
    transition: var(--transition-standard);
}

.fab-m3:hover {
    border-radius: 24px;
}

.fab-m3 .material-symbols-rounded {
    font-size: 32px;
}

/* Categories List & Add styling */
.category-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
    background-color: var(--bg-surface-variant);
}

.category-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

/* Budget Progress Bars */
.budget-item {
    margin-bottom: 20px;
}

.budget-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 14px;
}

.budget-progress-track {
    height: 12px;
    background-color: var(--bg-surface-variant);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.budget-progress-bar {
    height: 100%;
    border-radius: 6px;
    transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.budget-limit-warning {
    color: var(--color-error);
    font-size: 12px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Modals & Bottom Sheets */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s var(--transition-standard);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-outline);
    border-radius: 32px;
    width: 500px;
    max-width: 90vw;
    padding: 32px;
    box-shadow: var(--shadow-3);
    transform: translateY(30px) scale(0.95);
    transition: transform 0.3s var(--transition-standard);
}

.modal-overlay.active .modal-content {
    transform: translateY(0) scale(1);
}

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

.modal-title {
    font-size: 20px;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    background-color: var(--bg-surface-variant);
    border: 1px solid var(--border-outline);
    border-radius: 16px;
    padding: 14px 16px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    transition: var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(208, 188, 255, 0.2);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Multi-month slider toggle style */
.amortize-toggle-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: rgba(208, 188, 255, 0.05);
    border: 1px dashed rgba(208, 188, 255, 0.2);
    padding: 16px;
    border-radius: 16px;
    margin-bottom: 20px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 32px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-knob {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-surface-tint);
    transition: .3s;
    border-radius: 32px;
    border: 1px solid var(--border-outline);
}

.slider-knob:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-muted);
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider-knob {
    background-color: var(--color-primary-container);
}

input:checked + .slider-knob:before {
    transform: translateX(20px);
    background-color: var(--color-primary);
}

/* Action Buttons */
.btn-group {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 28px;
}

.btn-m3 {
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition-standard);
}

.btn-m3-text {
    background: transparent;
    color: var(--color-primary);
}
.btn-m3-text:hover {
    background-color: rgba(208, 188, 255, 0.08);
}

.btn-m3-filled {
    background-color: var(--color-primary);
    color: var(--bg-base);
    box-shadow: var(--shadow-1);
}
.btn-m3-filled:hover {
    box-shadow: var(--shadow-2);
    transform: translateY(-1px);
    background-color: #d8c7ff;
}

.btn-m3-tonal {
    background-color: var(--bg-surface-variant);
    color: var(--text-primary);
    border: 1px solid var(--border-outline);
}
.btn-m3-tonal:hover {
    background-color: var(--bg-surface-tint);
}

/* Tables and logs */
.table-wrapper {
    overflow-x: auto;
}

.table-m3 {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table-m3 th {
    padding: 16px;
    font-size: 13px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-outline);
    font-weight: 600;
    text-transform: uppercase;
}

.table-m3 td {
    padding: 16px;
    border-bottom: 1px solid var(--border-outline);
    font-size: 14px;
    color: var(--text-primary);
    vertical-align: middle;
}

.table-m3 tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Category grid selections */
.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
}

.color-option {
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: var(--transition-fast);
}

.color-option.selected {
    border-color: var(--text-primary);
    transform: scale(1.1);
}

.icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    max-height: 120px;
    overflow-y: auto;
    padding: 4px;
}

.icon-option {
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-surface-variant);
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition-fast);
}

.icon-option:hover {
    background-color: var(--bg-surface-tint);
}

.icon-option.selected {
    border-color: var(--color-primary);
    background-color: var(--color-primary-container);
    color: var(--color-on-primary-container);
}

/* Responsive Breakpoints */
@media (max-width: 992px) {
    .sidebar {
        width: 80px;
        padding: 24px 8px;
    }
    
    .sidebar .brand-name,
    .sidebar .sidebar-footer,
    .sidebar .nav-link span:not(.material-symbols-rounded) {
        display: none;
    }
    
    .sidebar .brand-section {
        justify-content: center;
        padding-bottom: 24px;
    }
    
    .sidebar .nav-link {
        justify-content: center;
        padding: 14px;
    }
    
    .main-content {
        margin-left: 80px;
        padding: 24px;
    }
    
    .col-8, .col-6, .col-4, .col-3 {
        grid-column: span 12;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
        padding: 16px 16px 100px 16px;
    }
    
    .fab-m3 {
        bottom: 96px;
        right: 24px;
        width: 56px;
        height: 56px;
    }
    
    .mobile-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 72px;
        background-color: var(--bg-surface);
        border-top: 1px solid var(--border-outline);
        backdrop-filter: blur(12px);
        z-index: 99;
        padding: 8px 0;
    }
    
    .mobile-nav-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        color: var(--text-muted);
        font-size: 11px;
        font-weight: 500;
        text-align: center;
        flex: 1;
        cursor: pointer;
    }
    
    .mobile-nav-link .material-symbols-rounded {
        font-size: 24px;
        padding: 4px 16px;
        border-radius: 16px;
        margin-bottom: 4px;
        transition: var(--transition-standard);
    }
    
    .mobile-nav-link.active {
        color: var(--color-primary);
        font-weight: 600;
    }
    
    .mobile-nav-link.active .material-symbols-rounded {
        background-color: var(--color-primary-container);
        color: var(--color-on-primary-container);
    }
    
    .header-wrapper {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-controls {
        width: 100%;
        justify-content: space-between;
    }
}

/* Micro-animations and states */
.anim-fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.text-success { color: var(--color-success) !important; }
.text-danger { color: var(--color-error) !important; }
.text-info { color: var(--color-info) !important; }
.text-muted { color: var(--text-muted) !important; }

/* Empty State Styling */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 64px !important;
    margin-bottom: 16px;
    color: var(--bg-surface-tint);
}
