/* ============================================
   CivicVoice — Design System
   American Flag Theme: Red, White & Blue
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* --- CSS Custom Properties --- */
:root {
  /* TPC Brand Palette */
  --red: #C60000;
  --red-light: #E03333;
  --red-dark: #700000;
  --blue: #0F3D7D;
  --blue-light: #1A52A0;
  --blue-lighter: #2868C0;
  --blue-dark: #072655;
  --white: #FFFFFF;
  --off-white: #F5F6FA;

  /* Light Mode (default) */
  --bg-primary: #F5F6FA;
  --bg-secondary: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-nav: #FFFFFF;
  --text-primary: #111424;
  --text-secondary: #4A4E69;
  --text-muted: #5A5D70; /* Boosted for WCAG AA Contrast */
  --border-color: #E2E4ED;
  --shadow-sm: 0 1px 3px rgba(10, 49, 97, 0.06);
  --shadow-md: 0 4px 12px rgba(10, 49, 97, 0.08);
  --shadow-lg: 0 8px 30px rgba(10, 49, 97, 0.12);
  --accent: var(--blue);
  --accent-light: var(--blue-light);
  --cta: var(--red);
  --cta-hover: var(--red-dark);
  --success: #1B8A4E;
  --success-bg: #E8F5EE;
  --warning: #D4860A;
  --warning-bg: #FFF8EB;
  --pro-color: #1B8A4E;
  --pro-bg: #E8F5EE;
  --con-color: #C53030;
  --con-bg: #FEE8E8;
  --neutral-bg: #EEF1F8;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 50%;

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-base: 0.9375rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.75rem;
  --fs-3xl: 2.25rem;
  --fw-light: 300;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-extrabold: 800;

  /* Transition */
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-blur: blur(12px);
}

/* --- Dark Mode --- */
[data-theme="dark"] {
  --bg-primary: #0B1D3A;
  --bg-secondary: #112744;
  --bg-card: #152E50;
  --bg-nav: #0E2240;
  --text-primary: #F0F4FA;
  --text-secondary: #B8C5DD;
  --text-muted: #8F9EB8; /* Boosted for WCAG AA Contrast */
  --border-color: #1E3A5F;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.4);
  --accent: #4A8FD4;
  --accent-light: #6AABEB;
  --cta: #E0354B;
  --cta-hover: #C42D42;
  --success: #34C76A;
  --success-bg: rgba(52, 199, 106, 0.12);
  --warning: #F0A830;
  --warning-bg: rgba(240, 168, 48, 0.12);
  --pro-color: #34C76A;
  --pro-bg: rgba(52, 199, 106, 0.1);
  --con-color: #F06060;
  --con-bg: rgba(240, 96, 96, 0.1);
  --neutral-bg: rgba(74, 143, 212, 0.08);

  /* Glassmorphism Dark */
  --glass-bg: rgba(15, 36, 68, 0.75);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur: blur(16px);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

/* --- App Shell --- */
.app-container {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  padding-bottom: 80px;
  display: flex;
  flex-direction: column;
}

.app-footer {
  text-align: center;
  padding: var(--space-xl) var(--space-md) calc(var(--space-2xl) + 80px);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: auto;
}

.app-footer a {
  color: var(--text-secondary);
  font-weight: var(--fw-semibold);
  margin: 0 var(--space-xs);
}

@media (max-width: 380px) {
  .app-header { padding: var(--space-md); }
  .view { padding: var(--space-md); }
}

/* --- Header --- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background var(--transition), border-color var(--transition);
}

.app-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.app-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--blue), var(--blue-light));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: white;
}

[data-theme="dark"] .app-logo-icon {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
}

.app-logo-text {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.app-logo-text span {
  color: var(--cta);
}

.app-logo-img {
  height: 44px;
  width: auto;
  display: block;
}

.lang-select {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  font-family: var(--font);
  cursor: pointer;
  outline: none;
  margin-right: 8px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all var(--transition);
}

.theme-toggle:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-md);
  background: var(--neutral-bg);
  border-radius: var(--radius-lg);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.user-badge:hover {
  background: var(--border-color);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--blue), var(--red));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
}

/* --- Bottom Navigation --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--bg-nav);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  padding: var(--space-sm) 0 calc(var(--space-sm) + env(safe-area-inset-bottom, 0px));
  z-index: 100;
  transition: background var(--transition), border-color var(--transition);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-xs) var(--space-sm);
  border: none;
  background: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: var(--fs-xs);
  cursor: pointer;
  transition: color var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  min-width: 60px;
}

.nav-item .nav-icon {
  font-size: 1.4rem;
  transition: transform var(--transition-fast);
}

.nav-item.active {
  color: var(--accent);
}

.nav-item.active .nav-icon {
  transform: scale(1.1);
}

.nav-item:active .nav-icon {
  transform: scale(0.9);
}

/* --- Views --- */
.view {
  display: none;
  padding: var(--space-lg);
  animation: fadeIn 0.3s ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Auth Pages --- */
.auth-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  background: var(--bg-primary);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl) var(--space-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  transition: background var(--transition), border-color var(--transition);
}

.auth-logo {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.auth-logo-img {
  width: 180px;
  height: auto;
  margin: 0 auto var(--space-md);
  display: block;
}

.auth-logo-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--blue), var(--blue-light));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto var(--space-md);
  color: white;
}

