/* ==========================================================================
   CivicAI Global Styles & Resets
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Accessible focus visible ring */
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 3px;
}

/* Typography styles */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-primary);
  line-height: 1.25;
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
}

p {
  color: var(--text-secondary);
}

a {
  color: var(--color-brand-blue);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-brand-blue-hover);
}

img, svg {
  display: block;
  max-width: 100%;
}

button, input, select, textarea {
  font: inherit;
}

/* Layout Utilities */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.container-narrow {
  max-width: var(--container-narrow);
}

.section {
  padding: 5rem 0;
  position: relative;
}

.section-subtle {
  background-color: var(--bg-surface-subtle);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.section-header {
  text-align: center;
  margin-bottom: 3.5rem;
}

.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: var(--fw-semibold);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background-color: var(--color-brand-blue-light);
  color: var(--color-brand-blue);
  border: 1px solid var(--color-brand-blue-border);
  margin-bottom: 0.875rem;
}

.section-title {
  font-size: 2.25rem;
  margin-bottom: 1rem;
}

.section-subtitle {
  font-size: 1.125rem;
  max-width: 650px;
  margin-left: auto;
  margin-right: auto;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: var(--fw-semibold);
  font-size: 0.9375rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--color-brand-blue);
  color: var(--text-inverse);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background-color: var(--color-brand-blue-hover);
  color: var(--text-inverse);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-subtle);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background-color: var(--bg-surface-subtle);
  border-color: var(--border-medium);
  transform: translateY(-1px);
}
/* Saved Scheme Button */
.save-scheme-btn.saved {
  background: var(--color-emerald-700);
  color: #ffffff;
  border-color: var(--color-emerald-700);
}

.save-scheme-btn.saved:hover {
  background: var(--color-emerald-600);
  color: #ffffff;
  border-color: var(--color-emerald-600);
}

.btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
}

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

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: var(--fw-semibold);
}

.badge-central {
  background-color: var(--color-brand-blue-light);
  color: var(--color-brand-blue);
  border: 1px solid var(--color-brand-blue-border);
}

.badge-state {
  background-color: var(--color-purple-50);
  color: var(--color-purple-600);
  border: 1px solid var(--color-purple-border);
}

.badge-mock {
  background-color: var(--color-saffron-50);
  color: var(--color-saffron-600);
  border: 1px solid var(--color-saffron-border);
}

.badge-verified {
  background-color: var(--color-emerald-50);
  color: var(--color-emerald-700);
  border: 1px solid var(--color-emerald-border);
}

/* Subtle background decorative shapes */
.bg-decor-radial {
  position: absolute;
  top: -10%;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 600px;
  background: radial-gradient(50% 50% at 50% 50%, rgba(37, 99, 235, 0.07) 0%, rgba(248, 250, 252, 0) 100%);
  pointer-events: none;
  z-index: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .section {
    padding: 3.5rem 0;
  }
  .section-title {
    font-size: 1.875rem;
  }
  .section-subtitle {
    font-size: 1rem;
  }
}
/* =====================================================
   Dark Mode — Primary Action Buttons
   ===================================================== */

[data-theme="dark"] .btn-primary {
  background: #f59e0b !important;
  color: #111827 !important;
  border-color: #f59e0b !important;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.18);
}

[data-theme="dark"] .btn-primary:hover {
  background: #fbbf24 !important;
  border-color: #fbbf24 !important;
  color: #0f172a !important;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.25);
}

[data-theme="dark"] .btn-primary:active {
  background: #d97706 !important;
  border-color: #d97706 !important;
}

/* =====================================================
   CivicAI Assistant
   ===================================================== */

#civic-ai-assistant {
  position: relative;
  z-index: 9999;
}

/* Floating button */
.civic-ai-chat-toggle {
  position: fixed;
  right: 24px;
  bottom: 24px;

  width: 58px;
  height: 58px;

  padding: 0;
  margin: 0;

  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  z-index: 10000;

  background: linear-gradient(
    135deg,
    var(--color-brand-blue),
    var(--color-purple-600)
  );

  color: #ffffff;
  box-shadow:
    0 12px 30px rgba(15, 23, 42, 0.28),
    0 0 0 6px rgba(37, 99, 235, 0.08);

  transition:
    transform var(--transition-normal),
    box-shadow var(--transition-normal);
}

.civic-ai-chat-toggle:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow:
    0 16px 35px rgba(15, 23, 42, 0.32),
    0 0 0 7px rgba(37, 99, 235, 0.10);
}

