/* style.css */
/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Kantumruy+Pro:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
    --font-primary: 'Inter', sans-serif;
    --font-khmer: 'Kantumruy Pro', sans-serif;

    /* Base theme defaults: Midnight Slate */
    --bg-app: #0f172a;
    --bg-sidebar: rgba(15, 23, 42, 0.95);
    --bg-card: rgba(30, 41, 59, 0.75);
    --bg-card-hover: rgba(30, 41, 59, 0.95);
    --bg-input: rgba(15, 23, 42, 0.6);
    --border-color: rgba(255, 255, 255, 0.09);
    --border-focus: #6366f1;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-color: #6366f1;
    --accent-text: #818cf8;
    --shadow-color: rgba(0, 0, 0, 0.3);
    
    /* Exchange Colors */
    --color-thb-khr: #10b981;
    --color-khr-thb: #fbbf24;
    --color-thb-usd: #a8a29e;
    --color-usd-thb: #06b6d4;
    --color-usd-khr: #f43f5e;
    --color-khr-usd: #f97316;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

/* 1. Midnight Slate (Dark - Default) */
body.theme-dark {
    --bg-app: #0f172a;
    --bg-sidebar: rgba(15, 23, 42, 0.96);
    --bg-card: rgba(30, 41, 59, 0.75);
    --bg-card-hover: rgba(30, 41, 59, 0.95);
    --bg-input: rgba(15, 23, 42, 0.6);
    --border-color: rgba(255, 255, 255, 0.09);
    --border-focus: #6366f1;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-color: #6366f1;
    --accent-text: #818cf8;
    --shadow-color: rgba(0, 0, 0, 0.3);
}

/* 2. Royal Emerald (Dark Green & Gold) */
body.theme-emerald {
    --bg-app: #022c22;
    --bg-sidebar: rgba(6, 78, 59, 0.96);
    --bg-card: rgba(6, 78, 59, 0.65);
    --bg-card-hover: rgba(6, 78, 59, 0.9);
    --bg-input: rgba(2, 44, 34, 0.7);
    --border-color: rgba(52, 211, 153, 0.16);
    --border-focus: #10b981;
    --text-primary: #ecfdf5;
    --text-secondary: #a7f3d0;
    --text-muted: #6ee7b7;
    --accent-color: #10b981;
    --accent-text: #34d399;
    --shadow-color: rgba(0, 0, 0, 0.4);
}

/* 3. Cyber Sapphire (Neon Dark Blue & Cyan) */
body.theme-sapphire {
    --bg-app: #090d16;
    --bg-sidebar: rgba(15, 23, 42, 0.96);
    --bg-card: rgba(15, 23, 42, 0.85);
    --bg-card-hover: rgba(30, 41, 59, 0.95);
    --bg-input: rgba(9, 13, 22, 0.75);
    --border-color: rgba(6, 182, 212, 0.18);
    --border-focus: #06b6d4;
    --text-primary: #f0fdfa;
    --text-secondary: #a5f3fc;
    --text-muted: #67e8f9;
    --accent-color: #06b6d4;
    --accent-text: #22d3ee;
    --shadow-color: rgba(0, 0, 0, 0.45);
}

/* 4. Rose Crimson (Luxury Burgundy & Rose) */
body.theme-crimson {
    --bg-app: #181119;
    --bg-sidebar: rgba(40, 25, 42, 0.96);
    --bg-card: rgba(40, 25, 42, 0.75);
    --bg-card-hover: rgba(55, 33, 58, 0.9);
    --bg-input: rgba(24, 17, 25, 0.75);
    --border-color: rgba(244, 63, 94, 0.18);
    --border-focus: #f43f5e;
    --text-primary: #fff1f2;
    --text-secondary: #fecdd3;
    --text-muted: #fda4af;
    --accent-color: #f43f5e;
    --accent-text: #fb7185;
    --shadow-color: rgba(0, 0, 0, 0.4);
}