[data-theme="dark"] .auth-logo-icon {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
}

.auth-logo h1 {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.03em;
}

.auth-logo h1 span {
  color: var(--cta);
}

.auth-logo p {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  margin-top: var(--space-xs);
}

.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px var(--space-md);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: var(--fs-base);
  transition: all var(--transition);
  outline: none;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10, 49, 97, 0.1);
}

[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group select:focus {
  box-shadow: 0 0 0 3px rgba(74, 143, 212, 0.2);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.form-row-3 {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--space-md);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 14px var(--space-lg);
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--cta), var(--red-dark));
  color: white;
  box-shadow: 0 4px 14px rgba(179, 25, 66, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(179, 25, 66, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--neutral-bg);
  color: var(--accent);
}

.btn-secondary:hover {
  background: var(--border-color);
}

.btn-vote {
  padding: 12px var(--space-lg);
  background: linear-gradient(135deg, var(--blue), var(--blue-light));
  color: white;
  box-shadow: 0 4px 14px rgba(10, 49, 97, 0.25);
}

[data-theme="dark"] .btn-vote {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
}

.btn-vote:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(10, 49, 97, 0.35);
}

.btn-vote.voted {
  background: var(--success);
  box-shadow: 0 4px 14px rgba(27, 138, 78, 0.25);
  pointer-events: none;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border-color);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-sm {
  padding: 8px var(--space-md);
  font-size: var(--fs-sm);
}

.auth-switch {
  text-align: center;
  margin-top: var(--space-lg);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

.auth-switch a {
  color: var(--accent);
  font-weight: var(--fw-semibold);
  cursor: pointer;
}

.auth-theme-toggle {
  position: absolute;
  top: var(--space-lg);
  right: var(--space-lg);
}

/* --- Section Headers --- */
.section-header {
  margin-bottom: var(--space-lg);
}

.section-header h2 {
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-xs);
}

.section-header p {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
}

/* --- Legislative Analysis --- */
.analysis-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-top: var(--space-xl);
  position: relative;
  overflow: hidden;
}

.analysis-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: white;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-md);
}

.analysis-summary-text {
  font-size: var(--fs-md);
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
}

