/* ----------------------------------------------------
   محفظتي — My Wallet Stylesheet
   Design Language: Premium Dark Navy with crisp White cards,
   vibrant emerald, warm crimson, and gold/amber accents.
   Fully optimized for high-end mobile feel (390px simulated).
------------------------------------------------------- */

:root {
    /* Color Palette variables */
    --bg-main: #0b0f19;          /* Premium rich dark navy background */
    --bg-main-gradient: linear-gradient(135deg, #0b0f19 0%, #151e33 100%);
    --card-white: #ffffff;        /* Crisp clean white layout cards */
    --card-gray: #f8fafc;
    
    --text-primary: #1e293b;      /* Slate 800 */
    --text-secondary: #64748b;    /* Slate 500 */
    --text-muted: #94a3b8;        /* Slate 400 */
    --text-white: #ffffff;
    
    --color-income: #10b981;      /* Emerald Green */
    --color-income-light: #ecfdf5;
    --color-expense: #ef4444;     /* Crimson Red */
    --color-expense-light: #fef2f2;
    --color-accent: #f59e0b;      /* Gold Accent */
    --color-accent-light: #fef3c7;
    
    /* Wallet Themed Colors */
    --color-cash: #0ea5e9;        /* Sky blue for Cash */
    --color-bank: #8b5cf6;        /* Purple for Bank */
    --color-ewallet: #e11d48;     /* Rose for E-wallet */
    
    /* System variables */
    --font-heading: 'Cairo', 'Tajawal', system-ui, -apple-system, sans-serif;
    --font-body: 'Tajawal', 'Cairo', system-ui, -apple-system, sans-serif;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 8px;
    --shadow-premium: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-soft: 0 4px 12px -2px rgba(15, 23, 42, 0.04), 0 2px 4px -1px rgba(15, 23, 42, 0.02);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Resets */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    background-color: #05070a;
    font-family: var(--font-body);
    color: var(--text-primary);
    overflow: hidden; /* App Shell scrolls internally */
    display: flex;
    justify-content: center;
    align-items: center;
}

[dir="rtl"] {
    text-align: right;
}

[dir="ltr"] {
    text-align: left;
}

/* ----------------------------------------------------
   App Container & Phone Mockup
------------------------------------------------------- */
.phone-container {
    width: 100%;
    height: 100%;
    max-width: 480px; /* Limits size on desktop */
    max-height: 900px;
    background: var(--bg-main-gradient);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border-radius: 0px;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Add stylish border frame only on large screens */
@media (min-width: 481px) {
    .phone-container {
        border-radius: 36px;
        border: 8px solid #1e293b;
        height: 92vh;
    }
}

/* ----------------------------------------------------
   Header Styles
------------------------------------------------------- */
.app-header {
    height: 80px;
    background: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    z-index: 10;
    color: var(--text-white);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-logo {
    width: 32px;
    height: 32px;
    color: var(--color-accent);
    filter: drop-shadow(0 2px 4px rgba(245, 158, 11, 0.2));
}

.app-logo-img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.logo-text-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.logo-text {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 19px;
    line-height: 1.2;
    letter-spacing: -0.5px;
    color: #f97316; /* لون برتقالي ثابت كبديل في حال عدم دعم التدرج */
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.app-subtitle {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    margin: 0;
}

.btn-settings-header {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.07);
    width: 44px; /* Touch target size optimized */
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition-smooth);
    outline: none;
}

.btn-settings-header:hover, .btn-settings-header.active {
    background: rgba(245, 158, 11, 0.12);
    border-color: var(--color-accent);
    color: var(--color-accent);
    filter: drop-shadow(0 2px 6px rgba(245, 158, 11, 0.25));
}

.btn-settings-header:active {
    transform: scale(0.92);
}

.icon-gear {
    width: 22px;
    height: 22px;
    transition: transform 0.4s ease;
}

.btn-settings-header:hover .icon-gear, .btn-settings-header.active .icon-gear {
    transform: rotate(45deg);
}

/* ----------------------------------------------------
   Main Scrollable Area & Transition Screens
------------------------------------------------------- */
.app-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 100px; /* Room for Bottom Nav and FAB */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.app-content::-webkit-scrollbar {
    width: 4px;
}

.app-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* Screens toggling */
.app-screen {
    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.app-screen.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* ----------------------------------------------------
   Tab 1: Home Screen Elements
------------------------------------------------------- */

/* Balance Card (Total Dashboard) */
.balance-card {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: 24px;
    color: var(--text-white);
    box-shadow: var(--shadow-premium);
    position: relative;
    overflow: hidden;
    margin-bottom: 24px;
}

.balance-card::before {
    content: '';
    position: absolute;
    top: -50px;
    left: -50px;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.12) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.balance-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 6px;
}

.balance-amount {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 38px;
    margin-bottom: 16px;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.balance-amount .currency {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-accent);
}

.balance-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin-bottom: 16px;
}

.balance-quick-stats {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.quick-stat-item {
    flex: 1;
}

.quick-stat-label {
    font-size: 13px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.quick-stat-value {
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-heading);
}

.text-green { color: var(--color-income) !important; }
.text-red { color: var(--color-expense) !important; }
.text-accent { color: var(--color-accent) !important; }

/* Wallets Grid */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    margin-top: 10px;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-white);
    font-family: var(--font-heading);
}

