/* ============================================================
   BangunHitung — Custom Styles
   ============================================================ */


/* ── Root Variables ── */
:root {
  --brand-orange: #2563eb;
  --brand-orange-dark: #1d4ed8;
  --brand-orange-light: #dbeafe;
  --brand-yellow: #3b82f6;
  --brand-amber: #1a56db;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --border: #e2e8f0;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.12);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
}

.dark {
  --surface: #0f172a;
  --surface-2: #1e293b;
  --surface-3: #334155;
  --border: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,.4);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--surface-2);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--brand-orange); border-radius: 99px; }

/* ── Typography ── */
.display-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--brand-orange-light);
}

.card-flat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: white;
  opacity: 0;
  transition: opacity 0.15s;
}

.btn:hover::after { opacity: 0.1; }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--brand-orange) 0%, var(--brand-orange-dark) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(37,99,235,.35);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(37,99,235,.5);
  transform: translateY(-1px);
}

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

.btn-secondary:hover {
  background: var(--border);
}

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

.btn-ghost:hover {
  background: var(--surface-3);
  color: var(--text-primary);
}

.btn-danger {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.btn-danger:hover {
  background: #fecaca;
}

.dark .btn-danger {
  background: #3f1212;
  color: #f87171;
  border-color: #7f1d1d;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  border-radius: var(--radius-xs);
}

.btn-lg {
  padding: 0.875rem 2rem;
  font-size: 1rem;
  border-radius: var(--radius);
}

.btn-icon {
  padding: 0.5rem;
  border-radius: var(--radius-xs);
  background: var(--surface-3);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-icon:hover { background: var(--border); color: var(--text-primary); }

/* ── Form Elements ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.form-helper {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: -0.125rem;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  appearance: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

.form-input::placeholder { color: var(--text-muted); }

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.25rem;
  padding-right: 2.5rem;
  cursor: pointer;
}

.form-textarea { resize: vertical; min-height: 80px; }

.form-example {
  font-size: 0.75rem;
  color: var(--brand-orange);
  font-style: italic;
}

/* ── Input with Unit ── */
.input-unit-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-unit-wrap .form-input {
  padding-right: 3rem;
}

.input-unit {
  position: absolute;
  right: 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
}

/* ── Checkbox ── */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  width: 1.125rem;
  height: 1.125rem;
  accent-color: var(--brand-orange);
  cursor: pointer;
}

.checkbox-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
}

/* ── Radio Pills ── */
.radio-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.radio-pill input[type="radio"] { display: none; }

.radio-pill label {
  display: inline-block;
  padding: 0.375rem 0.875rem;
  border-radius: 99px;
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  background: var(--surface);
}

.radio-pill input:checked + label {
  background: var(--brand-orange);
  border-color: var(--brand-orange);
  color: white;
  box-shadow: 0 2px 8px rgba(37,99,235,.35);
}

/* ── Result Card ── */
.result-card {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1.5px solid var(--brand-orange-light);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.dark .result-card {
  background: linear-gradient(135deg, #0f1e3d 0%, #172554 100%);
  border-color: #1e3a8a;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px dashed rgba(37,99,235,.2);
}

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

.result-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.result-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--brand-orange);
}

.result-total {
  background: var(--brand-orange);
  color: white;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-top: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.result-total-label { font-size: 0.875rem; font-weight: 600; opacity: 0.9; }
.result-total-value { font-size: 1.25rem; font-weight: 800; }

/* ── Recommendation Box ── */
.rec-box {
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 0.875rem 1rem;
  display: flex;
  gap: 0.625rem;
  align-items: flex-start;
}

.dark .rec-box {
  background: #0f1e3d;
  border-color: #1e3a8a;
}

.rec-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 0.05rem; }

.rec-text {
  font-size: 0.8125rem;
  color: #1e40af;
  line-height: 1.5;
}

.dark .rec-text { color: #93c5fd; }

/* ── Navbar ── */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.navbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  cursor: pointer;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-yellow));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
  color: #ffffff !important;
}

