@import url('https://fonts.googleapis.com/css2?family=Almarai:wght@300;400;700;800&family=Inter:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #8b5cf6;
  --primary-light: #a78bfa;
  --primary-glow: rgba(139, 92, 246, 0.5);
  --secondary: #ec4899;
  --accent: #06b6d4;
  --background: #000000;
  --surface: rgba(15, 23, 42, 0.8);
  --surface-border: rgba(255, 255, 255, 0.05);
  --text-main: #ffffff;
  --text-muted: #94a3b8;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --glass: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.1);
  --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
}

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

body {
  font-family: 'Almarai', 'Inter', sans-serif;
  background-color: var(--background);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(236, 72, 153, 0.1) 0%, transparent 40%);
  line-height: 1.6;
}

h1,
h2,
h3,
h4,
button,
input,
select,
textarea {
  font-family: 'Almarai', sans-serif !important;
}

.app-container {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100vh;
}

.mobile-menu-btn {
  display: none;
}

.sidebar-close-btn {
  display: none;
  /* Hidden on Desktop */
}

/* Sidebar Styling */
aside {
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--surface-border);
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

nav ul {
  list-style: none;
}

nav li {
  margin-bottom: 0.5rem;
}

nav a {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 1.25rem;
  border-radius: 14px;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  font-weight: 500;
  border: 1px solid transparent;
}

nav a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  transform: translateX(5px);
  border-color: var(--glass-border);
}

nav a.active {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.1));
  color: var(--text-main);
  border-color: var(--primary-glow);
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.2);
}

/* Main Content area */
main {
  padding: 2rem;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.view-content {
  animation: fadeIn 0.4s ease-out;
}

.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  gap: 2rem;
  /* Ensure minimum gap on smaller screens */
  /* Allow wrapping on very small screens */
}

.header-actions {
  display: flex;
  gap: 1.5rem;
  /* Increased gap */
  align-items: center;
  margin-right: auto;
  /* Push to the end (Left in RTL) */
}

/* Premium Icon Button (Pill Shape with Text) */
.icon-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  height: 44px;
  padding: 0 1.25rem;
  /* Horizontal padding for text */
  border-radius: 50px;
  /* Pill shape */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  /* Space between icon and text */
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  min-width: fit-content;
}

.icon-btn span {
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
}

.icon-btn:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: var(--primary-glow);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(139, 92, 246, 0.3);
}

.icon-btn:active {
  transform: translateY(0);
}

/* Glass Card Component */
.glass-card {
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 2rem;
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--glass-border), transparent);
}

.glass-card:hover {
  transform: translateY(-8px);
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--primary-glow);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-item {
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

/* Dynamic Stat Card States */
.surplus-card {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(0, 0, 0, 0.4)) !important;
  border: 1px solid rgba(16, 185, 129, 0.4) !important;
  box-shadow: 0 8px 32px rgba(16, 185, 129, 0.15);
}

.deficit-card {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(0, 0, 0, 0.4)) !important;
  border: 1px solid rgba(239, 68, 68, 0.4) !important;
  box-shadow: 0 8px 32px rgba(239, 68, 68, 0.15);
}


