/* Dark Mode Global Styles */
[data-theme="dark"] {
  /* Background Colors */
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-card: rgba(30, 30, 46, 0.95);
  
  /* Text Colors */
  --text-primary: #e0e7ef;
  --text-secondary: #94a3b8;
  
  /* Header */
  --header-bg: #0f1419;
  --header-text: #e0e7ef;
  
  /* Borders & Shadows */
  --border-color: #2d3748;
  --shadow-sm: 0 2px 12px rgba(0,0,0,0.5);
  --shadow-md: 0 8px 20px -3px rgba(0,0,0,0.4);
  
  /* Gradients */
  --gradient-main: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f1419 100%);
  
  /* Link Hover */
  --link-hover: #60a5fa;
}

/* Body & Main Elements */
[data-theme="dark"] body {
  background: var(--gradient-main);
  color: var(--text-primary);
}

/* Cards */
[data-theme="dark"] .card,
[data-theme="dark"] .dashboard-card,
[data-theme="dark"] .status-card,
[data-theme="dark"] .daily-plan-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
}

[data-theme="dark"] .card-title {
  color: var(--text-primary);
}

/* Dashboard */
[data-theme="dark"] .dashboard-label {
  color: var(--text-secondary);
}

[data-theme="dark"] .dashboard-value {
  color: var(--text-primary);
}

[data-theme="dark"] .dashboard-card.status-success .dashboard-value {
  color: #4ade80;
}

[data-theme="dark"] .dashboard-card.status-danger .dashboard-value {
  color: #ef4444;
}

[data-theme="dark"] .dashboard-card.status-info .dashboard-value {
  color: #60a5fa;
}

[data-theme="dark"] .dashboard-card.status-warning .dashboard-value {
  color: #fbbf24;
}

/* Form Controls - Universal Input Styling (All Pages) */
[data-theme="dark"] .form-control,
[data-theme="dark"] .input,
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] textarea,
[data-theme="dark"] select,
[data-theme="dark"] .category-card input,
[data-theme="dark"] .category-card select {
  background: #1e293b !important;
  border: 1.5px solid #334155 !important;
  color: #e0e7ef !important;
  transition: all 0.2s ease !important;
  backdrop-filter: none !important;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .input:focus,
[data-theme="dark"] input[type="text"]:focus,
[data-theme="dark"] input[type="number"]:focus,
[data-theme="dark"] input[type="date"]:focus,
[data-theme="dark"] input[type="password"]:focus,
[data-theme="dark"] input[type="email"]:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] .category-card input:focus,
[data-theme="dark"] .category-card select:focus {
  background: #0f172a !important;
  border-color: #60a5fa !important;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1) !important;
  outline: none !important;
}

[data-theme="dark"] .form-control::placeholder,
[data-theme="dark"] .input::placeholder,
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: #64748b !important;
}

