/* =========================================
   1. VARIABLES & RESET
   ========================================= */
:root {
    /* Colors */
    --bg-color: #F0F2F5;
    --primary-blue: #3B82F6;
    --primary-hover: #2563EB;
    --header-bg: #334155;
    
    /* Text */
    --font-main: 'Inter', sans-serif;
    --text-dark: #334155;
    --text-muted: #64748B;
    --text-light: #94a3b8;

    /* Spacing & Borders */
    --card-radius: 20px;
    --element-radius: 12px;
    
    /* Shadows */
    --shadow-soft: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body {
    background-color: var(--bg-color);
    font-family: var(--font-main);
    color: var(--text-dark);
    -webkit-font-smoothing: antialiased;
    padding-bottom: 80px;
}

/* =========================================
   2. CARDS & CONTAINERS
   ========================================= */
.glass-card {
    background: #FFFFFF;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-soft);
    border: none;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

/* Dark Header Card Wrapper */
.dark-header-card {
    border-radius: var(--card-radius);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    border: none;
    margin-bottom: 2rem;
    background-color: white;
}

.dark-header {
    background-color: var(--header-bg);
    color: white;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.dark-header h5 {
    margin: 0;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Stat Cards (Summary) */
.stat-card {
    border-radius: 16px;
    padding: 1.5rem;
    color: white;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 140px;
    border: none;
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-card h3 { font-size: 1.4rem; font-weight: 700; margin: 10px 0 0 0; }
.stat-card small { font-size: 0.8rem; opacity: 0.9; line-height: 1.3; font-weight: 500; }

/* Gradients */
.card-blue { background: linear-gradient(135deg, #60A5FA, #2563EB); box-shadow: 0 10px 20px -5px rgba(37, 99, 235, 0.4); }
.card-purple { background: linear-gradient(135deg, #A78BFA, #7C3AED); box-shadow: 0 10px 20px -5px rgba(124, 58, 237, 0.4); } 
.card-green { background: linear-gradient(135deg, #34D399, #059669); box-shadow: 0 10px 20px -5px rgba(5, 150, 105, 0.4); }
.card-teal { background: linear-gradient(135deg, #2DD4BF, #0D9488); box-shadow: 0 10px 20px -5px rgba(13, 148, 136, 0.4); }
.card-orange { background: linear-gradient(135deg, #FBBF24, #EA580C); box-shadow: 0 10px 20px -5px rgba(234, 88, 12, 0.4); }

/* =========================================
   3. FORMS & INPUTS
   ========================================= */
.input-group-custom label {
    font-weight: 600;
    color: var(--primary-blue);
    font-size: 0.85rem;
    margin-bottom: 6px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.form-control-custom {
    border: 1px solid #E2E8F0;
    border-radius: var(--element-radius);
    padding: 12px 15px;
    background: #FFFFFF;
    color: var(--text-dark);
    width: 100%;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.form-control-custom:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.form-control-custom[readonly], 
.form-control-custom[disabled] {
    background-color: #F8FAFC;
    color: var(--text-muted);
    border-color: #E2E8F0;
}

/* Checkboxes */
.form-check-input:checked {
    background-color: var(--primary-blue);
    border-color: var(--primary-blue);
}

/* =========================================
   4. TABLES
   ========================================= */
.table-custom thead th {
    background-color: #F8FAFC;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    border-bottom: 2px solid #E2E8F0;
    padding: 15px 12px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    letter-spacing: 0.025em;
}

.table-custom thead th:hover {
    background-color: #E2E8F0;
    color: var(--text-dark);
}

.table-custom tbody td {
    border-bottom: 1px solid #F1F5F9;
    padding: 14px 12px;
    vertical-align: middle;
    color: var(--text-dark);
    font-weight: 500;
    font-size: 0.95rem;
}

.table-custom tr:last-child td {
    border-bottom: none;
}

/* Sorting */
.sort-icon { font-size: 0.7rem; margin-left: 4px; opacity: 0.3; transition: opacity 0.2s; }
.active-sort { opacity: 1; color: var(--primary-blue); }

/* =========================================
   5. BUTTONS & ACTIONS
   ========================================= */
/* Main Action Button (Refresh) */
.btn-refresh {
    background: linear-gradient(90deg, #3B82F6 0%, #2563EB 100%);
    border: none;
    border-radius: 50px;
    color: white;
    font-weight: 600;
    padding: 12px 30px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    width: 100%;
    transition: all 0.2s;
}

.btn-refresh:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
    opacity: 0.95;
    color: white;
}

/* Small Pill Button (Pay) */
.btn-pay {
    background-color: var(--primary-blue);
    color: white;
    border: none;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s;
    letter-spacing: 0.02em;
}

.btn-pay:hover {
    background-color: var(--primary-hover);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(59, 130, 246, 0.3);
}

/* Icon Action Buttons (Edit/Delete) */
.btn-icon-action {
    background: transparent;
    border: 1px solid #E2E8F0;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0 3px;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-icon-action:hover {
    background-color: #EFF6FF;
    color: var(--primary-blue);
    border-color: var(--primary-blue);
}

.btn-icon-danger:hover {
    background-color: #FEF2F2;
    color: #EF4444;
    border-color: #EF4444;
}

/* =========================================
   6. STATUS & BADGES
   ========================================= */
/* Status Dots */
.status-dot { height: 10px; width: 10px; border-radius: 50%; display: inline-block; margin-right: 8px; }
.dot-green { background-color: #10B981; box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2); }
.dot-yellow { background-color: #F59E0B; box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2); }
.dot-red { background-color: #EF4444; box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2); }

/* Status Text */
.status-text-green { color: #10B981; font-weight: 600; }
.status-text-yellow { color: #F59E0B; font-weight: 600; }
.status-text-red { color: #EF4444; font-weight: 600; }

/* Badges */
.badge-type {
    font-size: 0.75rem;
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 600;
    letter-spacing: 0.02em;
    display: inline-block;
}
.badge-budgeted { background-color: rgba(16, 185, 129, 0.1); color: #059669; }
.badge-unplanned { background-color: rgba(59, 130, 246, 0.1); color: #2563EB; }
.status-active { background-color: #DEF7EC; color: #03543F; border-radius: 20px; padding: 4px 10px; font-size: 0.75rem; font-weight: 600; }
.status-inactive { background-color: #F3F4F6; color: #374151; border-radius: 20px; padding: 4px 10px; font-size: 0.75rem; font-weight: 600; }

/* =========================================
   7. MODALS
   ========================================= */
.modal-content {
    border-radius: var(--card-radius);
    border: none;
    box-shadow: var(--shadow-hover);
}

.modal-header {
    border-bottom: 1px solid #F1F5F9;
    padding: 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

/* Modal specific close button override for dark backgrounds */
.btn-close-white {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* =========================================
   8. NAVIGATION & HUB (Index)
   ========================================= */
.nav-card {
    text-decoration: none;
    display: block;
    height: 100%;
    transition: transform 0.2s ease;
}

.nav-card:hover {
    transform: translateY(-5px);
}

/* Override stat-card for navigation purposes */
.nav-card .stat-card {
    min-height: 160px;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.nav-card i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.nav-card h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.nav-card small {
    opacity: 0.8;
    font-weight: 400;
    margin-top: 5px;
    display: block;
    color: rgba(255, 255, 255, 0.9);
}

/* Section Dividers */
.section-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 1rem;
    margin-top: 2rem;
    padding-left: 5px;
}

/* Custom List Group (Masters) */
.list-group-custom .list-group-item {
    border: none;
    padding: 1rem 1.25rem;
    margin-bottom: 8px;
    border-radius: var(--element-radius);
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    transition: all 0.2s ease;
    font-weight: 500;
    color: var(--text-dark);
    display: flex;
    align-items: center;
}

.list-group-custom .list-group-item:hover {
    background-color: #f8fafc;
    transform: translateX(5px);
    color: var(--primary-blue);
    box-shadow: var(--shadow-soft);
}

.icon-box {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    background-color: #EFF6FF;
    color: var(--primary-blue);
    font-size: 1.1rem;
}

/* =========================================
   9. MONTH SELECTION GRID (Templates)
   ========================================= */
.month-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 12px;
}

.month-option {
    position: relative;
}

.month-option input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.month-option label {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #F3F4F6;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 8px 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.month-option input:checked + label {
    background-color: var(--primary-blue);
    color: white;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.3);
}

.month-chip {
    font-size: 0.7rem;
    margin-right: 3px;
    margin-bottom: 3px;
    background-color: #F1F5F9;
    color: var(--text-dark);
    border: 1px solid #E2E8F0;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

/* =========================================================
   10. IOS GLASSMORPHISM & HUB STYLES (Added for V2 UI)
   ========================================================= */

/* Mesh Gradient Background */
body.ios-bg {
    background-color: #f2f2f7;
    background-image: 
        radial-gradient(at 0% 0%, hsla(253,16%,7deg,0) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(225,39%,30deg,0) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(339,49%,30deg,0) 0, transparent 50%),
        radial-gradient(at 0% 100%, hsla(205, 85%, 85%, 0.6) 0px, transparent 50%),
        radial-gradient(at 80% 100%, hsla(280, 85%, 85%, 0.5) 0px, transparent 50%),
        radial-gradient(at 100% 20%, hsla(355, 85%, 85%, 0.5) 0px, transparent 50%);
    background-attachment: fixed;
    padding-bottom: 60px;
}

/* Hub Glass Panels */
.glass-panel {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 28px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.04);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 24px;
}

.glass-panel:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.85);
}

.glass-panel h3 { font-size: 1.1rem; font-weight: 700; color: #1c1c1e; margin: 0 0 5px 0; letter-spacing: -0.3px; }
.glass-panel small { font-size: 0.8rem; color: #8e8e93; font-weight: 500; line-height: 1.3; }

/* Hub Icons & Colors */
.icon-wrap {
    width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center;
    justify-content: center; font-size: 1.4rem; color: white; margin-bottom: 18px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.bg-ios-blue { background: linear-gradient(135deg, #007aff, #0056b3); }
.bg-ios-indigo { background: linear-gradient(135deg, #5856d6, #3a398c); }
.bg-ios-purple { background: linear-gradient(135deg, #af52de, #7b389c); }
.bg-ios-teal { background: linear-gradient(135deg, #5ac8fa, #3498bd); }
.bg-ios-orange { background: linear-gradient(135deg, #ff9500, #b36800); }
.bg-ios-pink { background: linear-gradient(135deg, #ff2d55, #b31d3a); }
.bg-ios-green { background: linear-gradient(135deg, #34c759, #248a3d); }
.bg-ios-gray { background: linear-gradient(135deg, #8e8e93, #636366); }

/* iOS Table Lists (Settings & Forms) */
.ios-list-group {
    background: rgba(255, 255, 255, 0.65); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.8); border-radius: 28px; overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.04); margin-bottom: 25px;
}
.ios-list-item {
    padding: 16px 20px; display: flex; align-items: center; justify-content: space-between;
    text-decoration: none; color: #1c1c1e; font-weight: 600; border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background: white; min-height: 50px;
}
.ios-list-item:last-child { border-bottom: none; }
.ios-list-item:hover { background: rgba(255, 255, 255, 0.9); }
.ios-list-icon {
    width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center;
    justify-content: center; color: white; margin-right: 16px; font-size: 0.9rem;
}

/* Form Inputs (Expense & Payments Page) */
.ios-content { flex-grow: 1; display: flex; align-items: center; justify-content: space-between; width: 100%; }
.ios-label { font-size: 1rem; font-weight: 500; color: #000; min-width: 80px; margin: 0; }
.ios-input { border: none; text-align: right; font-size: 1.05rem; color: #007AFF; background: transparent; width: 100%; outline: none; }
.ios-input::placeholder { color: #C7C7CC; }
select.ios-input { appearance: none; -webkit-appearance: none; direction: rtl; }

/* Large Amount Input */
.amount-wrapper {
    background: #FFFFFF; padding: 30px 20px; text-align: center; border-radius: 14px; 
    margin-bottom: 25px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); transition: background-color 0.3s;
}
.amount-wrapper.edit-mode { background-color: #EBF5FF; border: 1px solid #007AFF; }
.currency-symbol { font-size: 2rem; font-weight: 600; color: #000; vertical-align: top; margin-top: 5px; display: inline-block; }
.amount-input { border: none; font-size: 3.5rem; font-weight: 700; width: 80%; text-align: center; outline: none; color: #000; background: transparent; padding: 0; margin: 0; letter-spacing: -2px; }

/* iOS Buttons */
.btn-ios { background-color: #007AFF; color: white; border: none; border-radius: 50px; font-size: 1.1rem; font-weight: 600; padding: 16px; width: 100%; box-shadow: 0 4px 10px rgba(0, 122, 255, 0.3); transition: transform 0.1s; }
.btn-ios:active { transform: scale(0.98); opacity: 0.9; }
.btn-ios:disabled { background-color: #B0B0B5; box-shadow: none; }
.btn-cancel { background-color: #8E8E93; box-shadow: none; }
