/* ===============================================
   Expense Manager - Main Stylesheet
   =============================================== */

/* CSS Variables */
:root {
    --primary-color: #4f46e5;
    --secondary-color: #7c3aed;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    --dark-color: #1f2937;
    --light-color: #f8fafc;
    --sidebar-width: 280px;
    --header-height: 70px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: #f8fafc;
    color: #374151;
}

/* ===============================================
   SIDEBAR STYLES
   =============================================== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    z-index: 1000;
    transition: all 0.3s ease;
    overflow-y: auto;
}

.sidebar.collapsed {
    width: 80px;
}

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

.sidebar-brand .brand-logo {
    color: white;
    font-size: 2rem;
    margin-bottom: 10px;
}

.sidebar-brand .brand-text {
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.sidebar.collapsed .brand-text {
    display: none;
}

.sidebar-menu {
    padding: 20px 0;
}

.menu-item {
    margin: 5px 15px;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.menu-link:hover, .menu-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(5px);
}

.menu-link i {
    width: 20px;
    margin-right: 15px;
    text-align: center;
}

.sidebar.collapsed .menu-link span {
    display: none;
}

.sidebar.collapsed .menu-link {
    justify-content: center;
    padding: 12px 10px;
}

.sidebar.collapsed .menu-link i {
    margin-right: 0;
}

/* ===============================================
   HEADER STYLES
   =============================================== */

.main-header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 999;
    transition: all 0.3s ease;
}

.sidebar.collapsed + .main-header {
    left: 80px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 30px;
}

.header-left {
    display: flex;
    align-items: center;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #6b7280;
    margin-right: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    background: #f3f4f6;
    color: var(--primary-color);
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dark-color);
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-search {
    position: relative;
    width: 300px;
}

.header-search input {
    width: 100%;
    padding: 10px 40px 10px 15px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #f9fafb;
    font-size: 14px;
}

.header-search i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

.header-notifications {
    position: relative;
    cursor: pointer;
}

.notification-icon {
    font-size: 1.2rem;
    color: #6b7280;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.notification-icon:hover {
    background: #f3f4f6;
    color: var(--primary-color);
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger-color);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.user-dropdown {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 5px;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.user-dropdown:hover {
    background: #f3f4f6;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    margin-right: 10px;
}

.user-info {
    text-align: left;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--dark-color);
}

.user-role {
    font-size: 12px;
    color: #6b7280;
}

/* ===============================================
   MAIN CONTENT AREA
   =============================================== */

.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 30px;
    min-height: calc(100vh - var(--header-height));
    transition: all 0.3s ease;
}

.sidebar.collapsed ~ .main-content {
    margin-left: 80px;
}

/* ===============================================
   DASHBOARD COMPONENTS
   =============================================== */

.dashboard-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #f1f5f9;
    transition: all 0.3s ease;
    height: 100%;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.stat-card {
    text-align: center;
    padding: 30px 20px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 1.5rem;
    color: white;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

.stat-change {
    font-size: 12px;
    margin-top: 10px;
}

.stat-change.positive {
    color: var(--success-color);
}

.stat-change.negative {
    color: var(--danger-color);
}

/* ===============================================
   DASHBOARD SPECIFIC STYLES
   =============================================== */

.welcome-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    color: white;
    padding: 30px;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.welcome-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.chart-container {
    position: relative;
    height: 300px;
}

.transaction-item {
    display: flex;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f1f5f9;
}

.transaction-item:last-child {
    border-bottom: none;
}

.transaction-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 16px;
}

.transaction-details {
    flex-grow: 1;
}

.transaction-title {
    font-weight: 600;
    color: #374151;
    margin-bottom: 2px;
}

.transaction-category {
    font-size: 12px;
    color: #6b7280;
}

.transaction-amount {
    font-weight: 600;
    font-size: 16px;
}

.expense {
    color: #ef4444;
}

.income {
    color: #10b981;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.quick-action-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
}

.quick-action-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.15);
}

.quick-action-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 1.5rem;
    color: white;
}

.progress-custom {
    height: 8px;
    border-radius: 10px;
}

/* ===============================================
   COMPACT DASHBOARD STYLES
   =============================================== */

.stat-card.compact {
    padding: 20px 15px;
    text-align: center;
}

.stat-card.compact .stat-icon.small {
    width: 45px;
    height: 45px;
    margin: 0 auto 10px;
    font-size: 1.2rem;
}

.stat-card.compact .stat-value.small {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 3px;
}

.stat-card.compact .stat-label.small {
    font-size: 12px;
    font-weight: 500;
}

.transaction-list.compact .transaction-item.compact {
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}

.transaction-list.compact .transaction-item.compact:last-child {
    border-bottom: none;
}

.transaction-list.compact .transaction-icon.small {
    width: 32px;
    height: 32px;
    margin-right: 12px;
    font-size: 12px;
}