/* 5. Clean Minimal Light */
body.theme-light {
    --bg-app: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-input: #f1f5f9;
    --border-color: #e2e8f0;
    --border-focus: #4f46e5;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --accent-color: #4f46e5;
    --accent-text: #4338ca;
    --shadow-color: rgba(0, 0, 0, 0.06);
}

/* 6. Warm Almond Latte */
body.theme-latte {
    --bg-app: #fdfbf7;
    --bg-sidebar: #fff8f0;
    --bg-card: #ffffff;
    --bg-card-hover: #fff3e6;
    --bg-input: #fff3e6;
    --border-color: #fed7aa;
    --border-focus: #ea580c;
    --text-primary: #431407;
    --text-secondary: #7c2d12;
    --text-muted: #9a3412;
    --accent-color: #ea580c;
    --accent-text: #c2410c;
    --shadow-color: rgba(67, 20, 7, 0.08);
}


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6, .khmer-text {
    font-family: var(--font-khmer);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Layout */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 2.5rem;
    color: var(--text-primary);
}

.sidebar-logo i {
    color: var(--accent-color);
    font-size: 1.5rem;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-links li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    font-family: var(--font-khmer);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-links li a:hover, .nav-links li.active a {
    background-color: rgba(99, 102, 241, 0.15);
    color: var(--accent-text);
}

.nav-links li.active a {
    border-left: 3px solid var(--accent-color);
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Theme Selector Grid */
.theme-selector-wrapper {
    padding: 10px;
    background-color: var(--border-color);
    border-radius: 12px;
}

.theme-selector-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-khmer);
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 600;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.theme-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 6px;
    border-radius: 8px;
    border: 1.5px solid transparent;
    background-color: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    font-family: var(--font-khmer);
    font-size: 0.73rem;
    font-weight: 500;
    transition: all 0.2s ease;
    justify-content: center;
}

.theme-btn:hover {
    border-color: var(--accent-color);
    transform: translateY(-1px);
}

.theme-btn.active {
    border-color: var(--accent-color);
    background-color: var(--bg-app);
    box-shadow: 0 2px 8px var(--shadow-color);
}

.theme-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.theme-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.theme-toggle i {
    font-size: 1.1rem;
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    margin-left: 280px;
    padding: 2.5rem;
    max-width: calc(100% - 280px);
}

/* Header */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.datetime-display {
    font-family: var(--font-khmer);
    font-size: 0.9rem;
    color: var(--text-secondary);
    background-color: var(--bg-card);
    padding: 8px 16px;
    border-radius: 30px;
    border: 1px solid var(--border-color);
}

/* View Sections */
.view-section {
    display: none;
    animation: fadeIn 0.4s ease-in-out forwards;
}

.view-section.active {
    display: block;
}

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

/* Cards & Layout Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background-color: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.stat-card.inflow::before { background-color: var(--color-thb-khr); }
.stat-card.outflow::before { background-color: var(--color-khr-usd); }
.stat-card.count::before { background-color: #6366f1; }

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.stat-title {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

.stat-card.inflow .stat-icon { color: var(--color-thb-khr); background-color: rgba(16, 185, 129, 0.1); }
.stat-card.outflow .stat-icon { color: var(--color-khr-usd); background-color: rgba(244, 63, 94, 0.1); }

.stat-body {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-amount {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-currency-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-khmer);
}

/* Dashboard Visual Rows */
.dashboard-row {
    display: grid;
    grid-template-columns: 2fr 1.2fr;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.dashboard-row.single {
    grid-template-columns: 1fr;
}

.chart-card, .rates-list-card, .exchange-box-card {
    background-color: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: var(--shadow-md);
}

.card-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Rates Display List Table (Signboard style) */
.rate-table-container {
    width: 100%;
    overflow-x: auto;
}

.rate-table-fancy {
    width: 100%;
    border-collapse: collapse;
}

.rate-table-fancy th {
    font-family: var(--font-khmer);
    text-align: left;
    padding: 12px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    font-size: 0.9rem;
}

.rate-table-fancy td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

.rate-table-fancy tbody tr:last-child td {
    border-bottom: none;
}

.rate-row-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
}

