* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4CAF50;
    --secondary-color: #2196F3;
    --danger-color: #f44336;
    --success-color: #4CAF50;
    --warning-color: #ff9800;
    --dark-color: #333;
    --light-color: #f4f4f4;
    --gray-color: #666;
    --white-color: #fff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
}

/* ============ HEADER ============ */
.app-header {
    background: var(--primary-color);
    color: white;
    padding: 15px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 600px;
    margin: 0 auto;
}

.menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
}

.app-title {
    font-size: 20px;
    font-weight: 600;
}

.profile-link {
    color: white;
    font-size: 24px;
    text-decoration: none;
}

/* ============ SIDEBAR ============ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    height: 100vh;
    height: 100dvh;
    background: white;
    transition: transform 0.3s ease;
    z-index: 1001;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
}

.sidebar.active {
    transform: translateX(0);
}

.sidebar-header {
    background: var(--primary-color);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    min-height: 60px;
}

.sidebar-header h2 {
    font-size: 18px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background 0.3s;
}

.close-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* Phần menu cuộn được */
.sidebar-menu-wrapper {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    min-height: 0;
    padding-bottom: 20px;
}

.sidebar-menu-wrapper::-webkit-scrollbar {
    width: 6px;
}

.sidebar-menu-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sidebar-menu-wrapper::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.sidebar-menu-wrapper::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 12px 25px;
    color: var(--dark-color);
    text-decoration: none;
    transition: background 0.3s;
    font-size: 14px;
    white-space: nowrap;
}

.sidebar-menu li a:hover {
    background: #f0f0f0;
}

.sidebar-menu li a i {
    margin-right: 15px;
    width: 20px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}

.logout-btn {
    color: var(--danger-color) !important;
}

/* Menu group title */
.menu-group-title {
    padding: 15px 25px 5px;
    font-size: 11px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Nút đóng cố định ở dưới */
.sidebar-footer {
    flex-shrink: 0;
    padding: 12px 20px;
    background: white;
    border-top: 1px solid #eee;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.05);
}

.sidebar-close-bottom {
    width: 100%;
    padding: 12px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 8px;
    color: #666;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}

.sidebar-close-bottom:hover {
    background: #e0e0e0;
    color: #333;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    z-index: 1000;
}

.overlay.active {
    display: block;
}

/* ============ MAIN CONTENT ============ */
.main-content {
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
    padding-bottom: 90px;
}

/* ============ BOTTOM NAVIGATION ============ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 5px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 999;
    height: 65px;
}

.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #666;
    font-size: 10px;
    flex: 1;
    transition: all 0.3s;
    position: relative;
    padding: 3px 0;
}

.bottom-nav a i {
    font-size: 20px;
    margin-bottom: 2px;
}

.bottom-nav a span {
    white-space: nowrap;
}

.bottom-nav a.active {
    color: var(--primary-color);
}

.nav-add-income {
    color: #4CAF50 !important;
    font-weight: 600;
}

.nav-add-income i {
    font-size: 26px !important;
    color: #4CAF50;
    animation: pulse-green 2s infinite;
}

.nav-add-expense {
    color: #f44336 !important;
    font-weight: 600;
}

.nav-add-expense i {
    font-size: 26px !important;
    color: #f44336;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-green {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes pulse-red {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* ============ CARD ============ */
.card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--dark-color);
}

/* ============ FORM ============ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--dark-color);
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn {
    display: inline-block;
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #45a049;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #da190b;
}

.btn-block {
    display: block;
    width: 100%;
}

/* ============ TRANSACTIONS ============ */
.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.transaction-item:last-child {
    border-bottom: none;
}

.transaction-info {
    display: flex;
    align-items: center;
}

.transaction-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 20px;
    flex-shrink: 0;
}

.income-icon {
    background: #e8f5e9;
}

.expense-icon {
    background: #ffebee;
}

.transaction-amount {
    font-weight: 600;
    font-size: 16px;
}

.income-amount {
    color: var(--success-color);
}

.expense-amount {
    color: var(--danger-color);
}

/* ============ SUMMARY CARD ============ */
.summary-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
}

.summary-balance {
    font-size: 32px;
    font-weight: 700;
    margin: 10px 0;
}

.summary-details {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.summary-item {
    text-align: center;
}

.summary-item-label {
    font-size: 14px;
    opacity: 0.9;
}

.summary-item-amount {
    font-size: 18px;
    font-weight: 600;
    margin-top: 5px;
}

/* ============ ALERT ============ */
.alert {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ============ AUTH PAGES ============ */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.auth-title {
    text-align: center;
    margin-bottom: 30px;
    color: var(--dark-color);
}

.auth-logo {
    text-align: center;
    margin-bottom: 20px;
}

.auth-logo i {
    font-size: 48px;
    color: var(--primary-color);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .main-content {
        padding: 15px;
        padding-bottom: 90px;
    }
    
    .summary-balance {
        font-size: 28px;
    }
    
    .transaction-item {
        padding: 12px;
    }
}

@media (min-width: 769px) {
    .bottom-nav {
        display: none;
    }
    
    .menu-toggle {
        display: none;
    }
    
    .sidebar {
        position: static;
        transform: none;
        width: auto;
        height: auto;
        background: transparent;
        box-shadow: none;
        display: block;
        overflow: visible;
    }
    
    .sidebar-header,
    .sidebar-footer {
        display: none;
    }
    
    .sidebar-menu-wrapper {
        overflow: visible;
        padding-bottom: 0;
    }
    
    .sidebar-menu {
        display: flex;
        padding: 0;
        flex-wrap: wrap;
    }
    
    .sidebar-menu li a {
        padding: 10px 15px;
    }
    
    .menu-group-title {
        display: none;
    }
    
    .overlay {
        display: none !important;
    }
    
    .app-header {
        padding: 20px;
    }
    
    .main-content {
        padding-bottom: 20px;
    }
}