.view-all-btn {
    background: transparent;
    border: none;
    color: var(--color-accent);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    padding: 6px 12px;
}

.wallets-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.wallet-card {
    background: var(--card-white);
    border-radius: var(--radius-md);
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--shadow-soft);
    border-top: 4px solid var(--text-muted);
    transition: var(--transition-smooth);
    cursor: pointer;
}

.wallet-card:active {
    transform: scale(0.96);
}

.wallet-icon-wrapper {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wallet-card-icon {
    width: 20px;
    height: 20px;
}

.wallet-card-info {
    display: flex;
    flex-direction: column;
}

.wallet-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wallet-card-bal {
    font-size: 14px;
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--text-primary);
    white-space: nowrap;
}

/* Individual Wallet Borders */
.card-cash { border-top-color: var(--color-cash); }
.card-cash .wallet-icon-wrapper { background: rgba(14, 165, 233, 0.1); color: var(--color-cash); }

.card-bank { border-top-color: var(--color-bank); }
.card-bank .wallet-icon-wrapper { background: rgba(139, 92, 246, 0.1); color: var(--color-bank); }

.card-ewallet { border-top-color: var(--color-ewallet); }
.card-ewallet .wallet-icon-wrapper { background: rgba(225, 29, 72, 0.1); color: var(--color-ewallet); }

/* Monthly Progress Card */
.monthly-bar-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 24px;
}

.bar-stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.stat-meta {
    font-size: 14px;
    color: var(--text-muted);
}

.stat-percentage {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-accent);
}

.progress-bar-container {
    height: 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--color-accent) 0%, #f59e0b 100%);
    width: 0%;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ----------------------------------------------------
   General Transaction List Elements (Home & Ledger)
------------------------------------------------------- */
.transaction-list-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.trans-item {
    background: var(--card-white);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.trans-item::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.trans-item.income::before { background-color: var(--color-income); }
.trans-item.expense::before { background-color: var(--color-expense); }

.trans-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
}

.trans-cat-icon {
    width: 44px; /* Touch target minimum optimized */
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}

.trans-item.income .trans-cat-icon {
    background: var(--color-income-light);
    color: var(--color-income);
}

.trans-item.expense .trans-cat-icon {
    background: var(--color-expense-light);
    color: var(--color-expense);
}

.trans-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.trans-desc {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trans-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.trans-badge-wallet {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 12px;
    background: #f1f5f9;
}

.trans-badge-wallet.cash { color: var(--color-cash); background: rgba(14, 165, 233, 0.08); }
.trans-badge-wallet.bank { color: var(--color-bank); background: rgba(139, 92, 246, 0.08); }
.trans-badge-wallet.ewallet { color: var(--color-ewallet); background: rgba(225, 29, 72, 0.08); }

.trans-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.trans-amount-text {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 16px;
    white-space: nowrap;
}

.trans-item.income .trans-amount-text { color: var(--color-income); }
.trans-item.expense .trans-amount-text { color: var(--color-expense); }

/* Inline Delete button */
.delete-inline-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px; /* Touch target optimized */
    border-radius: 50%;
    transition: var(--transition-smooth);
}

