/* ============================================================
   HORUS HERESY TRACKER - Grimdark Theme
   ============================================================ */

/* ── CSS Custom Properties ─────────────────────────────────── */
:root {
  --bg-primary: #0A0A0A;
  --bg-secondary: #141414;
  --bg-tertiary: #1E1E1E;
  --bg-card: #161616;
  --bg-card-hover: #1C1C1C;
  --gold-primary: #C9A84C;
  --gold-secondary: #A68A3E;
  --gold-dim: #7A6830;
  --gold-glow: rgba(201, 168, 76, 0.3);
  --red-primary: #8B0000;
  --red-secondary: #B22222;
  --red-glow: rgba(139, 0, 0, 0.3);
  --text-primary: #E0D5C0;
  --text-secondary: #A09880;
  --text-muted: #605848;
  --status-read: #2E7D32;
  --status-read-bg: rgba(46, 125, 50, 0.15);
  --status-reading: #F9A825;
  --status-reading-bg: rgba(249, 168, 37, 0.15);
  --status-unread: #424242;
  --status-unread-bg: rgba(66, 66, 66, 0.15);
  --border-color: #2A2520;
  --border-light: #3A3530;
  --tag-really-good: #C9A84C;
  --tag-good: #4CAF50;
  --tag-ok-meh: #FF9800;
  --tag-bad: #f44336;
  --modal-backdrop: rgba(0, 0, 0, 0.85);
  --card-radius: 6px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Source Sans Pro', 'Segoe UI', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
}

h1, h2, h3, h4 {
  font-family: 'Cinzel', 'Times New Roman', serif;
  font-weight: 700;
  letter-spacing: 0.05em;
}

a {
  color: var(--gold-primary);
  text-decoration: none;
}

a:hover {
  color: var(--gold-secondary);
  text-decoration: underline;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 6px 10px;
  outline: none;
  transition: border-color var(--transition-fast);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--gold-dim);
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gold-dim);
}

/* ── Header ────────────────────────────────────────────────── */
#app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: linear-gradient(180deg, #1A1510 0%, var(--bg-primary) 100%);
  border-bottom: 2px solid var(--gold-dim);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.aquila {
  font-size: 28px;
  color: var(--gold-primary);
  line-height: 1;
}

.header-left h1 {
  font-family: 'Cinzel Decorative', 'Cinzel', serif;
  font-size: 1.4rem;
  color: var(--gold-primary);
  text-shadow: 0 0 20px rgba(201, 168, 76, 0.3);
}

.header-stats {
  display: flex;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.header-stats .stat {
  display: flex;
  align-items: center;
  gap: 5px;
}

.header-stats .stat-value {
  color: var(--gold-primary);
  font-weight: 600;
}

/* ── View Controls / Nav ───────────────────────────────────── */
#view-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 10px;
}

.view-tabs {
  display: flex;
  gap: 4px;
}

.view-tab {
  padding: 8px 20px;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: all var(--transition-normal);
  letter-spacing: 0.05em;
}

.view-tab:hover {
  color: var(--text-secondary);
}

.view-tab.active {
  color: var(--gold-primary);
  border-bottom-color: var(--gold-primary);
}

.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-bar input[type="text"] {
  width: 220px;
  padding: 7px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
}

.filter-bar select {
  padding: 7px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  min-width: 140px;
}

/* ── Main Content ──────────────────────────────────────────── */
#main-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.view-container {
  display: none;
  height: 100%;
}

.view-container.active {
  display: block;
}

/* ── Card View ─────────────────────────────────────────────── */
#card-view {
  overflow-y: auto;
  padding: 20px 24px;
  height: calc(100vh - 170px);
}

/* Arc Group */
.arc-group {
  margin-bottom: 28px;
}

.arc-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  cursor: pointer;
  transition: background var(--transition-fast);
  margin-bottom: 12px;
  user-select: none;
}

.arc-group-header:hover {
  background: var(--bg-tertiary);
}

.arc-group-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.arc-color-bar {
  width: 4px;
  height: 28px;
  border-radius: 2px;
}

.arc-group-header h3 {
  font-size: 0.95rem;
  color: var(--text-primary);
}

.arc-group-header .arc-desc {
  font-family: 'Source Sans Pro', sans-serif;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 8px;
}

.arc-book-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: 10px;
}

.arc-collapse-icon {
  color: var(--text-muted);
  font-size: 0.8rem;
  transition: transform var(--transition-fast);
}

.arc-group.collapsed .arc-collapse-icon {
  transform: rotate(-90deg);
}

.arc-group.collapsed .arc-books-grid {
  display: none;
}

/* Card Grid */
.arc-books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

/* Book Card */
.book-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 14px;
  cursor: pointer;
  transition: all var(--transition-normal);
  overflow: hidden;
}

.book-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--card-radius) var(--card-radius) 0 0;
}

