/* Aizu Finance Doodle Design System */
@import url('https://fonts.googleapis.com/css2?family=Architects+Daughter&family=Patrick+Hand&display=swap');

:root {
  --ink: #2b2b2b;
  --paper: #f9f8f3;
  --paper-card: #ffffff;
  --primary: #4a6fa5;
  --primary-light: #eef2f7;
  --success: #558b2f;
  --success-light: #f1f8e9;
  --danger: #c62828;
  --danger-light: #ffebee;
  --warning: #fbc02d;
  --warning-light: #fffde7;
  --accent: #6a1b9a;
  --accent-light: #f3e5f5;
  
  --font-doodle: 'Architects Daughter', cursive;
  --font-body: 'Patrick Hand', Arial, sans-serif;
  
  --border-wobble-card: 255px 15px 225px 15px / 15px 225px 15px 255px;
  --border-wobble-btn: 120px 20px 100px 20px / 20px 100px 20px 120px;
  --border-wobble-input: 255px 12px 225px 15px / 12px 225px 12px 255px;
}

[data-theme="dark"] {
  --ink: #f0f0e8;
  --paper: #18191a;
  --paper-card: #242526;
  --primary: #769fcd;
  --primary-light: #1e2a38;
  --success: #81c784;
  --success-light: #1b2e1e;
  --danger: #e57373;
  --danger-light: #3a1c1c;
  --warning: #ffd54f;
  --warning-light: #373016;
  --accent: #ba68c8;
  --accent-light: #2c1a35;
}

/* Global Reset & Graph Paper Background */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  font-size: 20px;
  background-color: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  padding-bottom: 90px; /* Space for mobile bottom navbar */
  transition: background-color 0.3s ease, color 0.3s ease;
  
  /* Graph Paper Pattern */
  background-image: 
    linear-gradient(rgba(43, 43, 43, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(43, 43, 43, 0.05) 1px, transparent 1px);
  background-size: 25px 25px;
}

[data-theme="dark"] body {
  background-image: 
    linear-gradient(rgba(240, 240, 232, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(240, 240, 232, 0.04) 1px, transparent 1px);
}

a {
  color: var(--primary);
  text-decoration: none;
  font-family: var(--font-doodle);
}

a:hover {
  text-decoration: underline;
}

/* Scrollbar Doodle Style */
::-webkit-scrollbar {
  width: 12px;
}
::-webkit-scrollbar-track {
  background: var(--paper);
  border-left: 2px solid var(--ink);
}
::-webkit-scrollbar-thumb {
  background-color: var(--paper-card);
  border: 2px solid var(--ink);
  border-radius: 10px;
}

/* Containers & Desktop Navigation */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Desktop Header */
header {
  border-bottom: 3px dashed var(--ink);
  padding: 15px 0;
  margin-bottom: 20px;
}

header .header-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* Breadcrumb Navigation */
.breadcrumb-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-doodle);
  flex-shrink: 0;
  white-space: nowrap;
}

.breadcrumb-home {
  font-size: 20px;
  font-weight: bold;
  color: var(--ink);
  opacity: 0.5;
  text-decoration: none;
  transition: opacity 0.2s;
}

.breadcrumb-home:hover {
  opacity: 1;
  text-decoration: none;
}

.breadcrumb-sep {
  font-size: 22px;
  opacity: 0.35;
  user-select: none;
}

.breadcrumb-current {
  font-size: 22px;
  font-weight: bold;
  color: var(--primary);
}

.desktop-nav {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.desktop-nav a {
  font-size: 15px;
  white-space: nowrap;
}

.nav-sep {
  color: var(--ink);
  opacity: 0.4;
  margin: 0 4px;
  user-select: none;
}

@media (max-width: 768px) {
  .desktop-nav {
    display: none; /* Hidden on mobile, bottom-nav replaces it */
  }
}

/* Doodle Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-doodle);
  color: var(--ink);
  margin-bottom: 15px;
}

h1 { font-size: 32px; }
h2 { font-size: 28px; }
h3 { font-size: 24px; }

/* Hand-Drawn Elements */
.doodle-card {
  background-color: var(--paper-card);
  border: 3px solid var(--ink);
  border-radius: var(--border-wobble-card);
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: 6px 6px 0px var(--ink);
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.doodle-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0px var(--ink);
}

.doodle-card.sticky-note {
  background-color: var(--warning-light);
  border-radius: 10px 10px 10px 0px;
}

/* Inputs & Forms */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-family: var(--font-doodle);
  font-size: 18px;
  margin-bottom: 5px;
}

.doodle-input {
  width: 100%;
  padding: 12px 15px;
  font-family: var(--font-body);
  font-size: 22px;
  background-color: var(--paper-card);
  border: 3px solid var(--ink);
  border-radius: var(--border-wobble-input);
  color: var(--ink);
  outline: none;
  transition: all 0.2s ease;
}