.delete-inline-btn:hover {
    color: var(--color-expense);
    background: var(--color-expense-light);
}

.delete-btn-icon {
    width: 20px;
    height: 20px;
}

/* Empty State Styling */
.empty-state {
    padding: 40px 20px;
    text-align: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1.5px dashed rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    color: var(--text-muted);
}

.empty-icon-wrapper {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px auto;
}

.empty-icon {
    width: 30px;
    height: 30px;
    color: var(--text-muted);
}

.empty-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 6px;
}

.empty-desc {
    font-size: 12px;
    line-height: 1.6;
    max-width: 250px;
    margin: 0 auto;
}

/* ----------------------------------------------------
   Tab 2: Ledger Ledger (Transactions Screen)
------------------------------------------------------- */

/* Filter Card */
.filter-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 20px;
}

.filter-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 12px;
}

.filters-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-item label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
}

.form-select-filter,
.form-input-filter {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-white);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 13px;
    font-family: var(--font-body);
    outline: none;
    transition: var(--transition-smooth);
}

.form-select-filter:focus,
.form-input-filter:focus {
    border-color: var(--color-accent);
}

.filter-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.btn-secondary-sm {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-muted);
    padding: 8px 16px;
    font-size: 12px;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-body);
}

.btn-secondary-sm:hover {
    color: var(--text-white);
    border-color: var(--text-muted);
}

.badge-count {
    background: rgba(245, 158, 11, 0.12);
    color: var(--color-accent);
    font-size: 13px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
}

/* ----------------------------------------------------
   Tab 3: Monthly Summary Screen
------------------------------------------------------- */

/* Month Selector */
.month-navigator-card {
    background: var(--card-white);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-premium);
    margin-bottom: 20px;
}

.nav-month-btn {
    background: rgba(15, 23, 42, 0.04);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    transition: var(--transition-smooth);
}

.nav-month-btn:active {
    transform: scale(0.9);
    background: rgba(15, 23, 42, 0.08);
}

.nav-arrow-icon {
    width: 16px;
    height: 16px;
}

.current-month-text {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-primary);
}

/* Summary Metrics */
.summary-metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.metric-card {
    background: var(--card-white);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-soft);
}

.metric-label {
    font-size: 11px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 4px;
}

.metric-value {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 800;
}

.metric-income .metric-value { color: var(--color-income); }
.metric-expense .metric-value { color: var(--color-expense); }

/* Net balance banner */
.net-balance-card {
    background: var(--card-white);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-soft);
    border-right: 4px solid var(--text-muted);
}

.net-balance-card.surplus { border-right-color: var(--color-income); }
.net-balance-card.deficit { border-right-color: var(--color-expense); }

.net-balance-label {
    font-size: 12px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 4px;
}

.net-balance-amount {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 800;
}

.net-balance-indicator-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.surplus .net-balance-indicator-icon { background: var(--color-income-light); color: var(--color-income); }
.deficit .net-balance-indicator-icon { background: var(--color-expense-light); color: var(--color-expense); }

.net-indicator-svg {
    width: 18px;
    height: 18px;
}

/* Category Expense Breakdown */
.category-breakdown-card {
    background: var(--card-white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 20px;
}

.breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.breakdown-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.breakdown-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
}

.breakdown-item-name {
    color: var(--text-primary);
}

.breakdown-item-stats {
    display: flex;
    align-items: center;
    gap: 6px;
}

.breakdown-item-percentage {
    color: var(--text-secondary);
    font-size: 11px;
}

.breakdown-item-amount {
    color: var(--text-primary);
    font-family: var(--font-heading);
}

.breakdown-bar-container {
    height: 6px;
    background: #f1f5f9;
    border-radius: 10px;
    overflow: hidden;
}