.book-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--gold-dim);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 8px var(--gold-glow);
  transform: translateY(-2px);
}

.book-card.status-read {
  border-left: 3px solid var(--status-read);
}

.book-card.status-reading {
  border-left: 3px solid var(--status-reading);
  box-shadow: 0 0 8px rgba(249, 168, 37, 0.15);
}

.book-card.status-unread {
  border-left: 3px solid var(--status-unread);
  opacity: 0.7;
}

.book-card.status-unread:hover {
  opacity: 1;
}

.book-card.is-skippable {
  opacity: 0.6;
}

.book-card.is-skippable:hover {
  opacity: 0.9;
}

.card-number {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.card-title {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.3;
}

.card-author {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.card-type-badge {
  display: inline-block;
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: auto;
}

/* Status Badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-badge.read {
  background: var(--status-read-bg);
  color: var(--status-read);
}

.status-badge.reading {
  background: var(--status-reading-bg);
  color: var(--status-reading);
}

.status-badge.unread {
  background: var(--status-unread-bg);
  color: var(--status-unread);
}

/* Star Rating (Card) */
.card-stars {
  display: flex;
  gap: 1px;
}

.card-stars .star {
  color: var(--border-light);
  font-size: 0.8rem;
}

.card-stars .star.filled {
  color: var(--gold-primary);
}

/* Tag Rating (Card) */
.card-tag {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 600;
}

.card-tag.really-good { background: rgba(201, 168, 76, 0.2); color: var(--tag-really-good); }
.card-tag.good { background: rgba(76, 175, 80, 0.2); color: var(--tag-good); }
.card-tag.ok-meh { background: rgba(255, 152, 0, 0.2); color: var(--tag-ok-meh); }
.card-tag.bad { background: rgba(244, 67, 54, 0.2); color: var(--tag-bad); }

/* Format Icon */
.card-format {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Skippable Banner */
.skip-badge {
  position: absolute;
  top: 8px;
  right: -20px;
  background: var(--red-primary);
  color: #fff;
  font-size: 0.55rem;
  font-weight: 600;
  padding: 2px 24px;
  transform: rotate(45deg);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.8;
}

/* ── Detail Modal ──────────────────────────────────────────── */
#modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--modal-backdrop);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

#modal-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--gold-dim);
  border-radius: 8px;
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6), 0 0 30px var(--gold-glow);
  transform: translateY(20px);
  transition: transform var(--transition-normal);
}

#modal-backdrop.visible .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  font-size: 1.1rem;
  color: var(--gold-primary);
  line-height: 1.3;
}

.modal-subtitle {
  font-family: 'Source Sans Pro', sans-serif;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-top: 2px;
}

.modal-close {
  font-size: 1.6rem;
  color: var(--text-muted);
  padding: 0 4px;
  line-height: 1;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--red-secondary);
}

.modal-body {
  padding: 16px 20px 20px;
}

/* Modal Sections */
.modal-section {
  margin-bottom: 16px;
}

.modal-section-label {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

/* Radio Group (Status, Format) */
.radio-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.radio-btn {
  padding: 6px 14px;
  font-size: 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.radio-btn:hover {
  border-color: var(--gold-dim);
  color: var(--text-primary);
}

.radio-btn.active {
  border-color: var(--gold-primary);
  background: rgba(201, 168, 76, 0.1);
  color: var(--gold-primary);
}

.radio-btn.status-read.active {
  border-color: var(--status-read);
  background: var(--status-read-bg);
  color: var(--status-read);
}

.radio-btn.status-reading.active {
  border-color: var(--status-reading);
  background: var(--status-reading-bg);
  color: var(--status-reading);
}

.radio-btn.status-unread.active {
  border-color: var(--status-unread);
  background: var(--status-unread-bg);
  color: #999;
}

/* Star Rating (Modal) */
.star-rating {
  display: flex;
  gap: 4px;
}

.star-rating .star {
  font-size: 1.6rem;
  color: var(--border-light);
  cursor: pointer;
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.star-rating .star:hover {
  transform: scale(1.15);
}

.star-rating .star.filled {
  color: var(--gold-primary);
  text-shadow: 0 0 6px var(--gold-glow);
}

.star-rating .star.hover-fill {
  color: var(--gold-secondary);
}

/* Tag Rating (Modal) */
.tag-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag-btn {
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tag-btn:hover {
  opacity: 0.8;
}

.tag-btn.active.really-good { border-color: var(--tag-really-good); background: rgba(201, 168, 76, 0.15); color: var(--tag-really-good); }
.tag-btn.active.good { border-color: var(--tag-good); background: rgba(76, 175, 80, 0.15); color: var(--tag-good); }
.tag-btn.active.ok-meh { border-color: var(--tag-ok-meh); background: rgba(255, 152, 0, 0.15); color: var(--tag-ok-meh); }
.tag-btn.active.bad { border-color: var(--tag-bad); background: rgba(244, 67, 54, 0.15); color: var(--tag-bad); }

/* Skippable Checkbox */
.skip-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.skip-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--gold-primary);
  cursor: pointer;
}

/* Notes Textarea */
.modal-notes {
  width: 100%;
  min-height: 70px;
  resize: vertical;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 10px;
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.5;
}

.modal-notes::placeholder {
  color: var(--text-muted);
}

/* Connections Section */
.connections-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.connection-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 4px 0;
}

.connection-arrow {
  color: var(--gold-dim);
  font-size: 0.7rem;
}

.connection-type {
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.connection-type.required { background: rgba(201, 168, 76, 0.15); color: var(--gold-primary); }
.connection-type.recommended { background: rgba(76, 175, 80, 0.15); color: var(--tag-good); }
.connection-type.optional { background: rgba(66, 66, 66, 0.2); color: var(--text-muted); }

/* Summary */
.modal-summary {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.5;
  padding: 10px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  border-left: 3px solid var(--gold-dim);
}

/* ── Flowchart View ────────────────────────────────────────── */
#flowchart-view {
  position: relative;
  height: calc(100vh - 170px);
}

#flowchart-canvas {
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
}

