/* Expense Manager - Custom styles */

:root {
    --sidebar-width: 260px;
    --header-height: 56px;
    --sidebar-bg: #212529;
    --sidebar-text: rgba(255, 255, 255, 0.85);
    --sidebar-hover: rgba(255, 255, 255, 0.1);
    --sidebar-active: #0d6efd;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    background-color: #f8f9fa;
    font-family: system-ui, -apple-system, sans-serif;
}

/* Header */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    z-index: 1030;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.app-header .sidebar-toggle {
    color: #212529;
    text-decoration: none;
    padding: 0.5rem;
    margin-right: 0.5rem;
}

.app-header .sidebar-toggle:hover {
    color: #0d6efd;
}

.app-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: #212529;
}

/* Sidebar */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1040;
    transition: transform 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
}

.app-sidebar .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding-top: calc(var(--header-height) + 1rem);
    padding-bottom: 1rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    gap: 0.25rem;
}

.sidebar-nav .sidebar-link.mt-auto {
    margin-top: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 0.375rem;
    transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-link.active {
    background: var(--sidebar-active);
    color: #fff;
}

.sidebar-link i {
    font-size: 1.25rem;
    width: 1.5rem;
    text-align: center;
}

/* Main content */
.app-main {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
    padding: 1.5rem;
}

/* Responsive: mobile */
@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

    .app-sidebar.open {
        transform: translateX(0);
    }

    .app-sidebar.open .sidebar-overlay {
        display: block;
    }

    .app-main {
        margin-left: 0;
        padding: 1rem;
    }
}

/* Sidebar toggle shown on all breakpoints (mini sidebar on desktop) */

/* Cards */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.card.income-card .card-header {
    background-color: #198754;
    color: white;
    font-weight: 600;
}

.card.expense-card .card-header {
    background-color: #dc3545;
    color: white;
    font-weight: 600;
}

.card-body .display-6 {
    font-weight: 700;
}

.form-control:focus,
.form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.btn-edit {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.btn-delete {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.table-responsive {
    background: white;
    border-radius: 0.25rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

#expense-form .card,
#income-form .card {
    max-width: 500px;
}

.spinner-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner-overlay.active {
    display: flex;
}

/* Home page (post-login landing - no sidebar) - Glass morphism */
body.home-page {
    padding-top: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 25%, #3d7ab5 50%, #5a9fd4 75%, #7ec8e3 100%);
    background-attachment: fixed;
    position: relative;
    overflow-x: hidden;
}

body.home-page::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(120, 200, 255, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 20%, rgba(255, 255, 255, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.glass-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.home-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.glass-btn-menu {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 10px;
    color: #fff;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    margin-left: 15px;
}

.glass-btn-menu:hover {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
}

.home-main {
    max-width: 420px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    position: relative;
    z-index: 1;
}

.home-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.glass-card {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

/* Total Expense - small compact box */
.expense-total-card {
    padding: 1rem 1.25rem;
    display: inline-flex;
    flex-direction: column;
    gap: 0.25rem;
}

.expense-total-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.85);
}

.expense-total-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Add Expense form - stacked inputs */
.add-expense-card {
    padding: 1.5rem;
}

.add-expense-title {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 1.25rem;
}

.add-expense-card .form-group {
    margin-bottom: 1rem;
}

.add-expense-card .form-group:last-of-type {
    margin-bottom: 1.25rem;
}

.add-expense-card .form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.375rem;
}

.glass-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    color: #fff;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
}

.glass-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.glass-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.glass-input[type="date"] {
    cursor: pointer;
}

.glass-input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.7;
}

.glass-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 10px;
    color: #fff;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.glass-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Auth pages (login, signup) - Glassmorphism */
body.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 25%, #3d7ab5 50%, #5a9fd4 75%, #7ec8e3 100%);
    background-attachment: fixed;
    position: relative;
    overflow-x: hidden;
}

.auth-page-bg {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(120, 200, 255, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 20%, rgba(255, 255, 255, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 1.5rem;
    position: relative;
    z-index: 1;
}

.auth-card {
    padding: 2rem;
    width: 100%;
}

.auth-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 1.5rem 0;
}

.auth-title i {
    font-size: 1.5rem;
}

.auth-alert {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.auth-alert-success {
    background: rgba(5, 150, 105, 0.25);
    border: 1px solid rgba(5, 150, 105, 0.4);
    color: #a7f3d0;
}

.auth-alert-error {
    background: rgba(220, 38, 38, 0.25);
    border: 1px solid rgba(220, 38, 38, 0.4);
    color: #fecaca;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.auth-form-group {
    margin-bottom: 1rem;
}

.auth-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.375rem;
}

.auth-form .glass-input {
    width: 100%;
}

.auth-hint {
    display: block;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 0.25rem;
}

.auth-btn {
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

.auth-footer {
    text-align: center;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
}

.auth-footer a {
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}