/* ==========================================================================
   PERSONAL LEDGER & FINANCE MANAGER - MODERN VIBRANT THEME
   Optimized for Mobile, Tablet, and Laptop/Desktop
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Vibrant Brand & Functional Colors */
  --app-primary: #4f46e5;         /* Modern Indigo */
  --app-primary-hover: #4338ca;
  --app-secondary: #64748b;
  --app-accent: #06b6d4;          /* Vivid Cyan */
  --app-success: #10b981;         /* Emerald Inflow */
  --app-danger: #f43f5e;          /* Rose Outflow */
  --app-warning: #f59e0b;         /* Amber Due / Alerts */
  --app-info: #3b82f6;            /* Blue Info */
  
  /* Vibrant Gradients */
  --grad-primary: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --grad-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --grad-danger: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
  --grad-warning: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --grad-info: linear-gradient(135deg, #06b6d4 0%, #2563eb 100%);
  --grad-royal: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
  --grad-sidebar: linear-gradient(180deg, #0f172a 0%, #111827 60%, #1e1b4b 100%);
  --grad-camera: linear-gradient(135deg, #f43f5e 0%, #fb7185 100%);
  
  /* Surfaces & Shadows */
  --app-bg: #f8fafc;
  --app-card-bg: #ffffff;
  --app-border: #e2e8f0;
  --app-border-focus: #818cf8;
  --app-sidebar-width: 270px;
  
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 14px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 28px -4px rgba(15, 23, 42, 0.08), 0 6px 12px -2px rgba(15, 23, 42, 0.04);
  --shadow-glow-primary: 0 8px 20px -4px rgba(79, 70, 229, 0.35);
  --shadow-glow-success: 0 8px 20px -4px rgba(16, 185, 129, 0.35);
  --shadow-glow-danger: 0 8px 20px -4px rgba(244, 63, 94, 0.35);
}

/* Base Typography & Layout */
body {
  background-color: var(--app-bg);
  color: #1e293b;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

.font-monospace {
  font-family: 'JetBrains Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ==========================================================================
   SIDEBAR - SLEEK MODERN DARK GRADIENT
   ========================================================================== */
#sidebar {
  width: var(--app-sidebar-width);
  min-height: 100vh;
  background: var(--grad-sidebar);
  color: #f8fafc;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1040;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}

#sidebar .brand-box {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

#sidebar .brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow-primary);
}

#sidebar .fy-pill {
  background: rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.6rem 1.25rem;
  backdrop-filter: blur(8px);
}

#sidebar .nav-section-title {
  padding: 1rem 1.25rem 0.35rem;
  text-transform: uppercase;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

#sidebar .nav-link {
  color: #94a3b8;
  font-weight: 500;
  font-size: 0.88rem;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  margin: 0.15rem 0.75rem;
  display: flex;
  align-items: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

#sidebar .nav-link i {
  font-size: 1.15rem;
  margin-right: 0.75rem;
  transition: transform 0.2s ease;
}

#sidebar .nav-link:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.08);
  transform: translateX(3px);
}

#sidebar .nav-link.active {
  color: #ffffff;
  background: var(--grad-primary);
  box-shadow: var(--shadow-glow-primary);
  font-weight: 600;
}

#sidebar .nav-link.active i {
  transform: scale(1.1);
}

/* ==========================================================================
   CONTENT WRAPPER & TOPBAR
   ========================================================================== */
#content-wrapper {
  margin-left: var(--app-sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.topbar {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--app-border);
  padding: 0.85rem 1.75rem;
  position: sticky;
  top: 0;
  z-index: 1020;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.main-content {
  flex: 1;
  padding: 1.75rem;
}

/* ==========================================================================
   MODERN COLORFUL CARDS & COMPONENTS
   ========================================================================== */
.card-metric {
  border: 1px solid var(--app-border);
  border-radius: 16px;
  background: var(--app-card-bg);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  position: relative;
  overflow: hidden;
}

.card-metric::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: transparent;
  transition: background 0.25s ease;
}

