/* ============================================================
   PollPoll Brand Theme
   Based on BRAND-STYLEGUIDE.md - iris/teal/amber accents,
   Sora/DM Sans/JetBrains Mono typography, parchment/obsidian surfaces
   WCAG 2.1 AA compliant
   ============================================================ */

/* --- Accent Colors (constant across light and dark mode) --- */
:root {
  --iris: #7C63A8;
  --iris-soft: #A688D4;
  --iris-deep: #5C4888;
  --teal: #3AAFA9;
  --teal-soft: #60CECA;
  --teal-deep: #2A8A85;
  --amber: #C47F55;

  /* Chart colors */
  --chart-1: #7C63A8;
  --chart-2: #3AAFA9;
  --chart-3: #C47F55;
  --chart-4: #A688D4;
  --chart-5: #60CECA;
  --chart-6: #5C4888;

  /* Spacing scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 40px;
  --space-2xl: 64px;

  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 999px;

  /* Typography */
  --font-display: 'Sora', system-ui, sans-serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

/* --- Light Mode (default) --- */
:root,
[data-theme="light"] {
  --bg: #F5EFE6;
  --surface: #EDE6D9;
  --surface-2: #E3DACB;
  --border: #CEC6B8;
  --text-1: #2A2420;
  --text-2: #6E6560;
  --text-3: #A8A098;
  --code-bg: #EDE8DF;

  --success: #2A8A85;
  --error: #B03A48;
  --warning: #C47F55;
  --info: #7C63A8;
}

/* --- Dark Mode --- */
[data-theme="dark"] {
  --bg: #1A1714;
  --surface: #231F1B;
  --surface-2: #2D2924;
  --border: #3D3830;
  --text-1: #F0E8DC;
  --text-2: #9A9088;
  --text-3: #6A6258;
  --code-bg: #2D2924;

  --success: #3AAFA9;
  --error: #E06C75;
  --warning: #C47F55;
  --info: #A688D4;
}

/* ============================================================
   Base Styles
   ============================================================ */

html {
  font-size: 15px;
  background-color: var(--bg);
  color: var(--text-1);
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
  background-color: var(--bg);
  color: var(--text-1);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.65;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text-1);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.2rem; }

code, kbd, pre {
  font-family: var(--font-mono);
}

a {
  color: var(--iris);
}

a:hover {
  color: var(--iris-deep);
}

/* ============================================================
   Skip Link (WCAG 2.1 AA)
   ============================================================ */

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--iris);
  color: #fff;
  padding: var(--space-sm);
  text-decoration: none;
  z-index: 100;
  font-family: var(--font-body);
}

.skip-link:focus {
  top: 0;
}

/* ============================================================
   Focus Styles (WCAG 2.1 AA)
   ============================================================ */

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem var(--bg), 0 0 0 0.25rem var(--iris);
  outline: 2px solid var(--iris);
  outline-offset: 2px;
}

input[type="radio"]:focus,
input[type="checkbox"]:focus {
  outline: 2px solid var(--iris);
  outline-offset: 2px;
}

.option-label:has(:focus) {
  border-color: var(--iris);
  box-shadow: 0 0 0 3px rgba(124, 99, 168, 0.25);
}

/* ============================================================
   Navbar
   ============================================================ */

.navbar {
  background-color: var(--surface);
  border-color: var(--border) !important;
}

.navbar-brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--iris) !important;
  letter-spacing: -0.02em;
}

.navbar-brand:hover {
  color: var(--iris-deep) !important;
}

.nav-link {
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--text-1) !important;
  font-size: 0.95rem;
}

.nav-link:hover {
  color: var(--iris) !important;
}

/* ============================================================
   Footer
   ============================================================ */

.footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  white-space: nowrap;
  line-height: 60px;
  height: 60px;
  background-color: var(--surface) !important;
  border-color: var(--border) !important;
  color: var(--text-3);
  font-family: var(--font-body);
  font-size: 0.82rem;
}

.footer a {
  color: var(--iris);
}

.footer a:hover {
  color: var(--iris-deep);
}

/* ============================================================
   Buttons (Brand Style Guide)
   ============================================================ */

.btn {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.9rem;
  border-radius: var(--radius-md);
  padding: 0.55rem 1.3rem;
  transition: all 0.2s ease;
}

.btn-primary {
  background-color: var(--iris);
  border-color: var(--iris);
  color: #fff;
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--iris-deep);
  border-color: var(--iris-deep);
  color: #fff;
}

.btn-outline-primary {
  color: var(--iris);
  border-color: var(--iris);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
  background-color: var(--iris);
  border-color: var(--iris);
  color: #fff;
}