.breakdown-bar-fill {
    height: 100%;
    border-radius: 10px;
    background-color: var(--color-accent);
    width: 0%;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ----------------------------------------------------
   Tab 4: Settings Screen Elements
------------------------------------------------------- */
.settings-card {
    background: var(--card-white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 20px;
}

.settings-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.settings-header-icon {
    width: 22px;
    height: 22px;
    color: var(--text-secondary);
}

.settings-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-primary);
}

.settings-sub-tag {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
    margin-bottom: 10px;
}

.wallet-setting-group {
    padding: 14px;
    border-radius: var(--radius-md);
    background: var(--card-gray);
    margin-bottom: 16px;
    border-right: 4px solid var(--text-muted);
}

.wallet-setting-group.border-cash { border-right-color: var(--color-cash); }
.wallet-setting-group.border-cash .settings-sub-tag { color: var(--color-cash); background: rgba(14, 165, 233, 0.08); }

.wallet-setting-group.border-bank { border-right-color: var(--color-bank); }
.wallet-setting-group.border-bank .settings-sub-tag { color: var(--color-bank); background: rgba(139, 92, 246, 0.08); }

.wallet-setting-group.border-ewallet { border-right-color: var(--color-ewallet); }
.wallet-setting-group.border-ewallet .settings-sub-tag { color: var(--color-ewallet); background: rgba(225, 29, 72, 0.08); }

.inputs-row {
    display: flex;
    gap: 10px;
}

.form-group-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group-item label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-control-input {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 10px;
    font-size: 12px;
    font-family: var(--font-body);
    outline: none;
    transition: var(--transition-smooth);
}

.form-control-input:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.1);
}

/* Category Manager in settings */
.categories-manager-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.add-custom-cat-row {
    display: flex;
    gap: 8px;
}

.add-custom-cat-row .form-control-input {
    flex: 1;
}

.custom-categories-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 30px;
}

.category-tag {
    background: #f1f5f9;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-remove-tag {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.btn-remove-tag:hover {
    color: var(--color-expense);
}

.icon-tag-close {
    width: 12px;
    height: 12px;
}

/* Master Actions Buttons styling */
.text-center { text-align: center; }
.justify-center { justify-content: center; }
.settings-disclaimer {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
}

.master-buttons-row {
    display: flex;
    gap: 10px;
}

.master-buttons-row button {
    flex: 1;
}

.btn-action-icon {
    width: 14px;
    height: 14px;
}

/* ----------------------------------------------------
   Interactive Buttons and Forms Framework
------------------------------------------------------- */
.btn-primary, .btn-success, .btn-danger {
    border: none;
    border-radius: var(--radius-md);
    padding: 16px 24px;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.btn-primary:active, .btn-success:active, .btn-danger:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-accent) 0%, #d97706 100%);
    color: var(--text-white);
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.2);
}

.btn-success {
    background: linear-gradient(135deg, var(--color-income) 0%, #059669 100%);
    color: var(--text-white);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}

.btn-danger {
    background: linear-gradient(135deg, var(--color-expense) 0%, #dc2626 100%);
    color: var(--text-white);
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.2);
}

.btn-primary-sm {
    background: linear-gradient(135deg, var(--color-accent) 0%, #d97706 100%);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-white);
    padding: 12px 20px;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
}

.flex-1 { flex: 1 !important; }

/* ----------------------------------------------------
   Bottom Persistent Tab Navigation Bar
------------------------------------------------------- */
.app-tab-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: rgba(11, 15, 25, 0.9);
    backdrop-filter: blur(15px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 10px;
    z-index: 9;
}

.tab-item {
    background: transparent;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    flex: 1;
    height: 100%;
    transition: var(--transition-smooth);
}

/* Push middle tabs away from the central floating button for a spacious cradle layout */
html[dir="rtl"] .tab-item:nth-child(2) {
    margin-left: 25px;
}
html[dir="rtl"] .tab-item:nth-child(3) {
    margin-right: 25px;
}

html[dir="ltr"] .tab-item:nth-child(2) {
    margin-right: 25px;
}
html[dir="ltr"] .tab-item:nth-child(3) {
    margin-left: 25px;
}

.tab-icon {
    width: 24px;
    height: 24px;
    transition: var(--transition-smooth);
}

.tab-label {
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font-body);
}

/* Active tab state */
.tab-item.active {
    color: var(--color-accent);
}

.tab-item.active .tab-icon {
    transform: translateY(-2px);
    filter: drop-shadow(0 2px 8px rgba(245, 158, 11, 0.3));
}

/* ----------------------------------------------------
   FAB: Persistent Floating Action Plus Button (Bottom Right)
------------------------------------------------------- */
.fab-btn {
    position: absolute;
    bottom: 40px; /* Centered beautifully half-in, half-out of the 80px tab bar */
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-accent) 0%, #d97706 100%);
    color: var(--text-white);
    border: none;
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fab-btn:active {
    transform: translateX(-50%) scale(0.9);
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.2);
}