.card-metric:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: #cbd5e1;
}

.card-metric.accent-success:hover::before { background: var(--grad-success); }
.card-metric.accent-danger:hover::before { background: var(--grad-danger); }
.card-metric.accent-primary:hover::before { background: var(--grad-primary); }
.card-metric.accent-warning:hover::before { background: var(--grad-warning); }
.card-metric.accent-info:hover::before { background: var(--grad-info); }

.metric-icon-box {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease;
}

.card-metric:hover .metric-icon-box {
  transform: scale(1.08);
}

/* Card Headers */
.card-header-clean {
  background: transparent;
  border-bottom: 1px solid var(--app-border);
  padding: 1.15rem 1.35rem;
  font-weight: 700;
  font-size: 0.95rem;
}

/* Rounded Cards */
.rounded-4 {
  border-radius: 18px !important;
}

/* Vibrant Hero Banner / Net Worth */
.hero-gradient-card {
  background: var(--grad-royal);
  color: white;
  border-radius: 20px;
  box-shadow: 0 14px 30px -4px rgba(30, 27, 75, 0.4);
  position: relative;
  overflow: hidden;
}

.hero-gradient-card::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.3) 0%, rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
}

/* ==========================================================================
   BUTTONS & MICRO-INTERACTIONS
   ========================================================================== */
.btn {
  font-weight: 600;
  border-radius: 10px;
  padding: 0.5rem 1rem;
  transition: all 0.2s ease;
  letter-spacing: -0.01em;
}

.btn-primary {
  background: var(--grad-primary);
  border: none;
  box-shadow: var(--shadow-glow-primary);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px -3px rgba(79, 70, 229, 0.45);
}

.btn-success {
  background: var(--grad-success);
  border: none;
  box-shadow: var(--shadow-glow-success);
}
.btn-success:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px -3px rgba(16, 185, 129, 0.45);
}

.btn-danger {
  background: var(--grad-danger);
  border: none;
  box-shadow: var(--shadow-glow-danger);
}
.btn-danger:hover {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px -3px rgba(244, 63, 94, 0.45);
}