.btn-success {
  background-color: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.btn-success:hover,
.btn-success:focus {
  background-color: var(--teal-deep);
  border-color: var(--teal-deep);
  color: #fff;
}

.btn-outline-secondary {
  color: var(--text-2);
  border-color: var(--border);
  background-color: var(--surface);
}

.btn-outline-secondary:hover {
  background-color: var(--surface-2);
  border-color: var(--border);
  color: var(--text-1);
}

.btn-danger {
  background-color: var(--error);
  border-color: var(--error);
  color: #fff;
}

.btn-info {
  background-color: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.btn-info:hover,
.btn-info:focus {
  background-color: var(--teal-deep);
  border-color: var(--teal-deep);
  color: #fff;
}

.btn-warning {
  background-color: var(--amber);
  border-color: var(--amber);
  color: #fff;
}

.btn-warning:hover,
.btn-warning:focus {
  background-color: #A86A44;
  border-color: #A86A44;
  color: #fff;
}

.btn-secondary {
  background-color: var(--surface);
  border-color: var(--border);
  color: var(--text-2);
}

.btn-secondary:hover {
  background-color: var(--surface-2);
  border-color: var(--border);
  color: var(--text-1);
}

/* Ghost button (brand style) */
.btn-ghost {
  background-color: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
}

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

/* ============================================================
   Cards (Brand Style Guide)
   ============================================================ */

.card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  border-color: var(--iris);
  box-shadow: 0 0 0 3px rgba(124, 99, 168, 0.12);
}

.card-header {
  background-color: var(--surface-2);
  border-color: var(--border);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0 !important;
  color: var(--text-1);
  font-family: var(--font-display);
  font-weight: 600;
  padding: 1rem 1.5rem;
}

.card-body {
  padding: 1.5rem;
}

.card-footer {
  background-color: var(--surface);
  border-color: var(--border);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl) !important;
}

/* ============================================================
   Badges (Brand Style Guide - pill-shaped, JetBrains Mono)
   ============================================================ */

.badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  border-radius: var(--radius-pill);
  padding: 0.35em 0.85em;
}

.badge.bg-primary {
  background-color: var(--iris) !important;
}

.badge.bg-info {
  background-color: var(--teal) !important;
  color: #fff !important;
}

.badge.bg-success {
  background-color: var(--teal) !important;
  color: #fff !important;
}

.badge.bg-danger {
  background-color: var(--error) !important;
}

.badge.bg-warning {
  background-color: var(--amber) !important;
  color: #fff !important;
}

.badge.bg-secondary {
  background-color: var(--surface-2) !important;
  color: var(--text-2) !important;
}

.badge.bg-light {
  background-color: var(--surface) !important;
}

/* ============================================================
   Forms
   ============================================================ */

.form-label {
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--text-1);
  font-size: 0.95rem;
}

.form-control {
  background-color: var(--bg);
  border-color: var(--border);
  color: var(--text-1);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
}

.form-control:focus {
  background-color: var(--bg);
  border-color: var(--iris);
  color: var(--text-1);
}

.form-text {
  color: var(--text-3);
  font-size: 0.82rem;
}

.form-check-label {
  font-family: var(--font-body);
  color: var(--text-1);
}

.input-group-text {
  background-color: var(--surface-2);
  border-color: var(--border);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
  color: var(--text-3);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ============================================================
   Alerts (Brand colors)
   ============================================================ */

.alert-success {
  background-color: rgba(58, 175, 169, 0.12);
  border-color: var(--teal);
  color: var(--teal-deep);
}

.alert-danger {
  background-color: rgba(176, 58, 72, 0.12);
  border-color: var(--error);
  color: var(--error);
}

.alert-info {
  background-color: rgba(124, 99, 168, 0.12);
  border-color: var(--iris);
  color: var(--iris-deep);
}

.alert-warning {
  background-color: rgba(196, 127, 85, 0.12);
  border-color: var(--amber);
  color: #8F5522;
}

/* ============================================================
   List Groups
   ============================================================ */

.list-group-item {
  background-color: var(--bg);
  border-color: var(--border);
  color: var(--text-1);
  font-family: var(--font-body);
}

/* ============================================================
   Tables (brand override)
   ============================================================ */

.table {
  color: var(--text-1);
}

.table thead th {
  background-color: var(--iris);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  border: none;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: var(--surface);
  color: var(--text-1);
}

.table-striped > tbody > tr:nth-of-type(even) > * {
  background-color: var(--bg);
  color: var(--text-1);
}

.table-hover > tbody > tr:hover > * {
  background-color: var(--surface-2);
  color: var(--text-1);
}

/* ============================================================
   Modals (brand override)
   ============================================================ */

.modal-content {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
}

.modal-header {
  border-color: var(--border);
  font-family: var(--font-display);
}

.modal-header.bg-primary {
  background-color: var(--iris) !important;
}

.modal-footer {
  border-color: var(--border);
}

/* ============================================================
   Voting Page Styles
   ============================================================ */

.vote-container {
  max-width: 600px;
  margin: var(--space-xl) auto;
  padding: var(--space-md);
}

.poll-question {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text-1);
  line-height: 1.15;
}