.icon-fab {
    width: 26px;
    height: 26px;
}

/* ----------------------------------------------------
   Add Transaction Slide-up Sheet Modal
------------------------------------------------------- */
.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(5, 7, 10, 0.7);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-backdrop.active {
    display: block;
    opacity: 1;
}

.modal-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #0f172a; /* Solid elegant slate-900 background */
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px 24px 0 0;
    padding: 16px 20px 30px 20px;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.94, 0.6, 1);
    box-shadow: 0 -15px 30px rgba(0,0,0,0.3);
}

.modal-backdrop.active .modal-sheet {
    transform: translateY(0);
}

.modal-drag-bar {
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    margin: 0 auto 16px auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-white);
    font-family: var(--font-heading);
}

.modal-close-btn {
    background: rgba(255, 255, 255, 0.06);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition-smooth);
}

.modal-close-btn:hover {
    color: var(--text-white);
    background: rgba(255, 255, 255, 0.1);
}

.icon-close {
    width: 18px;
    height: 18px;
}

/* Modal Form Styles */
.modal-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

/* Custom Toggle Switch for Income vs Expense */
.form-toggle-switch {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 6px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.form-toggle-switch input[type="radio"] {
    display: none;
}

.toggle-label {
    flex: 1;
    text-align: center;
    padding: 14px 0;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border-radius: 8px;
    color: var(--text-muted);
    transition: var(--transition-smooth);
}

/* Checked styling */
#toggle-expense:checked ~ .expense-label {
    background: var(--color-expense);
    color: var(--text-white);
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.25);
}

#toggle-income:checked ~ .income-label {
    background: var(--color-income);
    color: var(--text-white);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.25);
}

/* Amount Selector Wrapper */
.amount-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.form-input-amount {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    padding-left: 60px;
    color: var(--text-white);
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 26px;
    text-align: left;
    outline: none;
    direction: ltr; /* Keeps numbers standard */
    transition: var(--transition-smooth);
}

.form-input-amount:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.amount-currency-label {
    position: absolute;
    left: 20px;
    font-size: 16px;
    font-weight: 700;
    color: var(--color-accent);
}

.form-grid-row {
    display: flex;
    gap: 12px;
}

/* Form selects inside dark modal */
.modal-form .form-control-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    color: var(--text-white);
}

.modal-form .form-control-input:focus {
    border-color: var(--color-accent);
}

.modal-form select.form-control-input option {
    background: #0f172a;
    color: var(--text-white);
}

.form-actions-row {
    margin-top: 10px;
    display: flex;
}

/* ----------------------------------------------------
   NEW FEATURES STYLES
   Language Toggle, Extra Sources, Import Statement
------------------------------------------------------- */

/* Language Toggle Buttons */
.lang-toggle-row {
    display: flex;
    gap: 10px;
    padding-top: 4px;
}

.lang-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.lang-btn:hover {
    border-color: rgba(245, 158, 11, 0.4);
    color: var(--text-white);
}

.lang-btn.active {
    background: rgba(245, 158, 11, 0.12);
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.lang-flag {
    font-size: 18px;
    line-height: 1;
}

/* Extra Income Sources */
.extra-sources-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
    min-height: 20px;
}

.extra-source-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    transition: var(--transition-smooth);
}

.extra-source-row:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.extra-source-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.extra-source-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-white);
}