.expert-section {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

@media (min-width: 768px) {
  .expert-section {
    grid-template-columns: 1fr 1fr;
  }
}

.expert-col {
  background: rgba(255, 255, 255, 0.02);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.expert-col-header {
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: 8px;
}

.expert-pro-header { color: #34C76A; }
.expert-con-header { color: #FF4B55; }

.expert-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.expert-list-item {
  font-size: var(--fs-xs);
  line-height: 1.5;
  margin-bottom: var(--space-sm);
  padding-left: 14px;
  position: relative;
  opacity: 0.9;
}

.expert-list-item::before {
  content: "•";
  position: absolute;
  left: 0;
  top: 0;
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  margin-bottom: var(--space-md);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-clickable {
  cursor: pointer;
}

.card-clickable:hover {
  transform: translateY(-2px);
}

/* --- Stats Row --- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  text-align: center;
  border: 1px solid var(--border-color);
  transition: all var(--transition);
}

.stat-number {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-extrabold);
  color: var(--accent);
  line-height: 1.2;
}

.stat-label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: var(--space-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: var(--fw-medium);
}

/* --- New Result Bars --- */
.premium-bar-container {
  margin-top: var(--space-md);
  background: var(--neutral-bg);
  height: 32px;
  border-radius: var(--radius-full);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.premium-bar-fill {
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 var(--space-md);
  color: white;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  transition: width var(--transition-slow);
  width: 0%;
  position: relative;
  z-index: 2;
}

.premium-bar-fill.green {
  background: linear-gradient(90deg, #34C76A, #1B8A4E);
}

.premium-bar-fill.red {
  background: linear-gradient(90deg, #F06060, #C53030);
}

.premium-bar-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(rgba(255,255,255,0.15), transparent);
  pointer-events: none;
}

.premium-bar-label {
  position: absolute;
  top: 50%;
  right: var(--space-md);
  transform: translateY(-50%);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--text-secondary);
  z-index: 1;
}

/* --- Onboarding Modal --- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-lg);
  opacity: 0;
  transition: opacity var(--transition);
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.onboarding-card {
  background: var(--bg-card);
  width: 100%;
  max-width: 400px;
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  position: relative;
  box-shadow: var(--shadow-lg);
  text-align: center;
  transform: translateY(20px);
  transition: transform var(--transition);
}

.modal-overlay.active .onboarding-card {
  transform: translateY(0);
}

.onboarding-steps {
  margin: var(--space-xl) 0;
}

.onboarding-step {
  display: none;
}

.onboarding-step.active {
  display: block;
  animation: slideIn 0.4s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.step-dots {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--border-color);
}

.dot.active {
  background: var(--accent);
  width: 20px;
}

/* --- Category Icons --- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.category-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-sm);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  border: 2px solid transparent;
  background: var(--bg-card);
}

.category-item:hover {
  border-color: var(--accent);
  background: var(--neutral-bg);
}

.category-item.selected {
  border-color: var(--accent);
  background: var(--neutral-bg);
}

.category-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: var(--neutral-bg);
  transition: all var(--transition);
}

.category-item.selected .category-icon,
.category-item:hover .category-icon {
  background: var(--accent);
  transform: scale(1.05);
}

.category-item.selected .category-icon span,
.category-item:hover .category-icon span {
  filter: grayscale(0) brightness(1.2);
}

.category-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.3;
}

/* --- Vote Cards --- */
.vote-card {
  position: relative;
  overflow: hidden;
}

.vote-card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.vote-card-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: var(--neutral-bg);
}

.vote-card-title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  margin-bottom: 2px;
}

.vote-card-meta {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.vote-card-description {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  line-height: 1.6;
}

.vote-options {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.vote-option {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-color);
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
}

.vote-option:hover {
  border-color: var(--accent);
  background: var(--neutral-bg);
}

.vote-option.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.vote-option.selected-yes {
  border-color: var(--success);
  background: var(--success);
  color: white;
}

.vote-option.selected-no {
  border-color: var(--con-color);
  background: var(--con-color);
  color: white;
}

/* --- Bill Detail / Pros & Cons --- */
.bill-detail-hero {
  background: linear-gradient(135deg, var(--blue), var(--blue-light));
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  color: white;
  margin-bottom: var(--space-lg);
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .bill-detail-hero {
  background: linear-gradient(135deg, var(--bg-card), var(--blue-dark));
  border: 1px solid var(--border-color);
}

.bill-detail-hero::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-full);
}

.bill-detail-hero h2 {
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  margin-bottom: var(--space-sm);
}

.bill-detail-hero p {
  font-size: var(--fs-sm);
  opacity: 0.85;
  line-height: 1.6;
}

.bill-detail-category {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  margin-bottom: var(--space-md);
}

.pros-cons-section {
  margin-bottom: var(--space-lg);
}

.pros-cons-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
}

.pros-cons-header .pro-icon {
  color: var(--pro-color);
}

.pros-cons-header .con-icon {
  color: var(--con-color);
}

.pro-con-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  font-size: var(--fs-sm);
  line-height: 1.6;
}

.pro-item {
  background: var(--pro-bg);
  color: var(--pro-color);
}

.con-item {
  background: var(--con-bg);
  color: var(--con-color);
}

.pro-con-item .item-icon {
  font-size: 1.1rem;
  min-width: 20px;
  margin-top: 1px;
}

.pro-con-item .item-text {
  flex: 1;
  color: var(--text-primary);
}

/* --- Progress Bars --- */
.progress-bar-container {
  margin-bottom: var(--space-lg);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
  font-size: var(--fs-sm);
}

.progress-label-text {
  font-weight: var(--fw-medium);
}

.progress-label-value {
  color: var(--text-muted);
  font-weight: var(--fw-semibold);
}

.progress-bar {
  height: 10px;
  background: var(--neutral-bg);
  border-radius: 5px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 1s ease;
  background: linear-gradient(90deg, var(--blue), var(--accent-light));
}

.progress-fill.red {
  background: linear-gradient(90deg, var(--red), var(--red-light));
}

.progress-fill.green {
  background: linear-gradient(90deg, var(--success), #34C76A);
}

/* --- Priority List --- */
.priority-list {
  counter-reset: priority;
}

.priority-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  cursor: pointer;
  transition: all var(--transition);
  counter-increment: priority;
}

.priority-item:hover {
  border-color: var(--accent);
  transform: translateX(4px);
}

.priority-item.selected {
  border-color: var(--accent);
  background: var(--neutral-bg);
}

.priority-rank {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--neutral-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--text-muted);
  min-width: 32px;
}

.priority-item.selected .priority-rank {
  background: var(--accent);
  color: white;
}

.priority-info {
  flex: 1;
}

.priority-info h4 {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  margin-bottom: 2px;
}

.priority-info p {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.priority-icon {
  font-size: 1.5rem;
}

/* --- Tags --- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 3px 10px;
  border-radius: var(--radius-lg);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
}

.tag-blue {
  background: rgba(10, 49, 97, 0.08);
  color: var(--blue);
}

[data-theme="dark"] .tag-blue {
  background: rgba(74, 143, 212, 0.15);
  color: var(--accent);
}

.tag-red {
  background: rgba(179, 25, 66, 0.08);
  color: var(--red);
}

[data-theme="dark"] .tag-red {
  background: rgba(224, 53, 75, 0.15);
  color: var(--cta);
}

.tag-green {
  background: var(--success-bg);
  color: var(--success);
}

/* --- Toast / Confirmation --- */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--success);
  color: white;
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-lg);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  box-shadow: 0 8px 30px rgba(27, 138, 78, 0.3);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
  background: var(--neutral-bg);
  padding: 4px;
  border-radius: var(--radius-md);
}