.doodle-input:focus {
  border-color: var(--primary);
  box-shadow: 3px 3px 0 var(--primary);
  transform: translate(-1px, -1px);
}

/* Buttons */
.doodle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 25px;
  font-family: var(--font-doodle);
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  background-color: var(--paper-card);
  border: 3px solid var(--ink);
  border-radius: var(--border-wobble-btn);
  color: var(--ink);
  box-shadow: 4px 4px 0px var(--ink);
  transition: all 0.15s ease;
  user-select: none;
}

.doodle-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0px var(--ink);
}

.doodle-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0px var(--ink);
}

.doodle-btn-primary {
  background-color: var(--primary-light);
  color: var(--ink);
}
.doodle-btn-primary:hover {
  background-color: var(--primary);
  color: var(--paper-card);
}

.doodle-btn-success {
  background-color: var(--success-light);
}
.doodle-btn-success:hover {
  background-color: var(--success);
  color: var(--paper-card);
}

.doodle-btn-danger {
  background-color: var(--danger-light);
}
.doodle-btn-danger:hover {
  background-color: var(--danger);
  color: var(--paper-card);
}

.doodle-btn-warning {
  background-color: var(--warning-light);
}
.doodle-btn-warning:hover {
  background-color: var(--warning);
}

/* Tables and Lists */
.doodle-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
  font-size: 22px;
}

.doodle-table th, .doodle-table td {
  padding: 12px 15px;
  border-bottom: 2px dashed var(--ink);
  text-align: left;
}

.doodle-table th {
  font-family: var(--font-doodle);
  font-weight: bold;
  border-bottom: 3px solid var(--ink);
}

.doodle-table tbody tr:hover {
  background-color: var(--primary-light);
}

/* Badges */
.doodle-badge {
  display: inline-block;
  padding: 4px 10px;
  font-family: var(--font-doodle);
  font-size: 14px;
  font-weight: bold;
  border: 2px solid var(--ink);
  border-radius: 20px;
  background-color: var(--paper-card);
  box-shadow: 2px 2px 0 var(--ink);
}

.doodle-badge-income { background-color: var(--success-light); color: var(--success); }
.doodle-badge-expense { background-color: var(--danger-light); color: var(--danger); }
.doodle-badge-neutral { background-color: var(--primary-light); color: var(--primary); }

/* Responsive Mobile Bottom Navigation Bar (Mandatory) */
.mobile-nav {
  display: none; /* Hidden on desktop */
}

@media (max-width: 768px) {
  .mobile-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--paper-card);
    border-top: 3px solid var(--ink);
    border-radius: 0;
    box-shadow: 0px -3px 15px rgba(0, 0, 0, 0.1);
    padding: 8px 5px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    z-index: 1000;
  }
  
  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--ink);
    font-family: var(--font-doodle);
    font-size: 11px;
    gap: 3px;
    width: 55px;
    height: 50px;
    border-radius: 50%;
    transition: all 0.2s ease;
  }
  
  .mobile-nav-item svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: var(--ink);
    stroke-width: 2.5;
    transition: transform 0.2s ease;
  }
  
  .mobile-nav-item.active {
    background-color: var(--primary-light);
    border: 2px solid var(--ink);
    box-shadow: 2px 2px 0 var(--ink);
    transform: scale(1.1);
  }
  
  .mobile-nav-item.active svg {
    stroke: var(--primary);
  }
  
  .mobile-nav-item:hover svg {
    transform: rotate(-10deg) scale(1.1);
  }
  
  .mobile-nav-scanner-btn {
    position: relative;
    top: -20px; /* Raised floating scan button */
    background-color: var(--warning);
    border: 3px solid var(--ink);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    box-shadow: 3px 3px 0 var(--ink);
  }
  
  .mobile-nav-scanner-btn:active {
    transform: translateY(2px);
    box-shadow: 1px 1px 0 var(--ink);
  }
}

/* Dashboard Metrics & Layouts */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 25px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 25px;
  margin-bottom: 25px;
}

@media (max-width: 600px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.metric-box {
  display: flex;
  flex-direction: column;
}

.metric-val {
  font-family: var(--font-doodle);
  font-size: 36px;
  font-weight: bold;
  margin-top: 10px;
}

/* Sketched Progress Bar for Budgets */
.budget-bar-container {
  margin-top: 15px;
  margin-bottom: 10px;
}

.budget-bar-info {
  display: flex;
  justify-content: space-between;
  font-size: 18px;
  margin-bottom: 4px;
}

.budget-bar-bg {
  height: 22px;
  background-color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.budget-bar-fill {
  height: 100%;
  border-right: 2px solid var(--ink);
  border-radius: 10px 0 0 10px;
  transition: width 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  
  /* Crayon-like sketch texture for progress bar fill */
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 4px,
    rgba(255, 255, 255, 0.25) 4px,
    rgba(255, 255, 255, 0.25) 8px
  );
}

.budget-bar-fill.normal { background-color: var(--success); }
.budget-bar-fill.warning { background-color: var(--warning); }
.budget-bar-fill.danger { background-color: var(--danger); }

/* Savings Goal Jars */
.jars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 25px;
}

