/* ========== CSS Variables & Theme ========== */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: rgba(79, 70, 229, 0.1);
    --secondary: #0ea5e9;
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.1);
    --dark: #1e1b4b;
    --body-bg: #f0f2f8;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.25s ease;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--body-bg);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    font-size: 15px;
}

/* ========== Login Page ========== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e1b4b 0%, #4f46e5 50%, #0ea5e9 100%);
    padding: 20px;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px 32px;
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.5s ease;
}

.login-card .logo-area {
    text-align: center;
    margin-bottom: 32px;
}

.login-card .logo-area .logo-icon {
    /* width: 64px; height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--secondary)); */
    border-radius: 16px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 28px; color: #fff;
    margin-bottom: 12px;
    /* box-shadow: 0 4px 15px rgba(79,70,229,0.3); */
}

.login-card .logo-area h2 {
    font-size: 22px; font-weight: 700; color: var(--dark); margin: 0 0 4px;
}

.login-card .logo-area p {
    color: var(--text-muted); font-size: 14px; margin: 0;
}

/* ========== Form Styles ========== */
.form-floating { margin-bottom: 16px; }

.form-control, .form-select {
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 15px;
    transition: var(--transition);
    background: #fff;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 24px;
    font-weight: 600;
    font-size: 15px;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(79,70,229,0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(79,70,229,0.4);
    background: linear-gradient(135deg, var(--primary-hover), #3730a3);
}

/* ========== Top Navbar ========== */
.top-navbar {
    background: linear-gradient(135deg, var(--dark), var(--primary));
    color: #fff;
    padding: 6px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed; top: 0; left: 0; right: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.top-navbar .brand {
    font-weight: 700; font-size: 17px;
    display: flex; align-items: center; gap: 8px;
    background: #fff;
    border-radius: 25px;
    padding: 2px 5px;
}

.top-navbar .brand i { font-size: 20px; }

.top-navbar .btn-logout {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
}

.top-navbar .btn-logout:hover {
    background: rgba(255,255,255,0.25);
}

/* ========== Bottom Tab Bar ========== */
.bottom-tabs {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--card-bg);
    display: flex;
    border-top: 1px solid var(--border-color);
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.bottom-tabs .tab-btn {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 8px 4px 10px;
    font-size: 11px; font-weight: 600;
    color: var(--text-muted);
    border: none; background: none;
    transition: var(--transition);
    gap: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
}

.bottom-tabs .tab-btn i { font-size: 20px; }

.bottom-tabs .tab-btn.active {
    color: var(--primary);
}

.bottom-tabs .tab-btn.active::before {
    content: '';
    position: absolute; top: 0; left: 25%; right: 25%;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 3px 3px;
}

/* ========== Main Content ========== */
.main-content {
    padding: 68px 12px 70px;
    max-width: 800px;
    margin: 0 auto;
}

.tab-panel { display: none; animation: fadeIn 0.3s ease; }
.tab-panel.active { display: block; }

/* ========== Section Headers ========== */
.section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

.section-header h5 {
    font-weight: 700; font-size: 18px; margin: 0;
    color: var(--dark);
}

/* ========== Card Styles ========== */
.item-card, .bill-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.item-card:hover, .bill-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.item-card.inactive {
    opacity: 0.55;
    background: #f8fafc;
}

.card-top {
    display: flex; justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
}

.card-top h6 {
    font-weight: 700; font-size: 15px;
    margin: 0; color: var(--text-primary);
}

.card-meta {
    display: flex; flex-wrap: wrap; gap: 10px;
    font-size: 12.5px; color: var(--text-secondary);
}

.card-meta span {
    display: inline-flex; align-items: center; gap: 4px;
}

.card-actions {
    display: flex; gap: 6px;
    margin-top: 8px;
}

.card-actions .btn {
    padding: 5px 10px;
    font-size: 12.5px;
    border-radius: 6px;
    display: inline-flex; align-items: center; gap: 4px;
}

/* ========== Badge ========== */
.badge-active {
    background: var(--success-light); color: var(--success);
    padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600;
}

.badge-inactive {
    background: var(--danger-light); color: var(--danger);
    padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600;
}

.badge-amount {
    background: var(--primary-light); color: var(--primary);
    padding: 3px 10px; border-radius: 20px;
    font-size: 13px; font-weight: 700;
}

/* ========== Search & Filter Bar ========== */
.filter-bar {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.filter-bar .input-group .form-control {
    font-size: 14px;
}

.filter-row {
    display: flex; gap: 8px; flex-wrap: wrap;
    margin-top: 8px;
}

.filter-row input[type="date"] {
    flex: 1; min-width: 120px;
    font-size: 13px;
    padding: 6px 10px;
}

/* ========== FAB ========== */
.fab {
    position: fixed;
    bottom: 75px; right: 16px;
    width: 56px; height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    border: none;
    font-size: 24px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 20px rgba(79,70,229,0.4);
    z-index: 999;
    transition: var(--transition);
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(79,70,229,0.5);
}

/* ========== Offcanvas / Modal Overrides ========== */
.offcanvas {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
}

.offcanvas-header {
    background: linear-gradient(135deg, var(--dark), var(--primary));
    color: #fff;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 16px 20px;
}

.offcanvas-header .btn-close { filter: invert(1); }

.offcanvas-header h5 { font-weight: 700; font-size: 17px; }

.offcanvas-body { padding: 20px; }

/* ========== Bill Form ========== */
.bill-section-title {
    font-weight: 700; font-size: 14px;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 20px 0 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--primary-light);
}

.bill-section-title:first-of-type { margin-top: 0; }

.bill-item-row {
    background: #f8fafc;
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    position: relative;
}

.bill-item-row .remove-item {
    position: absolute; top: 6px; right: 6px;
    background: var(--danger-light); color: var(--danger);
    border: none; border-radius: 50%;
    width: 26px; height: 26px;
    font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}

.bill-item-row .remove-item:hover {
    background: var(--danger); color: #fff;
}

.summary-table {
    width: 100%;
    font-size: 14px;
}

.summary-table td {
    padding: 6px 4px;
}

.summary-table .total-row td {
    font-weight: 700; font-size: 16px;
    border-top: 2px solid var(--primary);
    color: var(--primary);
    padding-top: 10px;
}

/* ========== Toast ========== */
.toast-container {
    position: fixed; top: 70px; right: 16px; z-index: 9999;
}

/* ========== Empty State ========== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state i { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 14px; margin: 0; }

/* ========== Animations ========== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* ========== Loading Spinner ========== */
.spinner-overlay {
    position: fixed; inset: 0;
    background: rgba(255,255,255,0.7);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

/* ========== Responsive ========== */
@media (min-width: 768px) {
    .main-content { padding: 76px 24px 80px; }
    .bottom-tabs .tab-btn { font-size: 12px; padding: 10px 4px 12px; }
    .item-card, .bill-card { padding: 16px 20px; }
    .login-card { padding: 48px 40px; }
}

@media (max-width: 375px) {
    .card-meta { font-size: 11.5px; }
    .section-header h5 { font-size: 16px; }
}