/* Buttons */
[data-theme="dark"] .footer-btn {
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .footer-btn.income-btn {
  background: linear-gradient(90deg, #1e3a28 70%, #1a4d2e 100%);
  color: #4ade80;
  border-color: #4ade80;
}

[data-theme="dark"] .footer-btn.income-btn:hover {
  background: #22543d;
  color: #d1fae5;
}

[data-theme="dark"] .footer-btn.info {
  background: linear-gradient(90deg, #1e2a3a 70%, #1e3a5f 100%);
  color: #60a5fa;
  border-color: #60a5fa;
}

[data-theme="dark"] .footer-btn.info:hover {
  background: #1e3a8a;
  color: #dbeafe;
}

[data-theme="dark"] .footer-btn.danger {
  background: linear-gradient(90deg, #3a1e1e 70%, #4d1a1a 100%);
  color: #ef4444;
  border-color: #ef4444;
}

[data-theme="dark"] .footer-btn.danger:hover {
  background: #7f1d1d;
  color: #fee2e2;
}

/* Footer Bar */
[data-theme="dark"] .footer-bar {
  background: #0f1419;
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -2px 8px rgba(0,0,0,0.5);
}

/* Compare Form */
[data-theme="dark"] .compare-date {
  background: #1e293b;
  border: 1.5px solid #334155;
  color: #e0e7ef;
  transition: all 0.2s ease;
}

[data-theme="dark"] .compare-date:focus {
  background: #0f172a;
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
  outline: none;
}

[data-theme="dark"] .compare-btn {
  background: #fbbf24;
  color: #1a1a2e;
}

[data-theme="dark"] .compare-btn:hover {
  background: #f59e0b;
}

[data-theme="dark"] .compare-row {
  background: #1e293b;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* Modal */
[data-theme="dark"] .modal {
  background: rgba(0, 0, 0, 0.8);
}

[data-theme="dark"] .modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .modal-content h2 {
  color: var(--text-primary);
}

[data-theme="dark"] .modal-content label {
  color: var(--text-secondary);
}

[data-theme="dark"] .close {
  color: var(--text-secondary);
}

[data-theme="dark"] .close:hover {
  color: var(--text-primary);
}

/* Amount Suggestions */
[data-theme="dark"] .amount-suggest-item {
  background: #1e293b;
  border-color: var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] .modal-content.income-modal .amount-suggest-item {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.3);
}

[data-theme="dark"] .modal-content.income-modal .amount-suggest-item:hover {
  background: #1e3a28;
  color: #86efac;
}

[data-theme="dark"] .modal-content.expense-modal .amount-suggest-item {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .modal-content.expense-modal .amount-suggest-item:hover {
  background: #3a1e1e;
  color: #fca5a5;
}

[data-theme="dark"] .modal-content.saving-modal .amount-suggest-item {
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.3);
}

[data-theme="dark"] .modal-content.saving-modal .amount-suggest-item:hover {
  background: #1e2a3a;
  color: #93c5fd;
}

/* Tables */
[data-theme="dark"] table {
  background: var(--bg-card);
}

[data-theme="dark"] th {
  background: #1e293b;
  color: var(--text-primary);
  border-bottom-color: var(--border-color);
}

[data-theme="dark"] td {
  border-bottom-color: var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] tr:hover {
  background: #1e293b;
}

/* SweetAlert2 Dark Mode */
[data-theme="dark"] .swal2-popup {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

[data-theme="dark"] .swal2-title {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .swal2-html-container {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .swal2-confirm {
  background: #60a5fa !important;
}

[data-theme="dark"] .swal2-cancel {
  background: #374151 !important;
  color: var(--text-primary) !important;
}

/* Empty State */
[data-theme="dark"] .empty-future-text {
  color: var(--text-secondary);
}

[data-theme="dark"] .empty-future-text span {
  color: var(--text-primary);
}

/* Specific Page Overrides */
[data-theme="dark"] .category-card,
[data-theme="dark"] .history-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
}

[data-theme="dark"] .category-card h2,
[data-theme="dark"] .category-card h3,
[data-theme="dark"] .history-card h2 {
  color: var(--text-primary);
  border-bottom-color: var(--border-color);
}

[data-theme="dark"] .category-card label {
  color: var(--text-secondary);
}

[data-theme="dark"] .category-btn,
[data-theme="dark"] .btn-primary {
  background: linear-gradient(90deg, #60a5fa 0%, #3b82f6 100%);
}

[data-theme="dark"] .category-btn:hover,
[data-theme="dark"] .btn-primary:hover {
  background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
}

/* Category Table - Dark Mode (เหมือน Need Spend Money) */
[data-theme="dark"] .category-table {
  background: transparent !important;
  border: 1px solid #334155 !important;
  border-collapse: collapse !important;
}

[data-theme="dark"] .category-table thead tr,
[data-theme="dark"] .category-table tr:first-child {
  background: #1a2332 !important;
}

[data-theme="dark"] .category-table th {
  background: #1a2332 !important;
  color: #e0e7ef !important;
  border-bottom: 2px solid #334155 !important;
  padding: 8px 4px !important;
  font-weight: 600 !important;
}

[data-theme="dark"] .category-table tbody tr,
[data-theme="dark"] .category-table tr:not(:first-child) {
  background: transparent !important;
  transition: background 0.2s ease;
}

[data-theme="dark"] .category-table td {
  background: transparent !important;
  border-bottom: 1px solid #2d3748 !important;
  color: #cbd5e1 !important;
  padding: 6px 4px !important;
}

[data-theme="dark"] .category-table tr:hover,
[data-theme="dark"] .category-table tbody tr:hover,
[data-theme="dark"] .category-table tr:not(:first-child):hover {
  background: rgba(96, 165, 250, 0.08) !important;
}

/* Override any white background from base styles */
[data-theme="dark"] .category-table tr:not(:first-child) td {
  background-color: transparent !important;
}

/* Alert Messages */
[data-theme="dark"] .alert {
  background: #1e293b;
  border-color: var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] .alert-warning {
  background: rgba(251, 191, 36, 0.1);
  border-color: #fbbf24;
  color: #fde68a;
}

[data-theme="dark"] .alert-info {
  background: rgba(96, 165, 250, 0.1);
  border-color: #60a5fa;
  color: #bfdbfe;
}

[data-theme="dark"] .alert-success {
  background: rgba(74, 222, 128, 0.1);
  border-color: #4ade80;
  color: #bbf7d0;
}

[data-theme="dark"] .alert-danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
  color: #fecaca;
}

/* Status Colors */
[data-theme="dark"] .amount-negative {
  color: #ef4444 !important;
}

[data-theme="dark"] .text-green {
  color: #4ade80 !important;
}

[data-theme="dark"] .text-red {
  color: #ef4444 !important;
}

[data-theme="dark"] .text-blue {
  color: #60a5fa !important;
}

/* Scrollbar */
[data-theme="dark"] ::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
  background: #1e293b;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 5px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* ========================================
   HISTORY PAGE - DARK MODE (เหมือน Home)
   ======================================== */

/* Stat Cards - เหมือน Dashboard Cards ใน Home */
[data-theme="dark"] .stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
}

[data-theme="dark"] .stat-header {
  color: var(--text-primary);
  border-bottom-color: var(--border-color);
}

/* Stat Items - เหมือน Dashboard Items */
[data-theme="dark"] .stat-item {
  background: #1e293b;
  border: 1px solid #334155;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

[data-theme="dark"] .stat-item::before {
  opacity: 0.8;
}

[data-theme="dark"] .stat-label {
  color: #94a3b8;
}

[data-theme="dark"] .stat-value {
  color: #60a5fa;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .stat-item.success .stat-value {
  color: #4ade80;
}

[data-theme="dark"] .stat-item.warning .stat-value {
  color: #fbbf24;
}

[data-theme="dark"] .stat-item.danger .stat-value {
  color: #ef4444;
}

[data-theme="dark"] .stat-note {
  color: #94a3b8;
}

/* Chart Container */
[data-theme="dark"] .chart-container {
  background: transparent;
}

/* Recommendations */
[data-theme="dark"] .recommendation-item {
  background: #1e293b;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

[data-theme="dark"] .recommendation-item:hover {
  background: #1e3a50;
}

[data-theme="dark"] .recommendation-item.warning {
  background: rgba(251, 191, 36, 0.1);
  border-left-color: #fbbf24;
}

[data-theme="dark"] .recommendation-item.success {
  background: rgba(74, 222, 128, 0.1);
  border-left-color: #4ade80;
}

[data-theme="dark"] .recommendation-item.info {
  background: rgba(96, 165, 250, 0.1);
  border-left-color: #60a5fa;
}

[data-theme="dark"] .recommendation-item.goal {
  background: rgba(236, 72, 153, 0.1);
  border-left-color: #ec4899;
}

[data-theme="dark"] .recommendation-icon {
  filter: brightness(1.2);
}

[data-theme="dark"] .recommendation-item span {
  color: #e0e7ef;
}

/* Health Score */
[data-theme="dark"] .health-score {
  color: #e0e7ef;
}

[data-theme="dark"] .health-score-circle {
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

/* Modal - History Page */
[data-theme="dark"] .history-modal {
  background: rgba(0, 0, 0, 0.8);
}

[data-theme="dark"] .modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  color: #e0e7ef;
}

[data-theme="dark"] .modal-content h2,
[data-theme="dark"] .modal-content h3 {
  color: var(--text-primary);
}

[data-theme="dark"] .modal-close {
  color: #94a3b8;
}

[data-theme="dark"] .modal-close:hover {
  color: var(--text-primary);
}

/* History Buttons */
[data-theme="dark"] .history-btn {
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  color: #e0e7ef;
}

[data-theme="dark"] .history-btn:hover {
  box-shadow: 0 6px 16px rgba(0,0,0,0.7);
}

/* Table in History Modal */
[data-theme="dark"] .modal-content table {
  background: transparent;
}

[data-theme="dark"] .modal-content table th {
  background: #1e293b;
  color: #e0e7ef;
  border-bottom-color: #334155;
}

[data-theme="dark"] .modal-content table td {
  border-bottom-color: #334155;
  color: #cbd5e1;
}

[data-theme="dark"] .modal-content table tr:hover {
  background: #1e293b;
}

/* Summary Box in Modal (ລາຍຈ່າຍລວມ, ທ້ອນລວມ, etc.) */
[data-theme="dark"] .modal-content div[style*="background: #f8fbfd"],
[data-theme="dark"] .modal-content div[style*="background:#f8fbfd"],
[data-theme="dark"] .modal-content div[style*="background: #f0f9ff"],
[data-theme="dark"] .modal-content div[style*="background:#f0f9ff"],
[data-theme="dark"] .modal-content div[style*="background: #fef2f2"],
[data-theme="dark"] .modal-content div[style*="background:#fef2f2"],
[data-theme="dark"] .modal-content div[style*="background: #f0fdf4"],
[data-theme="dark"] .modal-content div[style*="background:#f0fdf4"],
[data-theme="dark"] .modal-content div[style*="background: #ecfdf5"],
[data-theme="dark"] .modal-content div[style*="background:#ecfdf5"],
[data-theme="dark"] #summaryBox {
  background: #1e293b !important;
  border: 1px solid #334155 !important;
}

[data-theme="dark"] .modal-content div[style*="background: #f8fbfd"] div,
[data-theme="dark"] .modal-content div[style*="background:#f8fbfd"] div,
[data-theme="dark"] .modal-content div[style*="background: #f0f9ff"] div,
[data-theme="dark"] .modal-content div[style*="background:#f0f9ff"] div,
[data-theme="dark"] .modal-content div[style*="background: #fef2f2"] div,
[data-theme="dark"] .modal-content div[style*="background:#fef2f2"] div,
[data-theme="dark"] .modal-content div[style*="background: #f0fdf4"] div,
[data-theme="dark"] .modal-content div[style*="background:#f0fdf4"] div,
[data-theme="dark"] .modal-content div[style*="background: #ecfdf5"] div,
[data-theme="dark"] .modal-content div[style*="background:#ecfdf5"] div,
[data-theme="dark"] #summaryBox div,
[data-theme="dark"] #summaryBox div[style*="color: #2e506b"],
[data-theme="dark"] #summaryBox div[style*="color:#2e506b"] {
  color: #e0e7ef !important;
}

[data-theme="dark"] .modal-content div[style*="background: #f8fbfd"] span,
[data-theme="dark"] .modal-content div[style*="background:#f8fbfd"] span,
[data-theme="dark"] .modal-content div[style*="background: #f0f9ff"] span,
[data-theme="dark"] .modal-content div[style*="background:#f0f9ff"] span,
[data-theme="dark"] .modal-content div[style*="background: #fef2f2"] span,
[data-theme="dark"] .modal-content div[style*="background:#fef2f2"] span,
[data-theme="dark"] .modal-content div[style*="background: #f0fdf4"] span,
[data-theme="dark"] .modal-content div[style*="background:#f0fdf4"] span,
[data-theme="dark"] .modal-content div[style*="background: #ecfdf5"] span,
[data-theme="dark"] .modal-content div[style*="background:#ecfdf5"] span,
[data-theme="dark"] #summaryLabel,
[data-theme="dark"] #summaryCount {
  color: #cbd5e1 !important;
}

/* Summary Value - แปลงสีตามประเภท (สีของใครของมัน) */
/* ต้องใช้ RGB hex format ที่ JavaScript ตั้งค่าไว้ */

/* 💰 รายรับ - สีเขียว (Income) */
[data-theme="dark"] .modal-content #summaryValue[style*="color: rgb(25, 135, 84)"],
[data-theme="dark"] .modal-content span#summaryValue[style*="color: rgb(25, 135, 84)"],
[data-theme="dark"] .modal-content #summaryValue[style*="color:#198754"],
[data-theme="dark"] .modal-content span#summaryValue[style*="color:#198754"],
[data-theme="dark"] .modal-content #summaryValue[style*="color: #198754"],
[data-theme="dark"] .modal-content span#summaryValue[style*="color: #198754"] {
  color: #4ade80 !important;
}

/* 💸 รายจ่าย - สีแดง (Expense) */
[data-theme="dark"] .modal-content #summaryValue[style*="color: rgb(179, 0, 0)"],
[data-theme="dark"] .modal-content span#summaryValue[style*="color: rgb(179, 0, 0)"],
[data-theme="dark"] .modal-content #summaryValue[style*="color:#b30000"],
[data-theme="dark"] .modal-content span#summaryValue[style*="color:#b30000"],
[data-theme="dark"] .modal-content #summaryValue[style*="color: #b30000"],
[data-theme="dark"] .modal-content span#summaryValue[style*="color: #b30000"] {
  color: #ef4444 !important;
}

/* 🏦 การออม - สีน้ำเงิน (Saving) */
[data-theme="dark"] .modal-content #summaryValue[style*="color: rgb(25, 118, 210)"],
[data-theme="dark"] .modal-content span#summaryValue[style*="color: rgb(25, 118, 210)"],
[data-theme="dark"] .modal-content #summaryValue[style*="color:#1976d2"],
[data-theme="dark"] .modal-content span#summaryValue[style*="color:#1976d2"],
[data-theme="dark"] .modal-content #summaryValue[style*="color: #1976d2"],
[data-theme="dark"] .modal-content span#summaryValue[style*="color: #1976d2"] {
  color: #60a5fa !important;
}

/* Transaction Details */
[data-theme="dark"] .transaction-note {
  color: #94a3b8;
  font-style: italic;
}

/* Summary Cards in Modal */
[data-theme="dark"] .summary-card {
  background: #1e293b;
  border: 1px solid #334155;
}

/* Date Range Display */
[data-theme="dark"] .date-range {
  color: #94a3b8;
}

/* Empty State */
[data-theme="dark"] .empty-state {
  color: #64748b;
}

[data-theme="dark"] .empty-state-icon {
  opacity: 0.3;
}

/* Section Divider */
[data-theme="dark"] hr {
  border-color: #334155;
  opacity: 0.5;
}

/* Legend Items */
[data-theme="dark"] .legend-item {
  color: #cbd5e1;
}

/* Progress Bars */
[data-theme="dark"] .progress-bar-bg {
  background: #1e293b;
}

[data-theme="dark"] .progress-bar-fill {
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Stat Grid Layout */
[data-theme="dark"] .stat-grid {
  gap: 1.5em;
}

/* Hot Days / Pattern Cards */
[data-theme="dark"] .hot-day-card,
[data-theme="dark"] .pattern-card {
  background: #1e293b !important;
  border: 1px solid #334155 !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important;
}

[data-theme="dark"] .hot-day-card h4,
[data-theme="dark"] .pattern-card h4 {
  color: #e0e7ef !important;
}

[data-theme="dark"] .hot-day-card .percentage,
[data-theme="dark"] .pattern-card .percentage {
  color: #e0e7ef !important;
}

[data-theme="dark"] .hot-day-card .amount,
[data-theme="dark"] .pattern-card .amount {
  color: #cbd5e1 !important;
}

/* Max Expense Day Item */
[data-theme="dark"] .max-expense-item,
[data-theme="dark"] .expense-day-item {
  background: #1e293b !important;
  border: 1px solid #334155 !important;
  color: #cbd5e1 !important;
}

[data-theme="dark"] .max-expense-item strong,
[data-theme="dark"] .expense-day-item strong {
  color: #e0e7ef !important;
}

/* Warning Box / Alert Box */
[data-theme="dark"] .warning-box,
[data-theme="dark"] .alert-box {
  background: rgba(251, 191, 36, 0.15) !important;
  border: 1px solid #fbbf24 !important;
  color: #fde68a !important;
}

/* Chart Legend */
[data-theme="dark"] .chart-legend {
  color: #cbd5e1 !important;
}

[data-theme="dark"] .chart-legend span {
  color: #e0e7ef !important;
}

/* Pattern Cards with inline styles (History Page) */
[data-theme="dark"] div[style*="background: #f9fafb"],
[data-theme="dark"] div[style*="background:#f9fafb"] {
  background: #1e293b !important;
  border: 1px solid #334155 !important;
}

[data-theme="dark"] div[style*="background: #f9fafb"] div,
[data-theme="dark"] div[style*="background:#f9fafb"] div {
  color: #e0e7ef !important;
}

[data-theme="dark"] div[style*="color: #666"],
[data-theme="dark"] div[style*="color:#666"],
[data-theme="dark"] span[style*="color: #666"],
[data-theme="dark"] span[style*="color:#666"] {
  color: #94a3b8 !important;
}

/* Warning Box with inline styles */
[data-theme="dark"] div[style*="background: #fef3c7"],
[data-theme="dark"] div[style*="background:#fef3c7"] {
  background: rgba(251, 191, 36, 0.15) !important;
  border-left-color: #fbbf24 !important;
  color: #fde68a !important;
}

/* Hot Days Text */
[data-theme="dark"] div[style*="font-weight: 600"] {
  color: #e0e7ef !important;
}

/* Empty State Text */
[data-theme="dark"] div[style*="color: #888"] {
  color: #64748b !important;
}

/* Category Item Background */
[data-theme="dark"] div[style*="background: #fff"],
[data-theme="dark"] div[style*="background:#fff"],
[data-theme="dark"] div[style*="background: white"],
[data-theme="dark"] div[style*="background:white"] {
  background: #1e293b !important;
  border: 1px solid #334155 !important;
}

/* Progress Bar Container */
[data-theme="dark"] div[style*="background: #e5e7eb"] {
  background: #334155 !important;
}

/* Border Colors */
[data-theme="dark"] .status-success {
  border-left-color: #4ade80;
}

[data-theme="dark"] .status-warning {
  border-left-color: #fbbf24;
}

[data-theme="dark"] .status-danger {
  border-left-color: #ef4444;
}

[data-theme="dark"] .status-info {
  border-left-color: #60a5fa;
}

/* Hamburger Menu */
[data-theme="dark"] .hamburger {
  background: #1e293b;
}

[data-theme="dark"] .hamburger span {
  background: var(--text-primary);
}

[data-theme="dark"] .header-links {
  background: var(--bg-card);
}

[data-theme="dark"] .header-overlay.show {
  background: rgba(0, 0, 0, 0.8);
}

/* ========================================
   BORROW MONEY PAGE - DARK MODE
   ======================================== */

/* Status Items */
[data-theme="dark"] .status-item {
  background: #1e293b;
  border: 1px solid #334155;
}

[data-theme="dark"] .status-item.success {
  background: rgba(74, 222, 128, 0.1);
  border-color: #4ade80;
}

[data-theme="dark"] .status-item.warning {
  background: rgba(251, 191, 36, 0.1);
  border-color: #fbbf24;
}

[data-theme="dark"] .status-label {
  color: #94a3b8;
}

[data-theme="dark"] .status-value {
  color: #e0e7ef;
}

[data-theme="dark"] .status-item.success .status-value {
  color: #4ade80;
}

[data-theme="dark"] .status-item.warning .status-value {
  color: #fbbf24;
}

/* Form Elements - Borrow Money Page (Removed - using universal styles above) */
[data-theme="dark"] .form-group {
  color: #e0e7ef;
}

[data-theme="dark"] .form-label {
  color: #94a3b8;
}

/* Buttons */
[data-theme="dark"] .btn-primary {
  background: linear-gradient(90deg, #60a5fa 0%, #3b82f6 100%);
  color: #0f172a;
  font-weight: 700;
}

[data-theme="dark"] .btn-primary:hover {
  background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
}

[data-theme="dark"] .btn-primary:active {
  background: #1e40af;
}

/* History Table */
[data-theme="dark"] .history-table {
  background: var(--bg-card);
  border: 1px solid #334155;
}

[data-theme="dark"] .history-table th {
  background: #1e293b;
  color: #e0e7ef;
  border-bottom: 2px solid #334155;
}

[data-theme="dark"] .history-table td {
  border-bottom: 1px solid #334155;
  color: #e0e7ef;
}

[data-theme="dark"] .history-table tr:hover {
  background: #1e293b;
}

[data-theme="dark"] .amount-negative {
  color: #ef4444 !important;
  font-weight: 700;
}

/* Amount Format Display */
[data-theme="dark"] .amount-format {
  background: #0f172a;
  color: #e0e7ef;
}

/* Status Grid */
[data-theme="dark"] .status-grid {
  gap: 1em;
}

/* Card Title in Borrow Page */
[data-theme="dark"] .card-title {
  color: #e0e7ef;
  border-bottom-color: #334155;
}

/* Alert Messages in Borrow Page */
[data-theme="dark"] .alert {
  background: #1e293b;
  border: 1px solid #334155;
  color: #e0e7ef;
}

[data-theme="dark"] .alert-warning {
  background: rgba(251, 191, 36, 0.1);
  border-color: #fbbf24;
  color: #fde68a;
}

[data-theme="dark"] .alert-info {
  background: rgba(96, 165, 250, 0.1);
  border-color: #60a5fa;
  color: #bfdbfe;
}

/* Container for Borrow Money Page */
[data-theme="dark"] .container {
  color: #e0e7ef;
}

/* Improve contrast for numbers */
[data-theme="dark"] .status-value,
[data-theme="dark"] .history-table td:first-child,
[data-theme="dark"] .history-table td:nth-child(2) {
  font-weight: 600;
}

/* Better visibility for form validation */
[data-theme="dark"] .form-control:invalid {
  border-color: #ef4444;
}

[data-theme="dark"] .form-control:valid {
  border-color: #4ade80;
}

/* Status Icons/Emojis Brightness */
[data-theme="dark"] .status-item.success::before,
[data-theme="dark"] .status-item.warning::before {
  filter: brightness(1.2);
}

/* Borrow Money - Enhanced Typography */
[data-theme="dark"] .status-value {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Borrow Money - Form Group */
[data-theme="dark"] .form-group label {
  color: #94a3b8;
}

/* Note: All input styles are now unified under "Form Controls - Universal Input Styling" section */

/* Borrow Money - Table Empty State */
[data-theme="dark"] .history-table tbody tr td {
  color: #cbd5e1;
}

/* Borrow Money - Highlight Important Numbers */
[data-theme="dark"] .status-value,
[data-theme="dark"] .amount-format {
  font-weight: 700;
  letter-spacing: 0.5px;
}