.jar-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 15px;
  border: 3px solid var(--ink);
  border-radius: 20px 20px 30px 30px / 30px 30px 20px 20px;
  background-color: var(--paper-card);
  box-shadow: 4px 4px 0 var(--ink);
  transition: all 0.2s ease;
}

.jar-container:hover {
  transform: translateY(-5px);
  box-shadow: 6px 8px 0 var(--ink);
}

.jar-svg {
  width: 130px;
  height: 170px;
  position: relative;
}

.jar-label {
  font-family: var(--font-doodle);
  font-weight: bold;
  text-align: center;
  margin-top: 15px;
}

.jar-progress-text {
  font-size: 18px;
  color: var(--primary);
  margin-top: 5px;
}

/* Receipt Scanner (OCR) simulation */
.scanner-dropzone {
  border: 4px dashed var(--ink);
  border-radius: var(--border-wobble-card);
  padding: 50px 20px;
  text-align: center;
  cursor: pointer;
  background-color: var(--paper-card);
  transition: background-color 0.2s ease;
}

.scanner-dropzone:hover {
  background-color: var(--primary-light);
}

.scanner-dropzone svg {
  width: 80px;
  height: 80px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  margin-bottom: 15px;
}

.scanner-active-container {
  position: relative;
  border: 3px solid var(--ink);
  border-radius: 10px;
  overflow: hidden;
  max-width: 400px;
  margin: 0 auto 20px;
}

.scanner-img {
  width: 100%;
  display: block;
}

.scanner-laser-line {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: var(--success);
  box-shadow: 0 0 8px var(--success), 0 0 15px var(--success);
  animation: laser-scan 2.5s ease-in-out infinite;
}

@keyframes laser-scan {
  0% { top: 0%; }
  50% { top: 100%; }
  100% { top: 0%; }
}

/* Sketchy Charts in Reports */
.chart-bar-y {
  display: flex;
  align-items: flex-end;
  height: 250px;
  gap: 15px;
  border-left: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  padding-left: 10px;
  padding-bottom: 5px;
  margin-top: 20px;
}

.chart-bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.chart-bar-pillar {
  width: 100%;
  max-width: 50px;
  border: 3px solid var(--ink);
  border-radius: 8px 8px 0 0;
  background-color: var(--primary);
  box-shadow: 2px -2px 0 var(--ink) inset;
  transition: height 1s ease-out;
  
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 5px,
    rgba(255, 255, 255, 0.15) 5px,
    rgba(255, 255, 255, 0.15) 10px
  );
}

.chart-bar-label {
  margin-top: 8px;
  font-size: 16px;
  text-align: center;
  font-family: var(--font-doodle);
  word-break: break-word;
}

/* General Layout utilities */
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }

.alert {
  padding: 15px;
  border: 3px solid var(--ink);
  border-radius: var(--border-wobble-card);
  margin-bottom: 20px;
  font-size: 20px;
  box-shadow: 4px 4px 0 var(--ink);
}

.alert-warning {
  background-color: var(--warning-light);
  border-color: var(--warning);
}

.alert-success {
  background-color: var(--success-light);
  border-color: var(--success);
}

.alert-danger {
  background-color: var(--danger-light);
  border-color: var(--danger);
}

/* Wiggle animation */
.wiggle:hover {
  animation: wiggle-anim 0.4s ease infinite alternate;
}

@keyframes wiggle-anim {
  0% { transform: rotate(-2deg); }
  100% { transform: rotate(2deg); }
}

/* Settings, Lists, Switch */
.switch-container {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.switch-track {
  width: 60px;
  height: 32px;
  border: 3px solid var(--ink);
  border-radius: 20px;
  background-color: var(--paper);
  position: relative;
  transition: background-color 0.2s ease;
}

.switch-thumb {
  width: 22px;
  height: 22px;
  background-color: var(--ink);
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: left 0.2s ease;
}

.switch-checkbox:checked + .switch-track {
  background-color: var(--primary-light);
}

.switch-checkbox:checked + .switch-track .switch-thumb {
  left: 30px;
  background-color: var(--primary);
}

.hidden {
  display: none !important;
}

/* Modal Dialogs */
.doodle-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 15px;
}

.doodle-modal {
  background-color: var(--paper-card);
  border: 3px solid var(--ink);
  border-radius: var(--border-wobble-card);
  max-width: 500px;
  width: 100%;
  padding: 25px;
  box-shadow: 8px 8px 0 var(--ink);
  position: relative;
}

.doodle-modal-close {
  position: absolute;
  top: 10px;
  right: 15px;
  background: none;
  border: none;
  font-family: var(--font-doodle);
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  color: var(--ink);
}

.doodle-modal-close:hover {
  color: var(--danger);
  transform: scale(1.1);
}