.tab {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* --- Back Button --- */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  background: none;
  border: none;
  color: var(--accent);
  font-family: var(--font);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  margin-bottom: var(--space-md);
  transition: color var(--transition);
}

.back-btn:hover {
  color: var(--accent-light);
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
}

/* --- Badge --- */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--cta);
  color: white;
  font-size: 0.65rem;
  font-weight: var(--fw-bold);
}

/* --- Divider --- */
.divider {
  height: 1px;
  background: var(--border-color);
  margin: var(--space-lg) 0;
}

/* --- Featured Card --- */
.featured-card {
  background: linear-gradient(135deg, var(--blue), var(--blue-light));
  color: white;
  border: none;
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .featured-card {
  background: linear-gradient(135deg, #1A3A60, #0A3161);
  border: 1px solid var(--border-color);
}

.featured-card::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -15%;
  width: 160px;
  height: 160px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
}

.featured-card h3 {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  margin-bottom: var(--space-sm);
}

.featured-card p {
  font-size: var(--fs-sm);
  opacity: 0.85;
  margin-bottom: var(--space-md);
  line-height: 1.6;
}

.featured-card .btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  backdrop-filter: blur(10px);
  width: auto;
}

.featured-card .btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* --- Responsive --- */
@media (min-width: 481px) {
  .app-container {
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
  }
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

/* --- Selection --- */
::selection {
  background: var(--accent);
  color: white;
}

/* --- Vote Confirmation Overlay --- */
.vote-confirmation {
  display: none;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--success-bg);
  border-radius: var(--radius-md);
  color: var(--success);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-sm);
  margin-top: var(--space-sm);
  animation: fadeIn 0.3s ease;
}

.vote-confirmation.show {
  display: flex;
}

/* --- Loading shimmer --- */
@keyframes shimmer {
  0% {
    background-position: -200px 0;
  }

  100% {
    background-position: 200px 0;
  }
}

.skeleton {
  background: linear-gradient(90deg, var(--neutral-bg) 25%, var(--border-color) 50%, var(--neutral-bg) 75%);
  background-size: 400px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* --- Notification Bell --- */
.notif-bell {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  transition: all var(--transition);
}

.notif-bell:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--cta);
  color: white;
  font-size: 0.6rem;
  font-weight: var(--fw-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  animation: badgePulse 2s ease infinite;
}