.stat-item h3 {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.stat-item .value {
  font-size: 2.25rem;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  background: linear-gradient(to bottom, #fff, #94a3b8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-item .trend {
  font-size: 0.8125rem;
  margin-top: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 100px;
  border: 1px solid var(--glass-border);
}

.trend.up {
  color: var(--success);
}

.trend.down {
  color: var(--error);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .app-container {
    grid-template-columns: 80px 1fr;
  }

  aside span {
    display: none;
  }

  .logo {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .app-container {
    grid-template-columns: 1fr;
  }

  aside {
    display: flex;
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    z-index: 5000;
    transform: translateX(110%);
    /* Hidden (RTL) */
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
  }

  aside.active {
    transform: translateX(0);
  }

  /* Hamburger Menu Button - Redesigned & Repositioned */
  .mobile-menu-btn {
    display: none !important;
    /* USER REQUEST: Cancel side menu on mobile */
    /* 
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 4000;
    */

    /* Glassmorphism & Circular Style */
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 0;
    /* padding reset for circular center */
    width: 44px;
    height: 44px;
    border-radius: 50%;

    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .mobile-menu-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: var(--primary-glow);
    transform: scale(1.1);
  }

  .mobile-menu-btn:active {
    transform: scale(0.95);
  }

  /* Sidebar Close Button */
  .sidebar-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: auto;
    /* Push to the left in RTL flex container */
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .sidebar-close-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
  }

  /* Sidebar Backdrop */
  .sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 4500;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
  }

  .sidebar-backdrop.active {
    opacity: 1;
    visibility: visible;
  }

  /* Stack Dashboard Layout */
  .dashboard-layout {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
  }

  /* Stack Stats Cards */
  .stats-grid {
    grid-template-columns: 1fr !important;
  }

  /* Header Actions - Ultra Premium */
  .icon-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #a78bfa;
    /* Primary Light */
    border-radius: 50%;
    /* Circular */
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  }

  .icon-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.5;
  }

  .icon-btn:hover {
    background: rgba(139, 92, 246, 0.15);
    transform: translateY(-2px) scale(1.05);
    color: #fff;
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.3);
    border-color: rgba(139, 92, 246, 0.4);
  }

  .icon-btn:active {
    transform: translateY(0) scale(0.95);
  }

  .icon-btn i {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
  }

  .icon-btn:hover i {
    transform: scale(1.1);
  }

  .stat-item {
    padding: 1rem 0;
    /* Add visual separation inside cards if needed */
  }

  /* Adjust Glass Card Padding */
  .glass-card {
    padding: 1.5rem;
  }

  /* Header adjustments */
  header {
    flex-direction: column-reverse;
    /* Put Title on top, Date below? Or simple column */
    gap: 0.5rem;
    align-items: flex-start;
    padding-top: 3rem;
    /* Add space for the top-right menu button */
  }

  /* FAB adjustments for mobile */
  .quick-add-btn {
    bottom: 1.5rem;
    left: 1.5rem;
  }

  .global-mic-fab {
    bottom: 1.5rem;
    right: 1.5rem;
  }
}

/* Forms and Buttons */
.transaction-form {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.input-group label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

input,
select {
  background: #0a0a0f;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 0.875rem 1.25rem;
  color: var(--text-main);
  font-family: inherit;
  outline: none;
  transition: all 0.3s ease;
  font-size: 0.9375rem;
}

option {
  background-color: #0a0a0f;
  color: var(--text-main);
}

input:focus,
select:focus {
  border-color: var(--primary);
  background: #111116;
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  padding: 0.875rem 2rem;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
  filter: brightness(1.1);
}

.btn-primary:active {
  transform: translateY(0);
}

.onboarding-card {
  animation: slideUp 0.5s ease-out;
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dashboard-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-rows: auto auto;
  gap: 1.5rem;
}

.mt-1 {
  margin-top: 1rem;
}

.mt-2 {
  margin-top: 2rem;
}

.mb-2 {
  margin-bottom: 2rem;
}

.transaction-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.transaction-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
}

.transaction-item .source {
  font-weight: 600;
  color: var(--text-main);
}

.transaction-item .date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.transaction-item .amount {
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
}

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

.amount.negative {
  color: var(--error);
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.activity-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--glass-border);
}

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

.activity-item .positive {
  color: var(--success);
  font-weight: 600;
}

.activity-item .negative {
  color: var(--error);
  font-weight: 600;
}

.insight-strip {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--glass);
  border-radius: 12px;
}

.trend-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.trend-badge.growing {
  background: rgba(16, 185, 129, 0.2);
  color: var(--success);
}

.trend-badge.declining {
  background: rgba(239, 68, 68, 0.2);
  color: var(--error);
}

.trend-badge.stable {
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-muted);
}

.growth-summary h3 {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.growth-summary .value {
  font-size: 2rem;
  font-weight: 800;
  margin-top: 0.5rem;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--background);
}

::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Quick Add Button */
.global-mic-fab {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--primary);
  color: #000;
  border: none;
  box-shadow: 0 4px 20px rgba(229, 231, 235, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.global-mic-fab:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 8px 30px rgba(229, 231, 235, 0.3);
}