.brand-icon i,
.brand-icon svg {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

.brand-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.brand-name span { color: var(--brand-orange); }

/* ── Page Container ── */
.page {
  display: none;
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem 5rem;
}

.page.active { display: block; }

/* ── Hero Banner ── */
.hero-banner {
  background: linear-gradient(135deg, var(--brand-orange) 0%, var(--brand-orange-dark) 100%);
  border-radius: var(--radius);
  padding: 2rem;
  color: white;
  position: relative;
  overflow: hidden;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hero-banner::before {
  display: none !important;
}

.hero-banner-content {
  position: relative;
  z-index: 2;
  flex: 1;
}

.hero-banner-illustration {
  width: 140px;
  height: 140px;
  opacity: 0.85;
  z-index: 1;
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

@media (max-width: 480px) {
  .hero-banner-illustration {
    opacity: 0.15;
  }
}

.banner-svg-anim {
  width: 100%;
  height: 100%;
}

.banner-svg-anim .draw-line {
  fill: none;
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 2.5px;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: drawStroke 4s ease-out infinite alternate;
}

.banner-svg-anim .roof-line {
  animation-delay: 0s;
}

.banner-svg-anim .wall-line-1 {
  animation-delay: 0.5s;
}

.banner-svg-anim .door-line {
  animation-delay: 1s;
}

.banner-svg-anim .sun-glow {
  fill: rgba(255, 255, 255, 0.15);
  stroke: rgba(255, 255, 255, 0.8);
  stroke-width: 2px;
  animation: pulseGlow 3s ease-in-out infinite alternate;
}

@keyframes drawStroke {
  0% {
    stroke-dashoffset: 200;
  }
  40% {
    stroke-dashoffset: 0;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

@keyframes pulseGlow {
  0% {
    transform: scale(0.9) translate(5px, 5px);
    opacity: 0.5;
  }
  100% {
    transform: scale(1.1) translate(-5px, -5px);
    opacity: 1;
  }
}

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

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--brand-orange);
  line-height: 1;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ── Project Card ── */
.project-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: all 0.2s;
  cursor: pointer;
}

.project-card:hover {
  border-color: var(--brand-orange);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.project-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  background: var(--brand-orange-light);
  color: var(--brand-orange-dark);
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
}

.dark .project-badge {
  background: #1e3a8a;
  color: #93c5fd;
}

/* ── Area Card ── */
.area-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1rem;
}

.area-header {
  background: var(--surface-3);
  padding: 0.875rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.area-name {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.area-emoji {
  font-size: 1.25rem;
}

.area-body { padding: 1rem 1.25rem; }

/* ── Kalkulasi Item ── */
.kalkulasi-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  transition: all 0.2s;
}

.kalkulasi-item:hover {
  border-color: var(--brand-orange-light);
  background: #eff6ff;
}

.dark .kalkulasi-item:hover {
  background: #0f1e3d;
}

.kalkulasi-nama {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.kalkulasi-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

.kalkulasi-biaya {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--brand-orange);
  white-space: nowrap;
}

/* ── Module Selector ── */
.module-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .module-grid { grid-template-columns: repeat(3, 1fr); }
}

.module-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.module-card:hover, .module-card.selected {
  border-color: var(--brand-orange);
  background: #eff6ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37,99,235,.2);
}

.dark .module-card:hover, .dark .module-card.selected {
  background: #0f1e3d;
}

.module-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  display: block;
}

.module-name {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.module-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ── Shopping List ── */
.shopping-category {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
}

.shopping-cat-header {
  background: linear-gradient(90deg, var(--brand-orange) 0%, var(--brand-orange-dark) 100%);
  color: white;
  padding: 0.75rem 1.25rem;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: var(--radius) var(--radius) 0 0;
}

.shopping-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

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

.shopping-total {
  background: var(--surface-3);
  padding: 0.75rem 1.25rem;
  font-weight: 700;
  font-size: 0.875rem;
  display: flex;
  justify-content: space-between;
  border-top: 2px solid var(--border);
}

/* ── Kamus Card ── */
.kamus-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.625rem;
  overflow: hidden;
}

.kamus-header {
  padding: 0.875rem 1rem;
  font-weight: 700;
  font-size: 0.9375rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background 0.15s;
}

.kamus-header:hover { background: var(--surface-3); }

.kamus-body {
  padding: 0 1rem;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.kamus-body.open {
  max-height: 300px;
  padding: 0 1rem 1rem;
}

.kamus-body p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
}

.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  display: block;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.empty-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.empty-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* ── Toast ── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 320px;
}

.toast {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.875rem 1.125rem;
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  animation: slideInRight 0.3s ease;
  color: var(--text-primary);
}