.civic-ai-chat-toggle svg {
  width: 25px;
  height: 25px;
  pointer-events: none;
}
/* Chat panel */
.civic-ai-chat-panel {
  position: fixed;
  right: 24px;
  bottom: 94px;

  width: min(390px, calc(100vw - 32px));
  height: min(600px, calc(100vh - 130px));

  display: flex;
  flex-direction: column;

  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;

  box-shadow:
    0 24px 60px rgba(15, 23, 42, 0.22),
    0 8px 20px rgba(15, 23, 42, 0.10);

  overflow: hidden;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(14px) scale(0.97);

  transition:
  opacity 120ms ease,
  transform 120ms ease,
  visibility 120ms ease;
}

.civic-ai-chat-panel.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Header */
.civic-ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 1rem 1.1rem;

  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.civic-ai-chat-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.civic-ai-chat-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;

  border-radius: 11px;

  background: linear-gradient(
    135deg,
    var(--color-brand-blue),
    var(--color-purple-600)
  );

  color: #ffffff;
}

.civic-ai-chat-brand strong {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.civic-ai-chat-brand span {
  display: block;
  margin-top: 2px;

  font-size: 0.72rem;
  color: var(--text-muted);
}

.civic-ai-chat-close {
  width: 34px;
  height: 34px;

  border: none;
  border-radius: 50%;

  display: grid;
  place-items: center;

  background: transparent;
  color: var(--text-muted);

  cursor: pointer;

  transition:
   background var(--transition-fast),
    color var(--transition-fast);
}

.civic-ai-chat-close:hover {
  background: var(--bg-surface-subtle);
  color: var(--text-primary);
}

/* Messages */
.civic-ai-chat-messages {
  flex: 1;
  overflow-y: auto;

  padding: 1rem;

  display: flex;
  flex-direction: column;
  gap: 1rem;

  background: var(--bg-body);
}

.civic-ai-message {
  display: flex;
  gap: 0.6rem;
  max-width: 88%;
}

.civic-ai-message-user {
  align-self: flex-end;
  justify-content: flex-end;
}

.civic-ai-message-bot {
  align-self: flex-start;
}

.civic-ai-message-avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;

  display: grid;
  place-items: center;

  border-radius: 9px;

  background: var(--color-brand-blue-light);
  color: var(--color-brand-blue);
}

.civic-ai-message-content {
  padding: 0.75rem 0.9rem;
  border-radius: 14px;

  font-size: 0.84rem;
  line-height: 1.55;

  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.civic-ai-message-user .civic-ai-message-content {
  background: var(--color-brand-blue);
  color: #ffffff;
  border-color: var(--color-brand-blue);
}

.civic-ai-message-content p {
  margin: 0;
}

.civic-ai-message-content p + p {
  margin-top: 0.55rem;
}

/* Input */
.civic-ai-chat-form {
  display: flex;
  align-items: center;
  gap: 0.6rem;

  padding: 0.8rem;

  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
}

.civic-ai-chat-form input {
  flex: 1;
  min-width: 0;

  height: 44px;
  padding: 0 0.9rem;

  border: 1px solid var(--border-subtle);
  border-radius: 12px;

  background: var(--bg-surface-subtle);
  color: var(--text-primary);

  outline: none;

  font-family: var(--font-body);
  font-size: 0.84rem;

  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.civic-ai-chat-form input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.10);
}

.civic-ai-chat-form button {
  width: 44px;
  height: 44px;

  flex: 0 0 44px;

  display: grid;
  place-items: center;

  border: none;
  border-radius: 12px;

  background: var(--color-brand-blue);
  color: #ffffff;

  cursor: pointer;

  transition:
    background var(--transition-fast),
    transform var(--transition-fast);
}

.civic-ai-chat-form button:hover {
  background: var(--color-brand-blue-hover);
  transform: translateY(-1px);
}

/* Mobile */
@media (max-width: 600px) {

  .civic-ai-chat-toggle {
    right: 16px;
    bottom: 16px;
    width: 54px;
    height: 54px;
  }

  .civic-ai-chat-panel {
    right: 12px;
    bottom: 82px;

    width: calc(100vw - 24px);
    height: min(600px, calc(100vh - 105px));

    border-radius: 18px;
  }
}
.civic-ai-chat-toggle.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.85);
}
.civic-ai-chat-form button {
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

.civic-ai-chat-form button svg {
  pointer-events: none;
}

.civic-ai-chat-toggle {
  pointer-events: auto;
}

.civic-ai-chat-toggle svg {
  pointer-events: none;
}