.global-sound-fab {
  position: fixed;
  bottom: 2rem;
  left: 7rem;
  /* Next to mic */
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  transition: all 0.3s;
}

.global-sound-fab.active {
  background: var(--success);
  color: #000;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.global-sound-fab:hover {
  transform: scale(1.1);
}

.quick-add-btn {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(139, 92, 246, 0.4);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
}

.quick-add-btn:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 15px 30px rgba(139, 92, 246, 0.6);
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  visibility: hidden;
  opacity: 0;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  visibility: visible;
  opacity: 1;
}

.modal-content {
  width: 90%;
  max-width: 500px;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

/* Utils & Grid Aids */
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gap-1 {
  gap: 1rem;
}

.mb-1 {
  margin-bottom: 1rem;
}

.mt-1 {
  margin-top: 1rem;
}

.mt-2 {
  margin-top: 2rem;
}

.text-center {
  text-align: center;
}

.span-2 {
  grid-column: span 2;
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.5s ease-out forwards;
}

/* Privacy Mode Styles */
.privacy-active .privacy-amount {
  filter: blur(8px);
  transition: filter 0.3s ease;
  user-select: none;
  cursor: pointer;
}

.privacy-active .privacy-amount:hover {
  filter: blur(0);
}

.privacy-active i.privacy-amount {
  filter: blur(4px);
}

/* Budget Progress Bar in Transactions */
.transaction-budget-info {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  width: 100%;
}

.budget-mini-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin: 0.4rem 0;
}

.budget-mini-progress {
  height: 100%;
  transition: width 0.3s ease;
}

.remaining-text {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.remaining-text.warning {
  color: var(--warning);
}

.remaining-text.danger {
  color: var(--error);
  font-weight: 700;
}

/* Red Counter Style */
.red-counter-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(239, 68, 68, 0.1);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.red-counter-value {
  color: var(--error);
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  text-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

.red-counter-label {
  font-size: 0.75rem;
  color: var(--error);
  opacity: 0.8;
}

.smooth-update {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Purple Counter Style (For Savings/Remaining) */
.purple-counter-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(139, 92, 246, 0.1);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.purple-counter-value {
  color: var(--primary-light);
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  text-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
}

.purple-counter-label {
  font-size: 0.75rem;
  color: var(--primary-light);
  opacity: 0.8;
}

/* Intelligence Card Redesign */
.intelligence-card {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(236, 72, 153, 0.05) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.intelligence-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
  animation: rotateGlow 10s linear infinite;
  pointer-events: none;
}

@keyframes rotateGlow {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.intelligence-card:hover {
  transform: translateY(-5px);
  border-color: rgba(139, 92, 246, 0.4);
  box-shadow: 0 15px 40px rgba(139, 92, 246, 0.2);
}

.intelligence-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 1rem;
}

/* Sidebar Sections */
.sidebar-section {
  padding: 1rem 0;
  border-top: 1px solid var(--surface-border);
  margin-top: 1rem;
}

.sync-card {
  margin: 0 1rem;
  padding: 0.75rem;
  background: var(--glass);
  border-radius: 12px;
  border: 1px solid var(--glass-border);
}

.sync-status-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-main);
}

.sync-status-row i {
  width: 16px;
  height: 16px;
}

.btn-micro {
  width: 100%;
  padding: 0.4rem;
  font-size: 0.75rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-micro:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
}

.btn-micro-outline {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary-light);
}

.btn-micro-outline:hover {
  background: rgba(139, 92, 246, 0.1);
}

aside nav ul {
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 1rem;
}

.intelligence-value-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.intelligence-predicted-value {
  font-size: 2.5rem;
  font-weight: 900;
  background: linear-gradient(to right, #fff, var(--primary-light));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
  line-height: 1;
}

.intelligence-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: 30px;
  font-size: 0.8rem;
  font-weight: 700;
}

.intelligence-badge.safe {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.intelligence-badge.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  animation: pulseDanger 2s infinite;
}