.options-list {
  margin-bottom: 1.5rem;
}

.option-item {
  margin-bottom: 0.75rem;
}

.option-label {
  display: flex;
  align-items: center;
  padding: 1rem;
  background-color: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-body);
  font-size: 1.05rem;
  min-height: 60px;
}

.option-label:hover {
  background-color: var(--surface-2);
  border-color: var(--iris);
}

.option-label input[type="radio"],
.option-label input[type="checkbox"] {
  width: 24px;
  height: 24px;
  margin-right: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: var(--iris);
}

.option-text {
  flex-grow: 1;
  font-size: 1.05rem;
  color: var(--text-1);
}

.btn-submit {
  width: 100%;
  padding: 1rem;
  font-size: 1.25rem;
  font-weight: 600;
  min-height: 60px;
  font-family: var(--font-display);
}

.error-message,
.poll-closed {
  text-align: center;
  padding: var(--space-xl);
}

.closed-message {
  color: var(--error);
  font-weight: 600;
  font-size: 1.25rem;
}

.info-message {
  background-color: rgba(124, 99, 168, 0.1);
  color: var(--text-1);
  padding: 0.75rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  border: 1px solid var(--iris);
  font-family: var(--font-body);
}

/* Mobile optimization */
@media (max-width: 576px) {
  .vote-container {
    padding: 0.5rem;
  }

  .poll-question {
    font-size: 1.2rem;
  }

  .option-label {
    padding: 0.75rem;
    font-size: 1rem;
  }

  .option-text {
    font-size: 1rem;
  }
}

/* ============================================================
   Poll Group Navigation Styles
   ============================================================ */

.poll-group-progress {
  margin-bottom: 1.5rem;
  text-align: center;
}

.progress-text {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-2);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.progress-indicators {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  align-items: center;
}

.progress-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--border);
  display: inline-block;
  transition: all 0.3s ease;
}

.progress-dot.current {
  background-color: var(--iris);
  width: 16px;
  height: 16px;
}

.progress-dot.answered {
  background-color: var(--teal);
}

.poll-group-navigation {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  justify-content: center;
}

.btn-skip {
  background-color: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border);
}

.btn-skip:hover {
  background-color: var(--surface-2);
  color: var(--text-1);
}

.btn-next {
  background-color: var(--iris);
  color: #fff;
}

.btn-next:hover {
  background-color: var(--iris-deep);
  color: #fff;
}

.poll-group-complete {
  margin-top: 1.5rem;
  text-align: center;
  padding: 1rem;
  background-color: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.poll-group-complete p {
  margin-bottom: 1rem;
  color: var(--text-2);
}

/* ============================================================
   Display Mode Toggle (Dashboard)
   ============================================================ */

.display-mode-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-2);
}

.display-mode-toggle .toggle-label {
  font-weight: 500;
}

.toggle-switch {
  position: relative;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  transition: all 0.3s ease;
}

.toggle-slider::before {
  content: "";
  font-size: 14px;
  line-height: 22px;
  text-align: center;
  position: absolute;
  height: 22px;
  width: 22px;
  left: 2px;
  bottom: 2px;
  background-color: var(--amber);
  border-radius: 50%;
  transition: all 0.3s ease;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--iris-deep);
  border-color: var(--iris);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(24px);
  background-color: var(--iris);
}

.toggle-switch input:focus + .toggle-slider {
  box-shadow: 0 0 0 3px rgba(124, 99, 168, 0.25);
}

/* ============================================================
   Eyebrow Labels (Brand Style Guide)
   ============================================================ */

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--iris);
}

.eyebrow.teal {
  color: var(--teal);
}

.eyebrow.amber {
  color: var(--amber);
}

/* ============================================================
   Spinner & Loading
   ============================================================ */

.spinner-border.text-primary {
  color: var(--iris) !important;
}

/* ============================================================
   Misc Utility Overrides
   ============================================================ */

.text-muted {
  color: var(--text-3) !important;
}

.text-primary {
  color: var(--iris) !important;
}

.text-success {
  color: var(--teal) !important;
}

.text-danger {
  color: var(--error) !important;
}

.text-info {
  color: var(--teal) !important;
}

.text-warning {
  color: var(--amber) !important;
}

.border-success {
  border-color: var(--teal) !important;
}

.border-primary {
  border-color: var(--iris) !important;
}

.bg-primary {
  background-color: var(--iris) !important;
}

.bg-success {
  background-color: var(--teal) !important;
}

.bg-secondary {
  background-color: var(--surface-2) !important;
}

.bg-info {
  background-color: var(--teal) !important;
}