/* Mapping rate colors exactly to rows */
.rate-thb-khr .rate-row-indicator { background-color: var(--color-thb-khr); }
.rate-khr-thb .rate-row-indicator { background-color: var(--color-khr-thb); }
.rate-thb-usd .rate-row-indicator { background-color: var(--color-thb-usd); }
.rate-usd-thb .rate-row-indicator { background-color: var(--color-usd-thb); }
.rate-usd-khr .rate-row-indicator { background-color: var(--color-usd-khr); }
.rate-khr-usd .rate-row-indicator { background-color: var(--color-khr-usd); }

.rate-badge {
    font-family: var(--font-khmer);
    padding: 4px 10px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Multi-Provider Auto Update Toolbar */
.provider-buttons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
    margin-top: 8px;
}

.btn-provider {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font-khmer);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-provider:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color);
    border-color: var(--accent-color);
}

.btn-provider-nbc { border-left: 4px solid #10b981; }
.btn-provider-aba { border-left: 4px solid #0284c7; }
.btn-provider-acleda { border-left: 4px solid #f59e0b; }
.btn-provider-world { border-left: 4px solid #8b5cf6; }

.btn-provider:hover.btn-provider-nbc { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.btn-provider:hover.btn-provider-aba { background: rgba(2, 132, 199, 0.15); color: #38bdf8; }
.btn-provider:hover.btn-provider-acleda { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.btn-provider:hover.btn-provider-world { background: rgba(139, 92, 246, 0.15); color: #c084fc; }

.rate-thb-khr .rate-badge { background-color: rgba(16, 185, 129, 0.1); color: var(--color-thb-khr); }
.rate-khr-thb .rate-badge { background-color: rgba(251, 191, 36, 0.1); color: var(--color-khr-thb); }
.rate-thb-usd .rate-badge { background-color: rgba(168, 162, 158, 0.1); color: #a8a29e; }
.rate-usd-thb .rate-badge { background-color: rgba(6, 182, 212, 0.1); color: var(--color-usd-thb); }
.rate-usd-khr .rate-badge { background-color: rgba(244, 63, 94, 0.1); color: var(--color-usd-khr); }
.rate-khr-usd .rate-badge { background-color: rgba(249, 115, 22, 0.1); color: var(--color-khr-usd); }

.rate-display-val {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

/* Calculator Card & Form Grid */
.exchange-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

/* Clickable Rate Selector Cards (ប្រអប់ចុច) */
.rate-selector-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 8px;
}

.rate-card-item {
    background-color: rgba(15, 23, 42, 0.6);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    user-select: none;
}

.rate-card-item:hover {
    border-color: #6366f1;
    background-color: rgba(99, 102, 241, 0.08);
    transform: translateY(-2px);
}

.rate-card-item.active {
    border-color: #6366f1;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.22) 0%, rgba(129, 140, 248, 0.12) 100%);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
}

.rate-card-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #ffffff;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.badge-thb-khr { background-color: var(--color-thb-khr); }
.badge-khr-thb { background-color: var(--color-khr-thb); }
.badge-thb-usd { background-color: var(--color-thb-usd); }
.badge-usd-thb { background-color: var(--color-usd-thb); }
.badge-usd-khr { background-color: var(--color-usd-khr); }
.badge-khr-usd { background-color: var(--color-khr-usd); }

.rate-card-content {
    flex: 1;
    min-width: 0;
}

.rate-card-title {
    font-family: var(--font-khmer);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rate-card-code {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.rate-card-check {
    font-size: 1.1rem;
    color: #6366f1;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.rate-card-item.active .rate-card-check {
    opacity: 1;
    transform: scale(1);
}

.form-group label {
    display: block;
    font-family: var(--font-khmer);
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    background-color: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1.05rem;
    outline: none;
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.form-control.output-field {
    background-color: rgba(15, 23, 42, 0.3);
    font-weight: 700;
    color: #818cf8;
}

.calculator-preview {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 15px;
}

.preview-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-label {
    font-family: var(--font-khmer);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.preview-val {
    font-weight: 700;
    font-size: 1.25rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 10px;
    font-family: var(--font-khmer);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    width: 100%;
}

.btn-primary {
    background-color: #6366f1;
    color: #ffffff;
}

.btn-primary:hover {
    background-color: #4f46e5;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--border-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.btn-danger {
    background-color: rgba(244, 63, 94, 0.1);
    color: #f43f5e;
    border: 1px solid rgba(244, 63, 94, 0.2);
}

.btn-danger:hover {
    background-color: #f43f5e;
    color: #ffffff;
}

/* Reports Styles */
.report-filters-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 15px;
    margin-bottom: 2rem;
    background-color: var(--bg-card);
    padding: 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.filter-inputs {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-grow: 1;
}

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

.filter-group label {
    font-family: var(--font-khmer);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.filter-select, .filter-date {
    padding: 10px 14px;
    background-color: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    outline: none;
    font-family: var(--font-khmer);
}

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

.btn-action {
    width: auto;
    padding: 10px 18px;
    font-size: 0.85rem;
}

/* Tables general */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    font-family: var(--font-khmer);
    background-color: rgba(15, 23, 42, 0.3);
    padding: 14px 16px;
    text-align: left;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

.data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.currency-cell {
    font-weight: 600;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background-color: #1e293b;
    border-left: 4px solid #6366f1;
    color: #f8fafc;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    font-family: var(--font-khmer);
    font-size: 0.9rem;
}

.toast.show {
    transform: translateX(0);
}

.toast.success { border-left-color: #10b981; }
.toast.error { border-left-color: #f43f5e; }
.toast.info { border-left-color: #3b82f6; }

/* Rate config grid */
.rates-config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.rate-config-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.rate-config-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 100%;
}

.rate-config-card.thb_khr::after { background-color: var(--color-thb-khr); }
.rate-config-card.khr_thb::after { background-color: var(--color-khr-thb); }
.rate-config-card.thb_usd::after { background-color: var(--color-thb-usd); }
.rate-config-card.usd_thb::after { background-color: var(--color-usd-thb); }
.rate-config-card.usd_khr::after { background-color: var(--color-usd-khr); }
.rate-config-card.khr_usd::after { background-color: var(--color-khr-usd); }

.rate-config-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.rate-config-title h4 {
    font-size: 1.05rem;
    font-weight: 600;
}

/* Print Styles */
@media print {
    .sidebar, .header-bar, .report-filters-bar, .toast-container, .btn-danger, .theme-toggle {
        display: none !important;
    }
    
    body {
        background-color: #ffffff !important;
        color: #000000 !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
        max-width: 100% !important;
    }
    
    .table-responsive {
        box-shadow: none !important;
        border: none !important;
    }
    
    .data-table th {
        background-color: #f1f5f9 !important;
        color: #000000 !important;
        border-bottom: 2px solid #000000 !important;
    }
    
    .data-table td {
        border-bottom: 1px solid #e2e8f0 !important;
        color: #000000 !important;
    }
}

/* ==========================================================================
   MOBILE & RESPONSIVE STYLES
   ========================================================================== */

.mobile-header-bar {
    display: none;
}

.mobile-bottom-nav {
    display: none;
}

.sidebar-overlay {
    display: none;
}

@media (max-width: 1024px) {
    .sidebar {
        width: 75px;
        padding: 1.5rem 0.5rem;
        align-items: center;
    }
    
    .sidebar-logo span, .nav-links li a span, .sidebar-footer {
        display: none !important;
    }
    
    .nav-links li a {
        padding: 12px;
        justify-content: center;
    }
    
    .main-content {
        margin-left: 75px;
        max-width: calc(100% - 75px);
    }
    
    .dashboard-row {
        grid-template-columns: 1fr;
    }
    
    .exchange-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile Layout (< 768px) */
@media (max-width: 768px) {
    .mobile-header-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 60px;
        background-color: var(--bg-sidebar);
        border-bottom: 1px solid var(--border-color);
        padding: 0 1rem;
        z-index: 99;
        backdrop-filter: blur(10px);
    }

    .mobile-icon-btn {
        width: 40px;
        height: 40px;
        border-radius: 10px;
        border: 1px solid var(--border-color);
        background-color: var(--bg-card);
        color: var(--text-primary);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
        cursor: pointer;
    }

    .mobile-app-title {
        display: flex;
        align-items: center;
        gap: 8px;
        font-family: var(--font-khmer);
        font-weight: 700;
        font-size: 1.05rem;
        color: var(--text-primary);
    }

    /* Mobile Bottom Navigation Bar */
    .mobile-bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 65px;
        background-color: var(--bg-sidebar);
        border-top: 1px solid var(--border-color);
        z-index: 99;
        backdrop-filter: blur(15px);
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        color: var(--text-muted);
        text-decoration: none;
        font-family: var(--font-khmer);
        font-size: 0.72rem;
        width: 20%;
        height: 100%;
        transition: all 0.2s ease;
    }

    .mobile-nav-item i {
        font-size: 1.2rem;
    }

    .mobile-nav-item.active, .mobile-nav-item:hover {
        color: var(--accent-color);
    }

    /* Mobile Drawer Sidebar */
    .sidebar {
        position: fixed;
        top: 0;
        left: -300px;
        width: 280px;
        height: 100vh;
        z-index: 200;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 10px 0 25px rgba(0, 0, 0, 0.5);
    }

    .sidebar.mobile-open {
        left: 0;
    }

    .sidebar-logo span, .nav-links li a span, .sidebar-footer {
        display: flex !important;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background-color: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        z-index: 150;
        display: none;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Main Content adjustment */
    .main-content {
        margin-left: 0 !important;
        max-width: 100% !important;
        padding: 75px 1rem 85px 1rem !important;
    }

    .header-bar {
        margin-bottom: 1.5rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .page-title {
        font-size: 1.35rem;
    }

    /* Grid layout adjustments */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .dashboard-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .exchange-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .rate-selector-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .provider-buttons-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .rates-config-grid {
        grid-template-columns: 1fr;
    }

    .filter-inputs {
        flex-direction: column;
        align-items: stretch;
    }

    .report-filters-bar {
        align-items: stretch;
    }

    /* Toast notification position */
    .toast-container {
        bottom: 75px;
        right: 15px;
        left: 15px;
    }

    .toast {
        min-width: unset;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .rate-selector-grid {
        grid-template-columns: 1fr;
    }

    .provider-buttons-grid {
        grid-template-columns: 1fr;
    }

    .stat-amount {
        font-size: 1.1rem;
    }
}


/* Login Page Specific Styling */
body.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at 10% 20%, rgb(15, 23, 42) 0%, rgb(30, 41, 59) 90%);
    min-height: 100vh;
    padding: 1.5rem;
}

.login-container {
    width: 100%;
    max-width: 460px;
    animation: fadeIn 0.5s ease-out forwards;
}

.login-card {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 3rem 2.5rem;
    box-shadow: var(--shadow-xl), 0 0 40px rgba(99, 102, 241, 0.1);
}

body.light-theme.login-page {
    background: radial-gradient(circle at 10% 20%, #f1f5f9 0%, #cbd5e1 90%);
}

body.light-theme .login-card {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow: var(--shadow-xl), 0 0 40px rgba(99, 102, 241, 0.05);
}

.login-logo {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-logo i {
    font-size: 3rem;
    color: #6366f1;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.4));
}

.login-logo h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-logo p {
    font-family: var(--font-khmer);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.login-hints {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px dashed var(--border-color);
    font-family: var(--font-khmer);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.login-hints code {
    background-color: var(--border-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-primary);
    color: #818cf8;
}

/* Cloudflare Turnstile CAPTCHA Widget Styling */
#cf-turnstile-container {
    margin: 1.25rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

#cf-turnstile-container iframe {
    max-width: 100%;
}
