/* Talk to Your Rep — minimal responsive CSS */

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

:root {
  --bg: #fafafa;
  --fg: #1a1a1a;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --border: #e5e7eb;
  --card-bg: #ffffff;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */

header {
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
}

header nav {
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-link {
  font-size: 0.875rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.nav-link:hover {
  text-decoration: underline;
}

.logo {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--fg);
  text-decoration: none;
}

.ai-banner {
  background: #fef3c7;
  color: #92400e;
  text-align: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* Main */

main {
  flex: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
  width: 100%;
}

/* Footer */

footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 1rem;
  font-size: 0.75rem;
  color: #6b7280;
}

/* Landing */

.hero {
  text-align: center;
  padding: 3rem 0;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.hero p {
  color: #4b5563;
  margin-bottom: 0.5rem;
}

.subtitle {
  font-size: 0.875rem;
  color: #9ca3af;
  margin-bottom: 2rem;
}

.zip-form {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.zip-form input {
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1.125rem;
  width: 200px;
  text-align: center;
}

.zip-form input:focus {
  outline: none;
  border-color: var(--primary);
}

.zip-form button,
.btn-primary,
.btn-talk {
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  cursor: pointer;
  font-weight: 600;
}

.zip-form button:hover,
.btn-primary:hover,
.btn-talk:hover {
  background: var(--primary-hover);
}

.btn-primary {
  display: inline-block;
  text-decoration: none;
  margin-top: 1.5rem;
}

/* HTMX loading indicator */

.htmx-indicator {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  color: #6b7280;
}

.htmx-indicator.htmx-request {
  display: flex;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Rep grid */

.rep-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
  text-align: left;
}

.rep-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.rep-info h3 {
  font-size: 1.125rem;
  margin-bottom: 0.25rem;
}

.rep-info .chamber {
  font-size: 0.875rem;
  color: #6b7280;
}

.party {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  margin-left: 0.5rem;
}

.party-D { background: #dbeafe; color: #1e40af; }
.party-R { background: #fee2e2; color: #991b1b; }
.party-I { background: #e5e7eb; color: #374151; }

.btn-talk {
  width: 100%;
  margin-top: 0.75rem;
}

.coming-soon {
  margin-top: 0.75rem;
  color: #9ca3af;
  font-style: italic;
  text-align: center;
}

.ambiguous-note {
  background: #eff6ff;
  color: #1e40af;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.error-card {
  background: #fef2f2;
  color: #991b1b;
  padding: 1rem;
  border-radius: var(--radius);
  text-align: center;
}

/* Chat */

.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 180px);
}

.chat-header {
  margin-bottom: 1rem;
}

.chat-header h2 {
  margin-bottom: 0.25rem;
}

.ai-disclosure {
  font-size: 0.8rem;
  color: #92400e;
  background: #fef3c7;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}

.turn-counter {
  font-size: 0.875rem;
  color: #6b7280;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.message {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  max-width: 85%;
  line-height: 1.5;
  white-space: pre-wrap;
}

.message.user {
  background: var(--primary);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}

.message.assistant {
  background: var(--card-bg);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 2px;
}

.message.typing {
  color: #9ca3af;
  font-style: italic;
}

.message.error {
  background: #fef2f2;
  color: #991b1b;
  align-self: center;
  font-size: 0.875rem;
}

.message.system {
  color: #6b7280;
  align-self: center;
  font-size: 0.875rem;
}

#chat-form {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

#chat-form input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
}

#chat-form input:focus {
  outline: none;
  border-color: var(--primary);
}

#chat-form button {
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  cursor: pointer;
  font-weight: 600;
}

#chat-form button:hover {
  background: var(--primary-hover);
}

#chat-form button:disabled,
#chat-form input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Thank you */

.thankyou {
  text-align: center;
  padding: 3rem 0;
}

.thankyou h1 {
  margin-bottom: 1.5rem;
}

.summary-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 500px;
  margin: 0 auto;
  box-shadow: var(--shadow);
}

.summary-card p {
  margin-bottom: 0.75rem;
}

.future-note {
  font-size: 0.875rem;
  color: #6b7280;
  font-style: italic;
}

/* Mobile responsive */

@media (max-width: 640px) {
  .hero h1 {
    font-size: 1.75rem;
  }

  .zip-form {
    flex-direction: column;
    align-items: center;
  }

  .zip-form input {
    width: 100%;
    max-width: 300px;
  }

  .zip-form button {
    width: 100%;
    max-width: 300px;
  }

  .message {
    max-width: 95%;
  }
}

/* Debate */

.debate-container {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 180px);
}

