/* ── Isadora Duncan Awards — Voting System ──────────────────── */

:root {
  --bg: #faf8f5;
  --card-bg: #ffffff;
  --text: #2d2a26;
  --text-light: #6b6560;
  --text-muted: #9a938b;
  --primary: #6b4c3b;
  --primary-light: #8a6d5b;
  --primary-dark: #4e372a;
  --accent: #c08b5c;
  --accent-light: #d4a574;
  --success: #4a7c59;
  --success-bg: #e8f5ec;
  --warning: #b8860b;
  --warning-bg: #fdf6e3;
  --info: #4a6fa5;
  --info-bg: #e8f0fa;
  --border: #e5dfd8;
  --border-light: #f0ebe5;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(45, 42, 38, 0.08);
  --shadow-lg: 0 4px 12px rgba(45, 42, 38, 0.12);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ── Typography ──────────────────────────────────────────────── */

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 0.25rem;
}

h2 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--primary-dark);
}

h4 {
  font-size: 0.95rem;
  font-weight: 600;
}

.subtitle {
  color: var(--text-light);
  font-size: 0.95rem;
}

.hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
}

.back-link:hover {
  color: var(--primary);
}

/* ── Layout ──────────────────────────────────────────────────── */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

.vote-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

@media (max-width: 768px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* ── Nav ─────────────────────────────────────────────────────── */

.admin-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--primary-dark);
  color: white;
}

.nav-brand a {
  color: white;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-user {
  font-size: 0.85rem;
  opacity: 0.8;
}

/* ── Cards ───────────────────────────────────────────────────── */

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

.card-header {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-light);
}

.card-header h2 {
  margin: 0;
}

/* ── Login ───────────────────────────────────────────────────── */

.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}

.login-card {
  background: white;
  padding: 2.5rem;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
}

.login-card h1 {
  text-align: center;
  margin-bottom: 0.25rem;
}

.login-card .subtitle {
  text-align: center;
  margin-bottom: 1.5rem;
}

/* ── Forms ───────────────────────────────────────────────────── */

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 0.35rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="file"],
select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: var(--text);
  background: white;
  transition: border-color 0.15s;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(107, 76, 59, 0.1);
}

.inline-form {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.inline-form .form-group {
  margin-bottom: 0;
  flex: 1;
  min-width: 200px;
}

.upload-form {
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--bg);
  border-radius: var(--radius);
}

/* ── Buttons ─────────────────────────────────────────────────── */

.btn {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all 0.15s ease;
  background: white;
  color: var(--text);
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

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

.btn-green {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.btn-blue {
  background: var(--info);
  color: white;
  border-color: var(--info);
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.75rem 2rem;
  font-size: 1.05rem;
}

.btn-full {
  width: 100%;
}

.btn-outline {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.3);
  color: white;
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ── Badges ──────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-lg {
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
}

.badge-gray {
  background: #eee;
  color: #666;
}

.badge-green {
  background: var(--success-bg);
  color: var(--success);
}

.badge-blue {
  background: var(--info-bg);
  color: var(--info);
}

.badge-yellow {
  background: var(--warning-bg);
  color: var(--warning);
}

/* ── Alerts ──────────────────────────────────────────────────── */

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-error {
  background: #fde8e8;
  color: #c0392b;
  border: 1px solid #f5c6c0;
}

/* ── Tables ──────────────────────────────────────────────────── */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  color: var(--text-light);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
}

.table a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.table a:hover {
  text-decoration: underline;
}

.table-sm {
  font-size: 0.8rem;
}

.table-sm th,
.table-sm td {
  padding: 0.35rem 0.5rem;
}

.actions {
  white-space: nowrap;
}

.actions .btn {
  margin-right: 0.35rem;
}

/* ── Page Header ─────────────────────────────────────────────── */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* ── Status Actions ──────────────────────────────────────────── */

.status-actions {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.vote-link-box,
.share-link-box {
  flex: 1;
  min-width: 250px;
}

.vote-link-box label,
.share-link-box label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 0.35rem;
}

.copy-link {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.copy-link code {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  overflow-x: auto;
}

.vote-progress {
  font-size: 0.9rem;
  color: var(--text-light);
}

/* ── Empty States ────────────────────────────────────────────── */

.empty-state,
.empty-hint {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

/* ── Voting Page ─────────────────────────────────────────────── */

.vote-header {
  text-align: center;
  padding: 2rem 0 1.5rem;
}

.voter-select-card {
  max-width: 400px;
  margin: 2rem auto;
  text-align: center;
}

.voter-dropdown {
  font-size: 1.05rem;
  padding: 0.75rem;
  margin-bottom: 1rem;
}

.voter-banner {
  background: var(--primary-dark);
  color: white;
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  text-align: center;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.matrix-instructions {
  text-align: center;
  margin-bottom: 1rem;
  color: var(--text-light);
  font-size: 0.9rem;
}

/* Matrix wrapper & sticky styles are in the page <style> tag 
   because they need dynamic column widths */

/* ── Confirmation Section ────────────────────────────────────── */

.confirmation-section {
  margin-top: 2rem;
  text-align: center;
}

.ranking-preview {
  max-width: 400px;
  margin: 1rem auto;
  text-align: left;
}

.preview-item {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
  gap: 0.75rem;
}

.preview-rank {
  font-weight: 700;
  color: var(--accent);
  min-width: 40px;
  font-size: 0.9rem;
}

.preview-name {
  color: var(--text);
}

.confirmation-text {
  margin: 1rem 0;
  color: var(--text-light);
}

.thank-you-card {
  text-align: center;
  max-width: 500px;
  margin: 3rem auto;
  padding: 2.5rem;
}

.thank-you-card h1 {
  margin-bottom: 0.75rem;
}

/* ── Results ─────────────────────────────────────────────────── */

.results-summary {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  font-size: 0.95rem;
  color: var(--text-light);
}

.results-table .position {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary);
  width: 60px;
}

.results-table .points {
  font-weight: 700;
  font-size: 1.05rem;
}

.results-table .spread {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.results-table tr.top-1 {
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.1), transparent);
}

.results-table tr.top-2 {
  background: linear-gradient(90deg, rgba(192, 192, 192, 0.15), transparent);
}

.results-table tr.top-3 {
  background: linear-gradient(90deg, rgba(205, 127, 50, 0.1), transparent);
}

/* ── Ballot Cards ────────────────────────────────────────────── */

.ballot-card {
  padding: 0.75rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}

.ballot-card h4 {
  margin-bottom: 0.15rem;
}

/* ── Voter Chips (shared results) ────────────────────────────── */

.voter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.voter-chip {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border-radius: 16px;
  font-size: 0.8rem;
  font-weight: 600;
}

.voter-chip.voted {
  background: var(--success-bg);
  color: var(--success);
}

.voter-chip.pending {
  background: #f5f5f5;
  color: var(--text-muted);
}

.results-footer {
  text-align: center;
  margin-top: 2rem;
  padding-bottom: 2rem;
}

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 768px) {
  .container,
  .vote-container {
    padding: 1rem;
  }

  .inline-form {
    flex-direction: column;
  }

  .inline-form .form-group {
    min-width: 100%;
  }

  .page-header {
    flex-direction: column;
    gap: 0.75rem;
  }

  .status-actions {
    flex-direction: column;
    align-items: stretch;
  }
}