.extra-source-bal {
    font-size: 11px;
    color: var(--color-income);
    font-family: var(--font-heading);
    font-weight: 600;
}

/* Add Source FAB Button */
.btn-add-source-fab {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border-radius: var(--radius-md);
    border: 2px dashed rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.04);
    color: var(--color-income);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-add-source-fab:hover {
    border-color: var(--color-income);
    background: rgba(16, 185, 129, 0.08);
}

.icon-plus-sm {
    width: 16px;
    height: 16px;
}

/* Import Statement Section */
.import-actions-row {
    margin-bottom: 12px;
}

.btn-import-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 2px dashed rgba(139, 92, 246, 0.35);
    background: rgba(139, 92, 246, 0.06);
    color: var(--color-bank);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-import-label:hover {
    border-color: var(--color-bank);
    background: rgba(139, 92, 246, 0.12);
}

.import-example-code {
    display: inline-block;
    background: rgba(139, 92, 246, 0.12);
    color: var(--color-bank);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-family: monospace;
    margin-top: 4px;
}

/* Import Preview Box */
.import-preview-box {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-top: 12px;
}

.import-preview-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

.import-count-badge {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-accent);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
}

.import-preview-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.import-preview-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    font-size: 11px;
    border-right: 3px solid transparent;
}

.import-preview-item.income { border-right-color: var(--color-income); }
.import-preview-item.expense { border-right-color: var(--color-expense); }

.import-item-sign {
    font-size: 14px;
    font-weight: 800;
    flex-shrink: 0;
}

.import-item-amount {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 12px;
    color: var(--text-white);
    flex-shrink: 0;
}

.import-item-desc {
    flex: 1;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.import-item-wallet {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 9px;
    flex-shrink: 0;
}

.import-item-date {
    color: var(--text-muted);
    font-size: 10px;
    flex-shrink: 0;
}

.import-confirm-row {
    display: flex;
    gap: 8px;
}

/* ----------------------------------------------------
   NEW STYLES: Language & Currency Dropdowns
------------------------------------------------------- */
.settings-dropdowns-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.settings-dropdown-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.settings-dropdown-item label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
}

/* ----------------------------------------------------
   NEW STYLES: Comparison Screen
------------------------------------------------------- */
.comparison-dates-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.comparison-period-box {
    background: var(--card-gray);
    padding: 14px;
    border-radius: var(--radius-md);
    border-right: 4px solid var(--text-muted);
}
.period-sub-tag {
    font-size: 11px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
    margin-bottom: 12px;
}
.border-p1 { border-right-color: var(--color-accent); }
.border-p1.period-sub-tag { color: var(--color-accent); background: rgba(245, 158, 11, 0.08); }
.border-p2 { border-right-color: var(--color-bank); }
.border-p2.period-sub-tag { color: var(--color-bank); background: rgba(139, 92, 246, 0.08); }

.comparison-summary-card {
    background: var(--card-white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.compare-metric-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}
.compare-metric-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.compare-metric-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.compare-metric-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
}

.compare-values {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
}

.compare-val-p1 {
    font-size: 15px;
    font-weight: 800;
    color: var(--color-accent);
}
.compare-val-p2 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
}
.compare-vs {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    font-style: italic;
}

.compare-change-badge {
    font-size: 11px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 20px;
    text-align: center;
    min-width: 65px;
}
.compare-change-badge.positive {
    background-color: var(--color-income-light);
    color: var(--color-income);
}
.compare-change-badge.negative {
    background-color: var(--color-expense-light);
    color: var(--color-expense);
}
.compare-change-badge.neutral {
    background-color: #f1f5f9;
    color: var(--text-secondary);
}

/* Category Double Progress Bar */
.compare-bar-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
}
.compare-bar-container {
    height: 6px;
    background: #f1f5f9;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}
.compare-bar-fill-p1 {
    height: 100%;
    border-radius: 10px;
    background-color: var(--color-accent);
    width: 0%;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.compare-bar-fill-p2 {
    height: 100%;
    border-radius: 10px;
    background-color: var(--color-bank);
    width: 0%;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

