/**
 * @file src/ui/styles/hud.css
 * @description Styles for Top Meta Stat Grid, Dual Progress Bar, and 2-Column Character Sheet
 * Modified: 2026-09-06T17:00:00Z
 */

/* Top HUD Container */
.hud-header-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
  z-index: 20;
}

/* HUD Top Toolbar with Brand and Sheet Toggle */
.hud-toolbar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hud-brand-title {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 1px;
}

.hud-toolbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/*
 * Settings, from the table (#237).
 *
 * Quieter than the two beside it, on purpose: this is a way OUT of the game,
 * and the controls that act on the game should read as the louder pair.
 */
.btn-settings {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-sm);
  color: #e2e8f0;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-settings:hover {
  background: rgba(148, 163, 184, 0.28);
  transform: translateY(-1px);
}

.btn-new-character {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.28) 0%, rgba(59, 130, 246, 0.28) 100%);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-sm);
  color: #ffffff;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--glow-arcane);
}

.btn-new-character:hover {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.45) 0%, rgba(59, 130, 246, 0.45) 100%);
  transform: translateY(-1px);
}

.btn-toggle-sheet {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-sm);
  color: #ffffff;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--glow-mint);
}

.btn-toggle-sheet:hover, .btn-toggle-tactical:hover {
  background: rgba(168, 85, 247, 0.3);
  transform: translateY(-1px);
}

.btn-toggle-tactical {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-sm);
  color: #ffffff;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

@media (max-width: 767px) {
  .btn-label {
    display: none;
  }
  .btn-settings, .btn-new-character, .btn-toggle-sheet, .btn-toggle-tactical {
    padding: 6px 10px;
  }
}

.sheet-state-indicator {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-weight: 800;
}

.sheet-state-indicator.state-open {
  background: var(--color-mint);
  color: #0b0f14;
}

.sheet-state-indicator.state-closed {
  background: #64748b;
  color: #ffffff;
}

/* 2x6 Boxed Meta Stat Grid */
.meta-stat-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

@media (max-width: 1024px) {
  .meta-stat-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .meta-stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.meta-stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  min-height: 48px;
}

.meta-stat-card:hover {
  border-color: var(--border-active);
  box-shadow: var(--glow-mint);
}

.stat-title {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--color-mint);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.stat-value {
  font-size: 14px;
  color: var(--text-primary);
  font-family: var(--font-stats);
}

/* Graphical Story Status Bar (Time, Date, Location, Moon, Season) - Added 2026-09-16T21:30:00Z */
.hud-story-status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 auto 10px auto;
  padding: 6px 14px;
  background: rgba(18, 12, 10, 0.75);
  border: 1px solid rgba(217, 119, 6, 0.25);
  border-radius: 20px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(8px);
  width: fit-content;
  max-width: 100%;
}

.scene-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  color: #cbd5e1;
  letter-spacing: 0.3px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.scene-badge:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(217, 119, 6, 0.4);
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.2);
  transform: translateY(-1px);
}

.scene-badge-icon {
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.scene-badge-value {
  color: #f1f5f9;
}

.scene-badge.scene-location {
  border-color: rgba(234, 179, 8, 0.35);
  background: rgba(234, 179, 8, 0.08);
}
.scene-badge.scene-location .scene-badge-value {
  color: #fef08a;
  font-weight: 700;
}

.scene-badge.scene-time {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.06);
}
.scene-badge.scene-time .scene-badge-value {
  color: #fbbf24;
}

.scene-badge.scene-date {
  border-color: rgba(148, 163, 184, 0.25);
}

.scene-badge.scene-moon {
  border-color: rgba(192, 132, 252, 0.25);
  background: rgba(192, 132, 252, 0.05);
}
.scene-badge.scene-moon .scene-badge-value {
  color: #e9d5ff;
}

.scene-badge.scene-season {
  border-color: rgba(251, 146, 60, 0.25);
  background: rgba(251, 146, 60, 0.05);
}
.scene-badge.scene-season .scene-badge-value {
  color: #fed7aa;
}

.scene-badge.scene-conditions {
  border-color: rgba(167, 139, 250, 0.25);
  font-style: italic;
  color: #ddd6fe;
}