.transaction-list.compact .transaction-details {
    flex-grow: 1;
}

.transaction-list.compact .transaction-title.small {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 1px;
}

.transaction-list.compact .transaction-category.small {
    font-size: 11px;
}

.transaction-list.compact .transaction-amount.small {
    font-weight: 600;
    font-size: 13px;
}

.account-list.compact .account-item.compact {
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.account-list.compact .account-item.compact:last-child {
    border-bottom: none;
}

.category-list.compact .category-item.compact {
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}

.category-list.compact .category-item.compact:last-child {
    border-bottom: none;
}

/* Extra small text utility */
.x-small {
    font-size: 11px;
}

/* ===============================================
   MONTH FILTER STYLING
   =============================================== */

.month-filter .form-select {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.month-filter .form-select:focus {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
}

.month-filter .form-select option {
    background: white;
    color: #374151;
}

/* ===============================================
   DROPDOWN STYLES
   =============================================== */

.dropdown-menu {
    border: none;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    padding: 10px 0;
}

.dropdown-item {
    padding: 10px 20px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.dropdown-item:hover {
    background: #f8fafc;
    color: var(--primary-color);
}

.dropdown-item i {
    width: 20px;
    margin-right: 10px;
}

/* ===============================================
   LOGIN PAGE STYLES
   =============================================== */

.login-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    max-width: 900px;
    width: 100%;
}

.login-left {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    padding: 60px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.login-right {
    padding: 60px 40px;
}

.brand-logo {
    font-size: 3rem;
    margin-bottom: 20px;
    color: white;
}

.brand-title {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 15px;
}

.brand-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    line-height: 1.6;
}

.form-floating {
    margin-bottom: 20px;
}

.form-floating input {
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px 15px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-floating input:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-floating label {
    color: #6b7280;
    font-weight: 500;
}

.btn-login {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    border: none;
    border-radius: 12px;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    width: 100%;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
    color: white;
}

.form-check-input:checked {
    background-color: #4f46e5;
    border-color: #4f46e5;
}

.forgot-password {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.forgot-password:hover {
    color: #7c3aed;
}

.login-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 10px;
}

.login-subtitle {
    color: #6b7280;
    margin-bottom: 40px;
}

/* Password Toggle Styles */
.password-field {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    padding: 5px;
    z-index: 10;
    font-size: 16px;
    transition: color 0.3s ease;
}

.password-toggle:hover {
    color: #4f46e5;
}

.password-toggle:focus {
    outline: none;
    box-shadow: none;
}

.divider {
    text-align: center;
    margin: 30px 0;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e5e7eb;
}

.divider span {
    background: white;
    padding: 0 20px;
    color: #6b7280;
    font-size: 14px;
}

.register-link {
    text-align: center;
    margin-top: 30px;
    color: #6b7280;
}

.register-link a {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 600;
}

.register-link a:hover {
    color: #7c3aed;
}

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

@media (max-width: 768px) {
    .sidebar {
        width: 80px;
    }
    
    .main-header {
        left: 80px;
    }
    
    .main-content {
        margin-left: 80px;
    }
    
    .header-search {
        display: none;
    }
    
    .page-title {
        font-size: 1.2rem;
    }
    
    .login-left {
        padding: 40px 30px;
    }
    
    .login-right {
        padding: 40px 30px;
    }
    
    .brand-title {
        font-size: 1.5rem;
    }
    
    .login-title {
        font-size: 1.5rem;
    }
}

@media (max-width: 576px) {
    .sidebar {
        width: 0;
        overflow: hidden;
    }
    
    .sidebar.show {
        width: var(--sidebar-width);
    }
    
    .main-header {
        left: 0;
    }
    
    .main-content {
        margin-left: 0;
    }
}

/* ===============================================
   UTILITY CLASSES
   =============================================== */

.text-primary { color: var(--primary-color) !important; }
.text-secondary { color: var(--secondary-color) !important; }
.text-success { color: var(--success-color) !important; }
.text-warning { color: var(--warning-color) !important; }
.text-danger { color: var(--danger-color) !important; }
.text-info { color: var(--info-color) !important; }

.bg-primary { background-color: var(--primary-color) !important; }
.bg-secondary { background-color: var(--secondary-color) !important; }
.bg-success { background-color: var(--success-color) !important; }
.bg-warning { background-color: var(--warning-color) !important; }
.bg-danger { background-color: var(--danger-color) !important; }
.bg-info { background-color: var(--info-color) !important; }

.border-primary { border-color: var(--primary-color) !important; }
.border-secondary { border-color: var(--secondary-color) !important; }
.border-success { border-color: var(--success-color) !important; }
.border-warning { border-color: var(--warning-color) !important; }
.border-danger { border-color: var(--danger-color) !important; }
.border-info { border-color: var(--info-color) !important; }

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

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

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

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    border-radius: inherit;
    z-index: 10;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-color);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
    z-index: 11;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}