.debate-setup {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.debate-setup h2 {
  margin-bottom: 0.5rem;
}

.debate-setup > p {
  color: #6b7280;
  margin-bottom: 1.5rem;
}

.debate-pickers {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.picker {
  flex: 1;
  position: relative;
  text-align: left;
}

.picker label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
}

.picker input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
}

.picker input:focus {
  outline: none;
  border-color: var(--primary);
}

.picker-vs {
  padding-top: 1.75rem;
  font-weight: 700;
  color: #6b7280;
  font-size: 1.125rem;
}

.picker-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 10;
  max-height: 200px;
  overflow-y: auto;
}

.picker-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.875rem;
}

.picker-option:hover {
  background: #f3f4f6;
}

.picker-selected {
  margin-top: 0.375rem;
  font-size: 0.875rem;
  min-height: 1.5rem;
}

.picker-state {
  color: #6b7280;
  font-size: 0.75rem;
}

.topic-picker {
  text-align: left;
  margin-bottom: 1.5rem;
}

.topic-picker label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
}

.topic-picker select,
.topic-picker input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.debate-chat {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.debate-chat-header {
  margin-bottom: 0.5rem;
}

.debate-chat-header h2 {
  margin-bottom: 0.25rem;
}

.debate-chat-header p {
  color: #6b7280;
  font-size: 0.875rem;
}

.debate-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.debate-message {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  max-width: 85%;
  border-left: 4px solid transparent;
  background: var(--card-bg);
  border: 1px solid var(--border);
}

.debate-message.party-D {
  border-left: 4px solid #2563eb;
  background: #eff6ff;
  align-self: flex-start;
}

.debate-message.party-R {
  border-left: 4px solid #dc2626;
  background: #fef2f2;
  align-self: flex-end;
}

.debate-message.moderator {
  border-left: 4px solid #6b7280;
  background: #f9fafb;
  align-self: center;
  font-style: italic;
  max-width: 90%;
}

.debate-message.done {
  border-left: 4px solid #6b7280;
  background: #f9fafb;
  align-self: center;
  font-style: italic;
}

.debate-message.error {
  background: #fef2f2;
  color: #991b1b;
  align-self: center;
  border-left-color: #991b1b;
}

.debate-message.thinking {
  opacity: 0.7;
}

.debate-msg-speaker {
  font-weight: 600;
  font-size: 0.8rem;
  margin-bottom: 0.375rem;
}

.debate-msg-text {
  line-height: 1.5;
  white-space: pre-wrap;
}

.party-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.0625rem 0.375rem;
  border-radius: 3px;
}

.party-badge.party-D {
  background: #dbeafe;
  color: #1e40af;
}

.party-badge.party-R {
  background: #fee2e2;
  color: #991b1b;
}

.party-badge.party-I {
  background: #e5e7eb;
  color: #374151;
}

.thinking-indicator {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem 0;
}

.thinking-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
  animation: pulse-dot 1.4s infinite ease-in-out;
}

.thinking-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.thinking-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes pulse-dot {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* Streaming cursor */

.debate-msg-text.streaming::after {
  content: "\2588";
  animation: blink-cursor 0.8s step-end infinite;
  margin-left: 1px;
  color: #6b7280;
}

@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Phase progress bar */

.debate-phase-bar {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 0;
  margin-bottom: 0.75rem;
  overflow-x: auto;
}

.debate-phase-bar .phase-label {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  background: #f3f4f6;
  color: #9ca3af;
  white-space: nowrap;
  transition: background 0.3s, color 0.3s;
}

.debate-phase-bar .phase-label.active {
  background: var(--primary);
  color: white;
}

.debate-phase-bar .phase-label.done {
  background: #d1fae5;
  color: #065f46;
}

/* Cross-examination variant */

.debate-message.cross-exam {
  border-left: 4px solid #d97706;
  background: #fffbeb;
  align-self: center;
  font-style: italic;
  max-width: 90%;
}

@media (max-width: 640px) {
  .debate-pickers {
    flex-direction: column;
  }

  .picker-vs {
    padding-top: 0;
    text-align: center;
  }

  .debate-message {
    max-width: 95%;
  }
}