#flowchart-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 10;
}

#flowchart-controls button {
  width: 36px;
  height: 36px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

#flowchart-controls button:hover {
  background: var(--bg-tertiary);
  border-color: var(--gold-dim);
  color: var(--gold-primary);
}

/* Flowchart Legend */
#flowchart-legend {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(20, 20, 20, 0.95);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 14px 16px;
  z-index: 10;
  max-height: 60vh;
  overflow-y: auto;
  min-width: 200px;
}

#flowchart-legend h4 {
  font-size: 0.75rem;
  color: var(--gold-primary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.legend-section {
  margin-bottom: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  padding: 2px 0;
}

.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}

.legend-line {
  width: 24px;
  height: 2px;
  flex-shrink: 0;
}

.legend-line.required { background: var(--gold-primary); }
.legend-line.recommended { background: var(--text-muted); border-top: 2px dashed var(--text-muted); height: 0; }
.legend-line.optional { background: var(--text-muted); border-top: 2px dotted var(--text-muted); height: 0; }

/* ── Footer ────────────────────────────────────────────────── */
#app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 10px;
}

.progress-section {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 200px;
}

.progress-bar {
  flex: 1;
  max-width: 300px;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold-primary));
  border-radius: 4px;
  transition: width var(--transition-normal);
}

#progress-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.footer-actions {
  display: flex;
  gap: 8px;
}

.footer-actions button {
  padding: 6px 14px;
  font-size: 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.footer-actions button:hover {
  border-color: var(--gold-dim);
  color: var(--gold-primary);
}

/* ── Hidden Utility ────────────────────────────────────────── */
.hidden {
  display: none !important;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .arc-books-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }

  .header-left h1 {
    font-size: 1.1rem;
  }

  .filter-bar input[type="text"] {
    width: 160px;
  }
}

@media (max-width: 600px) {
  #app-header {
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .header-left h1 {
    font-size: 0.95rem;
  }

  .header-stats {
    font-size: 0.75rem;
  }

  #view-controls {
    padding: 8px 14px;
  }

  .view-tab {
    padding: 6px 12px;
    font-size: 0.75rem;
  }

  #card-view {
    padding: 12px 14px;
  }

  .arc-books-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
  }

  .book-card {
    padding: 10px;
  }

  .modal {
    max-width: 100%;
    margin: 10px;
    max-height: 90vh;
  }

  #app-footer {
    padding: 8px 14px;
  }
}

/* ── Animations ────────────────────────────────────────────── */
@keyframes pulse-gold {
  0%, 100% { box-shadow: 0 0 4px var(--gold-glow); }
  50% { box-shadow: 0 0 12px var(--gold-glow); }
}

.book-card.status-reading {
  animation: pulse-gold 3s ease-in-out infinite;
}

/* Subtle fade-in for cards */
.book-card {
  animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* No results message */
.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 1rem;
}

.no-results .no-results-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.4;
}

/* ============================================================
   AUTH PAGE STYLES - Login / Register
   ============================================================ */

.auth-container {
  max-width: 420px;
  margin: 80px auto;
  padding: 30px;
  background: var(--bg-secondary);
  border: 1px solid var(--gold-dim);
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6), 0 0 30px var(--gold-glow);
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-header .aquila {
  font-size: 2.5rem;
}