/* Dual Progress Bar with Central D20 */
.vitals-dual-bar-container {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.vitals-bar-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.bar-track {
  width: 100%;
  height: 22px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  transition: width 0.4s ease-out;
}

.xp-bar-fill {
  background: linear-gradient(90deg, #8b5cf6, #a855f7);
}

.hp-bar-fill {
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.bar-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

.hp-label-group {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.temp-hp-badge {
  background: var(--color-blue-temp);
  color: #0b0f14;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

/* Central Glowing D20 Emblem (Arcane Purple & Gold) */
.vitals-d20-emblem {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: var(--radius-full);
  background: radial-gradient(circle, #a855f7 0%, #4c1d95 100%);
  border: 2px solid var(--color-gold);
  box-shadow: 0 0 14px rgba(168, 85, 247, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.vitals-d20-emblem img.hud-portrait {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  object-fit: cover;
  display: block;
}

.vitals-d20-emblem:hover {
  transform: scale(1.1) rotate(15deg);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.8);
}

/* Conditions Row */
.hud-conditions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.condition-badge {
  background: rgba(168, 85, 247, 0.1);
  border: 1px solid var(--border-subtle);
  color: var(--color-mint);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

/* Character Sheet Sidebar Drawer Container */
.character-sheet-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  background: var(--bg-surface);
  width: 100%;
  box-sizing: border-box;
}

.sheet-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.sheet-drawer-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-mint);
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sheet-close-btn {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: var(--color-crimson);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.sheet-close-btn:hover {
  background: rgba(239, 68, 68, 0.3);
}

.sheet-left-column, .sheet-right-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.sheet-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-mint);
  letter-spacing: 1px;
  text-align: center;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 6px;
  margin-bottom: 10px;
}

/* 2x3 Grids for Ability Scores & Saves */
.ability-grid-2x3, .saves-grid-2x3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.ability-score-card, .save-throw-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.ability-name, .save-name {
  font-size: 10px;
  font-weight: 700;
  color: var(--color-mint);
}

.score-value, .save-value {
  font-size: 13px;
  font-family: var(--font-stats);
  color: var(--text-primary);
}

.save-throw-card.proficient {
  border-color: var(--color-mint);
  background: rgba(168, 85, 247, 0.08);
}

/* 18 Skills 2-Column List */
.skills-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
}

.skill-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  background: rgba(18, 24, 32, 0.5);
  border: 1px solid rgba(168, 85, 247, 0.15);
  border-radius: var(--radius-sm);
  font-size: 11px;
}

.skill-row.proficient {
  border-color: var(--color-mint);
  color: var(--color-mint);
}

.skill-mod {
  font-family: var(--font-stats);
}

/* 3x3 Tab Navigation Grid */
.sheet-tabs-grid-3x3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.sheet-tab-button {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--color-mint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sheet-tab-button:hover, .sheet-tab-button.active {
  background: rgba(168, 85, 247, 0.15);
  border-color: var(--border-active);
  box-shadow: var(--glow-mint);
  color: #ffffff;
}

/* Data Tables */
.sheet-tab-content-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  min-height: 240px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th {
  text-align: left;
  padding: 8px 12px;
  color: var(--color-mint);
  font-size: 11px;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.empty-cell {
  text-align: center;
  color: var(--text-muted);
  padding: 24px;
}


/* ---------- Narrative feed: NPC speech & tagged choices (SPEC-REALM-007) ---------- */

/*
 * A line an NPC says is set apart from narration on purpose. Prose describes;
 * speech is addressed to you, and reading both in the same voice loses that.
 */
.feed-item-speech .sender-badge {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: var(--color-cyan);
}

.feed-speech-bubble {
  margin: 0.4rem 0 0;
  padding: 0.7rem 0.9rem;
  border-left: 3px solid var(--color-cyan);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: rgba(56, 189, 248, 0.07);
  font-style: italic;
  line-height: 1.6;
}

/* Inline dialogue highlights in narrative feed (2026-09-16T20:31:00Z) */
.narrative-dialogue-quote {
  color: #fef08a;
  font-weight: 600;
  font-style: italic;
  background: rgba(245, 158, 11, 0.14);
  padding: 2px 6px;
  border-radius: 4px;
  border-left: 2px solid #f59e0b;
  display: inline;
  text-shadow: 0 0 10px rgba(245, 158, 11, 0.25);
}

.dialogue-choice-btn.choice-tactical { border-left: 3px solid var(--color-crimson); }
.dialogue-choice-btn.choice-social { border-left: 3px solid var(--color-gold); }
.dialogue-choice-btn.choice-arcane { border-left: 3px solid var(--color-purple); }
.dialogue-choice-btn.choice-movement { border-left: 3px solid var(--color-cyan); }
.dialogue-choice-btn.choice-standard { border-left: 3px solid var(--text-muted); }

/* Image Lightbox Modal — Dark Fantasy glassmorphism backdrop & gold accent */
/* Added: 2026-09-16T20:00:00Z */
.image-lightbox-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  background: rgba(10, 8, 16, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  animation: lightboxFadeIn 0.2s ease-out;
  cursor: zoom-out;
}

@keyframes lightboxFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.image-lightbox-container {
  background: var(--bg-surface-elevated, #161320);
  border: 1px solid var(--border-active, #f59e0b);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.85), 0 0 24px rgba(245, 158, 11, 0.2);
  border-radius: 12px;
  padding: 16px 20px 20px 20px;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  cursor: default;
  animation: lightboxScaleUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes lightboxScaleUp {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.image-lightbox-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 16px;
}

.image-lightbox-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fef08a;
  letter-spacing: 0.5px;
}

.image-lightbox-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted, #9ca3af);
  margin-top: 3px;
  word-wrap: break-word;
  white-space: pre-wrap;
  max-width: 80vw;
  max-height: 20vh;
  overflow-y: auto;
}

.image-lightbox-close {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #e2e8f0;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.image-lightbox-close:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: #ef4444;
  color: #ffffff;
  transform: translateY(-1px);
}

.image-lightbox-body {
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #0d0b13;
}

.image-lightbox-img {
  max-width: min(85vw, 680px);
  max-height: 70vh;
  object-fit: contain;
  border-radius: 8px;
  display: block;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}