@keyframes pulseDanger {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.intelligence-icon-box {
  width: 45px;
  height: 45px;
  background: rgba(139, 92, 246, 0.2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-light);
}

/* Premium Danger Alert */
.danger-alert {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(0, 0, 0, 0.3));
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  box-shadow: 0 8px 32px rgba(239, 68, 68, 0.1);
  animation: slideInDown 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
}

.danger-alert::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
  animation: shimmerDanger 3s infinite;
}

@keyframes shimmerDanger {
  0% {
    left: -100%;
  }

  100% {
    left: 200%;
  }
}

@keyframes slideInDown {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.danger-alert i {
  color: #ef4444;
  width: 32px;
  height: 32px;
  animation: pulseDangerIcon 2s infinite;
}

@keyframes pulseDangerIcon {
  0% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(239, 68, 68, 0));
  }

  50% {
    transform: scale(1.1);
    filter: drop-shadow(0 0 10px rgba(239, 68, 68, 0.5));
  }

  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(239, 68, 68, 0));
  }
}

.danger-text {
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #fca5a5;
}

.danger-text b {
  display: block;
  font-size: 1.1rem;
  color: #ef4444;
  margin-bottom: 0.25rem;
}

/* Interactivity & Highlights */
.danger-alert {
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.danger-alert:hover {
  transform: translateY(-3px) scale(1.01);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(20, 20, 20, 0.6));
  box-shadow: 0 12px 40px rgba(239, 68, 68, 0.2);
}

.highlight-pulse {
  animation: highlightPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  border-color: #ef4444 !important;
  z-index: 10;
}

@keyframes highlightPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }

  50% {
    transform: scale(1.02);
    box-shadow: 0 0 20px 10px rgba(239, 68, 68, 0);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

/* Sync Indicator */
.sync-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transition: all 0.3s ease;
  position: relative;
}

.sync-indicator.synced {
  background: #10b981;
}

.sync-indicator.saving {
  background: #f59e0b;
  animation: pulse 1s infinite;
}

.sync-indicator.sync-error {
  background: #ef4444;
}

.sync-indicator.offline {
  background: #64748b;
  opacity: 0.5;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }

  100% {
    transform: scale(1.2);
    opacity: 1;
  }
}

@keyframes syncPulse {
  0% {
    transform: scale(1);
    opacity: 0.5;
    box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4);
  }

  100% {
    transform: scale(1.3);
    opacity: 1;
    box-shadow: 0 0 10px 4px rgba(139, 92, 246, 0.2);
  }
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  padding: 1.5rem 1rem;
  border-top: 1px solid var(--surface-border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s ease;
  cursor: pointer;
  outline: none;
}

.footer-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: var(--primary-glow);
  transform: translateY(-2px);
}

.footer-btn:active {
  transform: translateY(0);
}

.footer-btn i {
  width: 18px;
  height: 18px;
}