/* Floating Action / Quick Entry */
.hover-lift {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.hover-lift:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

/* ==========================================================================
   MOBILE CAMERA RECEIPT SCANNER & DROPZONE
   ========================================================================== */
.receipt-scan-card {
  border: 2px dashed #f43f5e;
  background: linear-gradient(180deg, #fff1f2 0%, #ffffff 100%);
  border-radius: 16px;
  padding: 1.5rem;
  text-align: center;
  transition: all 0.25s ease;
}

.receipt-scan-card:hover {
  border-color: #e11d48;
  background: linear-gradient(180deg, #ffe4e6 0%, #ffffff 100%);
}

.camera-pulse-btn {
  background: var(--grad-danger);
  color: white;
  border-radius: 9999px;
  padding: 0.65rem 1.4rem;
  font-weight: 700;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-glow-danger);
  animation: pulse-shadow 2.5s infinite;
  cursor: pointer;
}

.camera-pulse-btn:hover {
  transform: scale(1.03);
}

@keyframes pulse-shadow {
  0% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.45); }
  70% { box-shadow: 0 0 0 12px rgba(244, 63, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

.receipt-preview-wrapper {
  position: relative;
  display: inline-block;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 2px solid white;
}

/* ==========================================================================
   COLORFUL BADGES & STATUS TAGS
   ========================================================================== */
.badge-receipt, .badge-inflow {
  background-color: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  font-weight: 600;
  border-radius: 9999px;
  padding: 0.35rem 0.75rem;
}

.badge-payment, .badge-outflow {
  background-color: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
  font-weight: 600;
  border-radius: 9999px;
  padding: 0.35rem 0.75rem;
}

.badge-transfer {
  background-color: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  font-weight: 600;
  border-radius: 9999px;
  padding: 0.35rem 0.75rem;
}

.badge-journal {
  background-color: #faf5ff;
  color: #6b21a8;
  border: 1px solid #e9d5ff;
  font-weight: 600;
  border-radius: 9999px;
  padding: 0.35rem 0.75rem;
}

/* Frequency Badges for Recurring Schedules */
.badge-freq-daily { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; font-weight: 600; border-radius: 9999px; }
.badge-freq-weekly { background: #e0e7ff; color: #4338ca; border: 1px solid #c7d2fe; font-weight: 600; border-radius: 9999px; }
.badge-freq-monthly { background: #fdf4ff; color: #86198f; border: 1px solid #f5d0fe; font-weight: 600; border-radius: 9999px; }
.badge-freq-quarterly { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; font-weight: 600; border-radius: 9999px; }
.badge-freq-yearly { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; font-weight: 600; border-radius: 9999px; }

/* Status Badges */
.badge-status-active { background: #dcfce7; color: #15803d; border: 1px solid #86efac; border-radius: 9999px; font-weight: 600; }
.badge-status-paused { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; border-radius: 9999px; font-weight: 600; }
.badge-status-completed { background: #e2e8f0; color: #334155; border: 1px solid #94a3b8; border-radius: 9999px; font-weight: 600; }

/* ==========================================================================
   TABLES & DATA DISPLAY
   ========================================================================== */
.table-modern-wrapper {
  background: white;
  border-radius: 16px;
  border: 1px solid var(--app-border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table-modern {
  margin-bottom: 0;
}

.table-modern thead th {
  background: #f8fafc;
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--app-border);
}

.table-modern tbody td {
  padding: 0.95rem 1.25rem;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
  transition: background-color 0.15s ease;
}

.table-modern tbody tr:hover td {
  background-color: #f8fafc;
}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVE NAVIGATION
   ========================================================================== */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 12px;
  left: 14px;
  right: 14px;
  height: 64px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(226, 232, 240, 0.85);
  border-radius: 20px;
  z-index: 1050;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

.mobile-bottom-nav .nav-item {
  flex: 1;
  text-align: center;
}

.mobile-bottom-nav .nav-link {
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.4rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.2s ease;
}

.mobile-bottom-nav .nav-link i {
  font-size: 1.25rem;
  margin-bottom: 2px;
  transition: transform 0.2s ease;
}

.mobile-bottom-nav .nav-link.active {
  color: var(--app-primary);
}

.mobile-bottom-nav .nav-link.active i {
  transform: translateY(-2px);
}

.quick-action-btn-circle {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--grad-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow-primary);
  margin-top: -26px;
  border: 3px solid #ffffff;
  font-size: 1.6rem;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}

.quick-action-btn-circle:hover,
.quick-action-btn-circle:active {
  transform: scale(1.1) rotate(90deg);
}

/* ==========================================================================
   BREAKPOINTS: MOBILE (<768px), TABLET (768px-991px), LAPTOP (>992px)
   ========================================================================== */
@media (max-width: 991.98px) {
  #sidebar {
    margin-left: calc(-1 * var(--app-sidebar-width));
  }
  #sidebar.show {
    margin-left: 0;
  }
  #content-wrapper {
    margin-left: 0;
    padding-bottom: 84px; /* Space for floating bottom-nav */
  }
  .mobile-bottom-nav {
    display: flex;
    align-items: center;
  }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1030;
  }
  .sidebar-backdrop.show {
    display: block;
  }
  .main-content {
    padding: 1.25rem;
  }
  .topbar {
    padding: 0.75rem 1rem;
  }
}

@media (max-width: 576px) {
  .main-content {
    padding: 0.85rem;
  }
  .card-metric {
    border-radius: 14px;
    padding: 1rem !important;
  }
  .metric-icon-box {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
  }
  h3 {
    font-size: 1.35rem;
  }
  h4 {
    font-size: 1.15rem;
  }
}

/* Form Controls Styling */
.form-control, .form-select {
  border-radius: 10px;
  border: 1px solid var(--app-border);
  padding: 0.6rem 0.85rem;
  font-size: 0.9rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus, .form-select:focus {
  border-color: var(--app-border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: #334155;
}