.auth-title {
  font-family: 'Cinzel Decorative', serif;
  color: var(--gold-primary);
  font-size: 1.5rem;
  margin: 12px 0 4px;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.auth-tab:hover {
  color: var(--text-secondary);
  border-color: var(--border-light);
}

.auth-tab.active {
  color: var(--gold-primary);
  border-color: var(--gold-primary);
  background: rgba(201, 168, 76, 0.1);
}

.auth-error {
  background: rgba(139, 0, 0, 0.2);
  border: 1px solid var(--red-primary);
  color: var(--red-secondary);
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.auth-form.hidden {
  display: none;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: 'Source Sans Pro', sans-serif;
  font-size: 0.9rem;
  transition: border-color var(--transition-fast);
  box-sizing: border-box;
}

.form-group input:focus {
  outline: none;
  border-color: var(--gold-primary);
  box-shadow: 0 0 8px var(--gold-glow);
}

.form-group input::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.form-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
}

.auth-submit {
  width: 100%;
  padding: 12px;
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold-dim), var(--gold-primary));
  color: #0A0A0A;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
  letter-spacing: 0.05em;
  margin-top: 8px;
}

.auth-submit:hover {
  background: var(--gold-primary);
  box-shadow: 0 0 20px var(--gold-glow);
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--gold-dim);
}

/* reCAPTCHA v3 badge - subtle on dark theme */
.grecaptcha-badge {
  visibility: hidden;
}

.recaptcha-notice {
  text-align: center;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 12px;
  line-height: 1.4;
}

.recaptcha-notice a {
  color: var(--text-secondary);
  text-decoration: underline;
}

/* ============================================================
   HEADER USER CONTROLS
   ============================================================ */

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-label {
  font-family: 'Cinzel', serif;
  color: var(--text-secondary);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

.header-btn {
  padding: 5px 12px;
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid var(--gold-dim);
  border-radius: 3px;
  background: transparent;
  color: var(--gold-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.header-btn:hover {
  background: rgba(201, 168, 76, 0.15);
  border-color: var(--gold-primary);
  box-shadow: 0 0 10px var(--gold-glow);
}

.header-btn.share-active {
  background: rgba(201, 168, 76, 0.2);
  border-color: var(--gold-primary);
}

.header-btn-dim {
  border-color: var(--border-color);
  color: var(--text-muted);
}

.header-btn-dim:hover {
  border-color: var(--text-muted);
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: none;
}

/* ============================================================
   SHARE POPOVER
   ============================================================ */

.share-popover {
  position: fixed;
  top: 60px;
  right: 20px;
  z-index: 1000;
  background: var(--bg-secondary);
  border: 1px solid var(--gold-dim);
  border-radius: 6px;
  padding: 14px 18px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5), 0 0 15px var(--gold-glow);
  min-width: 300px;
}

.share-popover.hidden {
  display: none;
}

.share-status {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  margin-bottom: 8px;
}

.share-status.share-on {
  color: var(--status-read);
}

.share-status.share-off {
  color: var(--text-muted);
}

.share-url-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.share-url-row.hidden {
  display: none;
}

.share-url-input {
  flex: 1;
  padding: 6px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  color: var(--text-primary);
  font-family: 'Source Sans Pro', sans-serif;
  font-size: 0.75rem;
}

.share-url-input:focus {
  outline: none;
  border-color: var(--gold-dim);
}

/* ============================================================
   SHARED VIEW LABEL
   ============================================================ */

.shared-label {
  font-family: 'Cinzel', serif;
  color: var(--gold-primary);
  font-size: 0.85rem;
}

.shared-label strong {
  color: var(--gold-primary);
}

/* ============================================================
   CHANGE PASSWORD MODAL
   ============================================================ */

.pw-modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--modal-backdrop);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.pw-modal-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.pw-modal {
  background: var(--bg-secondary);
  border: 1px solid var(--gold-dim);
  border-radius: 8px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6), 0 0 30px var(--gold-glow);
  transform: translateY(20px);
  transition: transform var(--transition-normal);
}

.pw-modal-backdrop.visible .pw-modal {
  transform: translateY(0);
}

.pw-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--border-color);
}

.pw-modal-header h2 {
  font-size: 1.1rem;
  color: var(--gold-primary);
}

.pw-modal-body {
  padding: 16px 20px 20px;
}

.pw-success {
  background: rgba(46, 125, 50, 0.2);
  border: 1px solid var(--status-read);
  color: var(--status-read);
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

/* ============================================================
   RESPONSIVE ADDITIONS
   ============================================================ */

@media (max-width: 900px) {
  .header-user {
    gap: 6px;
  }
  .user-label {
    display: none;
  }
  .share-popover {
    right: 10px;
    min-width: 260px;
  }
}

@media (max-width: 600px) {
  .auth-container {
    margin: 40px 16px;
    padding: 20px;
  }
  .header-user {
    gap: 4px;
  }
  .header-btn {
    padding: 4px 8px;
    font-size: 0.65rem;
  }
  .share-popover {
    right: 5px;
    left: 5px;
    min-width: auto;
  }
}