/* Privacy Active State for the button itself if needed */
.privacy-active-btn {
  background: linear-gradient(135deg, var(--primary), var(--secondary)) !important;
  color: white !important;
  border: none !important;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

/* Redesigned Modal - Ultra Premium Horizontal */
.modal-overlay .redesigned-modal {
  background: rgba(13, 13, 18, 0.9) !important;
  backdrop-filter: blur(30px) saturate(200%);
  -webkit-backdrop-filter: blur(30px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0 !important;
  border-radius: 36px;
  overflow: hidden;
  box-shadow:
    0 100px 150px -50px rgba(0, 0, 0, 0.9),
    0 0 40px rgba(139, 92, 246, 0.15),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  max-width: 900px !important;
  width: 92%;
  animation: modalReveal 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes modalReveal {
  from {
    opacity: 0;
    transform: translateY(50px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  padding: 2.5rem 3.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.05), transparent);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-title-group h2 {
  font-size: 1.8rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: -1px;
  background: linear-gradient(135deg, #fff 30%, var(--primary-glow));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.modal-title-group p {
  font-size: 0.95rem;
  margin-top: 0.4rem;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 500;
}

.close-modal-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.close-modal-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
  transform: rotate(90deg) scale(1.1);
}

.transaction-type-toggle {
  display: flex;
  background: rgba(0, 0, 0, 0.5);
  margin: 1.5rem 3.5rem;
  padding: 0.4rem;
  border-radius: 22px;
  gap: 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

.type-btn {
  flex: 1;
  padding: 1rem;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 800;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
  font-size: 1.05rem;
  letter-spacing: 0.5px;
}

.type-btn.active[data-type="expense"] {
  background: linear-gradient(135deg, #ff4d4d, #f72585);
  color: white;
  box-shadow: 0 10px 30px rgba(247, 37, 133, 0.4);
}

.type-btn.active[data-type="income"] {
  background: linear-gradient(135deg, #10b981, #064e3b);
  /* Deep green gradient */
  color: white;
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.4);
}

.qa-simplified-form {
  padding: 0 5rem 4rem;
}

.amount-input-wrapper {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  margin: 1rem 0 3rem;
  padding: 0.75rem 4.5rem;
  background: rgba(255, 255, 255, 0.015);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 2px 15px rgba(0, 0, 0, 0.4);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  width: 100%;
}

.amount-input-wrapper:focus-within {
  background: rgba(139, 92, 246, 0.04);
  border-color: rgba(139, 92, 246, 0.4);
  transform: translateY(-2px);
}

.currency-label {
  font-size: 2rem;
  font-weight: 900;
  color: var(--primary-glow);
  text-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
  flex-shrink: 0;
}

.big-amount-input {
  background: transparent !important;
  border: none !important;
  font-size: 4.2rem !important;
  font-weight: 950 !important;
  text-align: center;
  flex: 1;
  min-width: 0;
  color: #fff;
  padding: 0 !important;
  outline: none !important;
  font-family: 'Almarai', sans-serif;
  letter-spacing: -2px;
}

/* Remove number spinners */
.big-amount-input::-webkit-outer-spin-button,
.big-amount-input::-webkit-inner-spin-button {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
}

.big-amount-input[type=number] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.qa-fields-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2.5rem;
  margin-bottom: 3rem;
}

.qa-field {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.qa-field label {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  gap: 0.9rem;
  font-weight: 700;
  margin-right: 0.5rem;
}

.qa-field label i {
  width: 20px;
  height: 20px;
  color: var(--primary-glow);
  opacity: 0.8;
}

.qa-field input,
.qa-field select {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1.1rem 1.75rem;
  border-radius: 16px;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  transition: all 0.4s ease;
  width: 100%;
  text-align: right;
}

.qa-field input[type="datetime-local"] {
  text-align: center;
  padding-left: 3rem;
  font-family: 'Almarai', sans-serif;
}

.qa-field input::-webkit-calendar-picker-indicator {
  filter: invert(1) opacity(0.5);
  cursor: pointer;
  transition: 0.3s;
}

.qa-field input::-webkit-calendar-picker-indicator:hover {
  filter: invert(1) opacity(1);
}

.qa-field input:focus,
.qa-field select:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.06);
  outline: none;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3), 0 0 10px rgba(139, 92, 246, 0.2);
  transform: translateY(-4px);
}

.qa-submit-btn {
  width: 100%;
  padding: 1.8rem;
  border-radius: 26px;
  border: none;
  font-size: 1.4rem;
  font-weight: 900;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.4rem;
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.qa-submit-btn.expense-type {
  background: linear-gradient(135deg, #f72585, #7209b7);
  box-shadow: 0 20px 50px rgba(247, 37, 133, 0.3);
}

.qa-submit-btn.income-type {
  background: linear-gradient(135deg, #10b981, #065f46);
  /* Deep green gradient */
  box-shadow: 0 20px 50px rgba(16, 185, 129, 0.3);
}

/* Voice Command Button */
.voice-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  padding: 0.8rem 1.5rem;
  border-radius: 50px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-family: 'Almarai', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.voice-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  transform: translateY(-2px);
  border-color: var(--primary);
}

.voice-btn.listening {
  background: rgba(220, 38, 38, 0.15);
  /* Red tint */
  color: #ef4444;
  border-color: #ef4444;
  animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

/* Global Voice FAB */
.global-mic-fab {
  position: fixed;
  bottom: 2.5rem;
  right: 2.5rem;
  /* Moved to Right as requested */
  width: 75px;
  height: 75px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f72585, #7209b7);
  /* More vibrant gradient */
  color: white;
  border: 4px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 40px rgba(247, 37, 133, 0.6);
  cursor: pointer;
  z-index: 9999;
  /* Top priority */
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation: fab-pulse 3s infinite;
}

.global-mic-fab i {
  width: 32px;
  height: 32px;
}

.global-mic-fab:hover {
  transform: scale(1.15) rotate(10deg);
  box-shadow: 0 20px 50px rgba(247, 37, 133, 0.8);
  border-color: rgba(255, 255, 255, 0.3);
}

@keyframes fab-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(247, 37, 133, 0.4);
  }

  70% {
    box-shadow: 0 0 0 20px rgba(247, 37, 133, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(247, 37, 133, 0);
  }
}

/* Voice Overlay */
.voice-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.voice-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.voice-content {
  text-align: center;
  color: white;
}

.voice-waves {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  height: 60px;
  margin-bottom: 2rem;
}

.wave {
  width: 6px;
  height: 20px;
  background: var(--secondary);
  animation: wave 1s infinite ease-in-out;
  border-radius: 10px;
}

.wave:nth-child(2) {
  animation-delay: 0.1s;
  height: 35px;
  background: var(--primary);
}

.wave:nth-child(3) {
  animation-delay: 0.2s;
  background: var(--accent);
}

@keyframes wave {

  0%,
  100% {
    height: 20px;
  }

  50% {
    height: 50px;
  }
}

.voice-cancel-btn {
  margin-top: 2rem;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #aaa;
  padding: 0.5rem 1.5rem;
  border-radius: 20px;
  cursor: pointer;
}

/* Toast Notification */
.toast {
  position: fixed;
  top: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  padding: 1rem 2rem;
  border-radius: 50px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 3000;
  transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  border-bottom: 3px solid var(--success);
  color: var(--success);
}

.toast.error {
  border-bottom: 3px solid var(--error);
  color: var(--error);
}

.toast.warning {
  border-bottom: 3px solid var(--warning);
  color: var(--warning);
}


.qa-submit-btn:hover {
  transform: translateY(-10px) scale(1.02);
  filter: brightness(1.2) contrast(1.1);
}

.qa-submit-btn:active {
  transform: translateY(0) scale(0.96);
  transition: 0.1s;
}

/* Responsiveness Updates */
@media (max-width: 1024px) {
  .modal-overlay .redesigned-modal {
    max-width: 90% !important;
  }

  .qa-simplified-form {
    padding: 0 3rem 3rem;
  }

  .amount-input-wrapper {
    padding: 1rem 3rem;
  }
}

@media (max-width: 768px) {
  .modal-overlay .redesigned-modal {
    max-width: 100% !important;
    width: 100%;
    border-radius: 0;
    /* Full screen on mobile */
    min-height: 100vh;
    border: none;
  }

  .modal-header {
    padding: 1.5rem 2rem;
  }

  .modal-title-group h2 {
    font-size: 1.4rem;
  }

  .transaction-type-toggle {
    margin: 1rem 1.5rem;
  }

  .qa-simplified-form {
    padding: 0 1.5rem 2rem;
  }

  .amount-input-wrapper {
    padding: 1.5rem;
    margin-bottom: 2rem;
    gap: 1rem;
  }

  .big-amount-input {
    font-size: 3.2rem !important;
  }

  .currency-label {
    font-size: 1.5rem;
  }

  .qa-fields-grid {
    grid-template-columns: 1fr 1fr;
    /* Keep horizontal flow on mobile */
    gap: 1rem;
  }

  .qa-field input,
  .qa-field select {
    padding: 1rem 1.5rem;
    font-size: 1rem;
  }

  .qa-submit-btn {
    padding: 1.5rem;
    font-size: 1.2rem;
    border-radius: 18px;
  }
}

/* Fix for small height screens */
@media (max-height: 700px) {
  .modal-overlay {
    align-items: flex-start;
    padding: 2rem 0;
    overflow-y: auto;
  }

  .modal-overlay .redesigned-modal {
    position: relative;
    margin-bottom: 2rem;
  }
}