.notif-badge.hidden {
  display: none;
}

@keyframes badgePulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.15);
  }
}

/* --- Nav notification dot --- */
.nav-notif-dot {
  position: absolute;
  top: -2px;
  right: -4px;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--cta);
}

.nav-notif-dot.hidden {
  display: none;
}

/* --- Notification Panel (slide-out) --- */
.notif-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.notif-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.notif-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 380px;
  height: 100vh;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  z-index: 160;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.notif-panel.open {
  transform: translateX(0);
}

.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-color);
}

.notif-panel-header h3 {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
}

.notif-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.notif-close:hover {
  background: var(--cta);
  color: white;
  border-color: var(--cta);
}

.notif-panel-actions {
  padding: var(--space-sm) var(--space-lg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
}

.notif-panel-actions .btn {
  width: auto;
}

.notif-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md);
}

/* --- Notification Items --- */
.notif-item {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
}

.notif-item:hover {
  background: var(--neutral-bg);
}

.notif-item.unread {
  background: var(--neutral-bg);
  border-color: var(--border-color);
}

.notif-item-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.notif-item-icon.meeting {
  background: rgba(10, 49, 97, 0.1);
}

[data-theme="dark"] .notif-item-icon.meeting {
  background: rgba(74, 143, 212, 0.15);
}

.notif-item-icon.deadline {
  background: rgba(179, 25, 66, 0.1);
}

[data-theme="dark"] .notif-item-icon.deadline {
  background: rgba(224, 53, 75, 0.15);
}

.notif-item-icon.reminder {
  background: rgba(212, 134, 10, 0.1);
}

[data-theme="dark"] .notif-item-icon.reminder {
  background: rgba(240, 168, 48, 0.15);
}

.notif-item-icon.info {
  background: var(--success-bg);
}

.notif-item-content {
  flex: 1;
  min-width: 0;
}

.notif-item-title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  margin-bottom: 2px;
  line-height: 1.4;
}

.notif-item-desc {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  line-height: 1.5;
}

.notif-item-time {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.notif-unread-dot {
  width: 8px;
  height: 8px;
  min-width: 8px;
  border-radius: var(--radius-full);
  background: var(--accent);
  margin-top: 4px;
}

/* --- Alert Cards (full view) --- */
.alert-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-md);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.alert-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

.alert-card.type-meeting::before {
  background: var(--accent);
}

.alert-card.type-deadline::before {
  background: var(--cta);
}

.alert-card.type-reminder::before {
  background: var(--warning);
}

.alert-card.type-info::before {
  background: var(--success);
}

.alert-card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.alert-card-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.alert-card-icon.meeting {
  background: rgba(10, 49, 97, 0.1);
}

.alert-card-icon.deadline {
  background: rgba(179, 25, 66, 0.1);
}

.alert-card-icon.reminder {
  background: rgba(212, 134, 10, 0.1);
}

.alert-card-icon.info {
  background: var(--success-bg);
}

[data-theme="dark"] .alert-card-icon.meeting {
  background: rgba(74, 143, 212, 0.15);
}

[data-theme="dark"] .alert-card-icon.deadline {
  background: rgba(224, 53, 75, 0.15);
}

[data-theme="dark"] .alert-card-icon.reminder {
  background: rgba(240, 168, 48, 0.15);
}

.alert-card-title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  margin-bottom: 2px;
}

.alert-card-date {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.alert-card-body {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  padding-left: calc(44px + var(--space-md));
}

.alert-countdown {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 3px 10px;
  border-radius: var(--radius-lg);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  margin-top: var(--space-sm);
}

.alert-countdown.urgent {
  background: rgba(179, 25, 66, 0.1);
  color: var(--cta);
}

[data-theme="dark"] .alert-countdown.urgent {
  background: rgba(224, 53, 75, 0.15);
}

.alert-countdown.soon {
  background: rgba(212, 134, 10, 0.1);
  color: var(--warning);
}

[data-theme="dark"] .alert-countdown.soon {
  background: rgba(240, 168, 48, 0.15);
}

.alert-countdown.upcoming {
  background: rgba(10, 49, 97, 0.08);
  color: var(--accent);
}

[data-theme="dark"] .alert-countdown.upcoming {
  background: rgba(74, 143, 212, 0.15);
}