.toast.success { border-left: 4px solid #22c55e; }
.toast.error { border-left: 4px solid #ef4444; }
.toast.info { border-left: 4px solid var(--brand-orange); }
.toast.success .toast-icon { color: #22c55e; }

@keyframes slideInRight {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── Bottom Nav ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 64px;
  padding: 8px 16px;
  gap: 12px;
  z-index: 100;
  box-sizing: border-box;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;   /* vertically center emoji + label */
  gap: 0.15rem;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  height: 48px;
  transition: color 0.2s, background-color 0.2s, transform 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex: 1;                   /* equal width regardless of content */
  min-width: 0;              /* allow shrinking below content size */
  box-sizing: border-box;
  border-radius: 12px;
}

.nav-item:active {
  transform: scale(0.95);
}

/* Prevent label text from wrapping on small screens */
.nav-item > span:last-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.nav-item svg, .nav-item .nav-emoji { font-size: 1.2rem; line-height: 1; }

.nav-item.active {
  color: var(--brand-orange);
  background: var(--brand-orange-light);
}

.nav-item.active .nav-dot {
  display: block;
}

.nav-dot {
  display: none;
  width: 4px;
  height: 4px;
  background: var(--brand-orange);
  border-radius: 99px;
  margin-top: 1px;
}

.dark .nav-item.active {
  background: rgba(37, 99, 235, 0.15);
}

/* Extra small screens: shrink emoji & hide letter-spacing */
@media (max-width: 360px) {
  .bottom-nav {
    padding: 8px 8px;
    gap: 8px;
  }
  .nav-item {
    font-size: 0.55rem;
    letter-spacing: 0;
    border-radius: 8px;
  }
  .nav-item svg, .nav-item .nav-emoji { font-size: 1.1rem; }
}


/* ── Back Button ── */
.back-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem 0;
  margin-bottom: 1rem;
  transition: color 0.2s;
  width: fit-content;
}

.back-btn:hover { color: var(--brand-orange); }

/* ── Section Divider ── */
.section-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.section-divider::before, .section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Chip / Tag ── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chip-orange { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.chip-green { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.chip-blue { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.chip-purple { background: #faf5ff; color: #7e22ce; border: 1px solid #e9d5ff; }

.dark .chip-orange { background: #1e3a8a; color: #93c5fd; border-color: #1d4ed8; }
.dark .chip-green { background: #052e16; color: #86efac; border-color: #166534; }
.dark .chip-blue { background: #172554; color: #93c5fd; border-color: #1e3a8a; }
.dark .chip-purple { background: #3b0764; color: #d8b4fe; border-color: #6b21a8; }

/* ── Separator ── */
hr.sep {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 1.25rem 0;
}

/* ── Loading Spinner ── */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--brand-orange);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Animations ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in-up {
  animation: fadeInUp 0.35s ease both;
}

@keyframes pulse-orange {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37,99,235,.4); }
  50% { box-shadow: 0 0 0 8px rgba(37,99,235,.0); }
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.open { display: flex; }

.modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  animation: fadeInUp 0.25s ease;
  border: 1px solid var(--border);
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

/* ── Responsive ── */
@media (min-width: 640px) {
  .page { padding: 2rem 1.5rem 6rem; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
  .stat-value { font-size: 1.4rem; }
  .module-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Dark mode form inputs ── */
.dark .form-input,
.dark .form-select,
.dark .form-textarea {
  background: var(--surface-2);
  color: var(--text-primary);
  border-color: var(--border);
}

.dark .form-input::placeholder { color: var(--text-muted); }

.dark .radio-pill label {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-secondary);
}

/* ── Utility ── */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-muted { color: var(--text-muted); }
.text-orange { color: var(--brand-orange); }
.w-full { width: 100%; }
.hidden { display: none !important; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.75rem; }
@media (max-width: 400px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ── Lucide Vector Icons ── */
.lucide {
  width: 20px;
  height: 20px;
  stroke-width: 2px;
  display: inline-block;
  vertical-align: middle;
}

/* Adjust size for smaller inline icons */
.lucide-inline, 
.btn-icon-svg {
  width: 14px;
  height: 14px;
  stroke-width: 2px;
  margin-right: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

/* Adjust size for bottom nav icons */
.nav-icon {
  width: 20px;
  height: 20px;
  stroke-width: 2.2px;
  margin-bottom: 2px;
}

.module-icon .lucide {
  width: 32px;
  height: 32px;
  stroke-width: 1.8px;
  color: var(--brand-orange);
  margin: 0 auto;
}

/* ── Sidebar Banners for Google Ads ── */
.ad-sidebar {
  position: fixed;
  top: 100px;
  width: 160px;
  height: 600px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 12px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: opacity 0.3s;
  overflow: hidden;
}

.ad-sidebar-left {
  left: calc(50% - 480px - 160px - 24px); /* Align perfectly next to 960px container */
}

.ad-sidebar-right {
  right: calc(50% - 480px - 160px - 24px);
}

.ad-placeholder {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ad-label {
  position: absolute;
  top: 8px;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.google-ad-container {
  width: 160px;
  height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.02);
}

/* Hide side ads on smaller screens (mobile / tablet / smaller layouts) to prevent overlapping */
@media (max-width: 1330px) {
  .ad-sidebar {
    display: none !important;
  }
  .ad-bottom-sticky {
    display: flex !important;
  }
  .page {
    padding-bottom: 8.5rem !important; /* Extra padding to prevent sticky ad and bottom nav from overlapping page content */
  }
}

/* ── Sticky Bottom Mobile / Tablet Ad ── */
.ad-bottom-sticky {
  position: fixed;
  bottom: 64px; /* Sits perfectly above the bottom navigation bar (height 64px) */
  left: 0;
  right: 0;
  height: 52px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: none; /* Hidden by default on desktop */
  justify-content: center;
  align-items: center;
  z-index: 99;
  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.05);
}

.ad-placeholder-horizontal {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-label-horizontal {
  position: absolute;
  top: 2px;
  left: 8px;
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.google-ad-horizontal-container {
  width: 320px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.01);
}
