/* === WoW DB Comparison Tool — Dark Fantasy Aesthetic === */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Crimson+Text:ital,wght@0,400;0,600;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-deepest: #0d0a04;
  --bg-dark: #1a1208;
  --bg-panel: #2a1f0e;
  --bg-panel-alt: #231a0b;
  --bg-stone: #2d2416;
  --bg-input: #1e1508;
  --border-dark: #3a2d18;
  --border-gold: #c8a855;
  --border-gold-dim: #6b5a2e;
  --text-parchment: #e8d5a3;
  --text-dim: #a89668;
  --text-bright: #f5e6c0;
  --gold: #c8a855;
  --gold-bright: #f0c040;
  --gold-glow: rgba(240, 192, 64, 0.15);
  --red: #8b1a1a;
  --red-bright: #c44040;
  --green: #2e7d32;
  --green-bright: #5cb85c;
  --amber: #b8860b;
  --amber-bright: #daa520;
  --blue: #1565c0;
  --blue-dim: #2a4a7a;
  --shadow: rgba(0, 0, 0, 0.6);
  --font-heading: 'Cinzel', 'Georgia', serif;
  --font-body: 'Crimson Text', 'Georgia', serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
}

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

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

body {
  background-color: var(--bg-deepest);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(42, 31, 14, 0.5) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(45, 36, 22, 0.3) 0%, transparent 50%);
  color: var(--text-parchment);
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.6;
  min-height: 100vh;
}

/* === LAYOUT === */

.page-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* === HEADER / NAV === */

.site-header {
  background: linear-gradient(180deg, var(--bg-panel) 0%, var(--bg-dark) 100%);
  border-bottom: 2px solid var(--border-gold-dim);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 24px var(--shadow);
}

.site-header .page-wrap {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}

.site-logo {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gold-bright);
  text-decoration: none;
  text-shadow: 0 0 12px rgba(240, 192, 64, 0.3);
  white-space: nowrap;
  letter-spacing: 0.04em;
}

.site-logo span {
  color: var(--text-dim);
  font-weight: 400;
  font-size: 0.85em;
}

.main-nav {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.main-nav a {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
  letter-spacing: 0.03em;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--gold-bright);
  background: var(--gold-glow);
}

/* === MAIN CONTENT === */

main {
  padding: 2rem 0 4rem;
}

.page-title {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 1.5rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.02em;
}

.page-title .icon {
  margin-right: 0.5rem;
}

.page-subtitle {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--text-dim);
  font-weight: 400;
  margin-top: -1rem;
  margin-bottom: 1.5rem;
}

/* === PANELS / CARDS === */

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-dark);
  border-radius: 6px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 12px var(--shadow);
}

.panel-header {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-dark);
  letter-spacing: 0.03em;
}

.panel-ornate {
  border-color: var(--border-gold-dim);
  position: relative;
}

.panel-ornate::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 1rem;
  right: 1rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

/* === STATUS INDICATORS === */

.status-row {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.status-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-dark);
  border-radius: 6px;
  padding: 1rem 1.5rem;
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.ok {
  background: var(--green-bright);
  box-shadow: 0 0 8px rgba(92, 184, 92, 0.5);
}

.status-dot.error {
  background: var(--red-bright);
  box-shadow: 0 0 8px rgba(196, 64, 64, 0.5);
}

.status-label {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  color: var(--text-dim);
  letter-spacing: 0.03em;
}

.status-indicator {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.status-ok {
  color: var(--green-bright);
  background: rgba(46, 125, 50, 0.15);
}

.status-error {
  color: var(--red-bright);
  background: rgba(139, 26, 26, 0.15);
}

/* === STAT CARDS === */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-dark);
  border-radius: 6px;
  padding: 1rem;
  text-align: center;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold-bright);
  display: block;
  line-height: 1.2;
}

.stat-label {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* === SEARCH === */

.search-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.search-bar input[type="text"],
.search-bar input[type="search"] {
  flex: 1;
  min-width: 200px;
}

.search-bar select {
  min-width: 140px;
}

/* === FORMS / INPUTS === */

input[type="text"],
input[type="search"],
input[type="password"],
input[type="number"],
select,
textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-dark);
  border-radius: 4px;
  color: var(--text-parchment);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.5rem 0.75rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-glow);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

label {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 0.3rem;
  letter-spacing: 0.03em;
}

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

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

input[type="checkbox"] {
  accent-color: var(--gold);
  width: 16px;
  height: 16px;
  margin-right: 0.5rem;
  vertical-align: middle;
}

/* === BUTTONS === */

.btn {
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-parchment);
  background: var(--bg-stone);
  border: 1px solid var(--border-gold-dim);
  border-radius: 4px;
  padding: 0.45rem 1rem;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  letter-spacing: 0.03em;
  line-height: 1.4;
}

.btn:hover {
  border-color: var(--gold);
  background: var(--bg-panel);
  color: var(--gold-bright);
  box-shadow: 0 0 12px var(--gold-glow);
}

.btn-primary {
  background: linear-gradient(180deg, #4a3a1a 0%, #3a2a10 100%);
  border-color: var(--gold);
  color: var(--gold-bright);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #5a4a2a 0%, #4a3a1a 100%);
  box-shadow: 0 0 16px var(--gold-glow);
}

.btn-danger {
  border-color: var(--red);
  color: var(--red-bright);
}

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

.btn-sm {
  font-size: 0.75rem;
  padding: 0.3rem 0.6rem;
}

.btn-copy {
  background: linear-gradient(180deg, #1a3a2a 0%, #0d2a1a 100%);
  border-color: var(--green);
  color: var(--green-bright);
}

.btn-copy:hover {
  background: var(--green);
  color: #fff;
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.btn:disabled:hover {
  background: var(--bg-stone);
  border-color: var(--border-gold-dim);
  color: var(--text-parchment);
}

/* === TABLES === */

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

.data-table th {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 2px solid var(--border-gold-dim);
  background: var(--bg-dark);
  position: sticky;
  top: 0;
}

.data-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid rgba(58, 45, 24, 0.5);
  vertical-align: middle;
}

.data-table tr:nth-child(even) td {
  background: var(--bg-panel-alt);
}

.data-table tr:hover td {
  background: rgba(200, 168, 85, 0.06);
}

.data-table .mono {
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* === DIFF TABLE ROWS === */

.diff-match td { }
.diff-match td:first-child {
  border-left: 3px solid var(--green);
}

.diff-mismatch td {
  background: rgba(184, 134, 11, 0.08) !important;
}
.diff-mismatch td:first-child {
  border-left: 3px solid var(--amber-bright);
}

.diff-missing td {
  background: rgba(139, 26, 26, 0.08) !important;
}
.diff-missing td:first-child {
  border-left: 3px solid var(--red-bright);
}

.diff-transform td {
  background: rgba(100, 100, 120, 0.08) !important;
}
.diff-transform td:first-child {
  border-left: 3px solid #666;
}

/* === VALUE DISPLAY === */

.value-cell {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-bright);
}

.value-empty {
  color: var(--text-dim);
  font-style: italic;
}

.transform-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: #999;
  background: rgba(100, 100, 120, 0.2);
  border: 1px solid #555;
  border-radius: 3px;
  padding: 0.15rem 0.4rem;
  cursor: help;
}

/* === INLINE EDIT === */

.inline-edit {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.inline-edit input {
  width: 140px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.25rem 0.5rem;
}

/* === SEARCH RESULTS === */

.result-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.result-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-dark);
  border-radius: 6px;
  padding: 1rem;
  display: block;
  text-decoration: none;
  color: var(--text-parchment);
  transition: all 0.2s;
}

.result-card:hover {
  border-color: var(--gold);
  box-shadow: 0 0 16px var(--gold-glow);
  transform: translateY(-1px);
}

.result-card .card-icon {
  font-size: 1.5rem;
  float: left;
  margin-right: 0.75rem;
}

.result-card .card-name {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-bright);
  display: block;
}

.result-card .card-meta {
  font-size: 0.82rem;
  color: var(--text-dim);
}

.result-card .card-id {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--gold);
}

/* === ENTITY HEADER === */

.entity-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.entity-header .entity-icon {
  font-size: 2rem;
}

.entity-header .entity-name {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gold);
}

.entity-header .entity-id {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-dim);
}

/* === MODAL / OVERLAY === */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-panel);
  border: 2px solid var(--border-gold-dim);
  border-radius: 8px;
  padding: 1.5rem;
  max-width: 800px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.8);
}

.modal-content .panel-header {
  font-size: 1.1rem;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-dark);
}

/* === FLASH MESSAGES === */

.success-flash {
  color: var(--green-bright);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.error-flash {
  color: var(--red-bright);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.warning-flash {
  color: var(--amber-bright);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* === CATEGORY BADGES === */

.cat-badge {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  border: 1px solid;
}

.cat-creature {
  color: var(--red-bright);
  border-color: var(--red);
  background: rgba(139, 26, 26, 0.15);
}

.cat-item {
  color: #a78bfa;
  border-color: #5b21b6;
  background: rgba(91, 33, 182, 0.12);
}

.cat-quest {
  color: var(--amber-bright);
  border-color: var(--amber);
  background: rgba(184, 134, 11, 0.12);
}

/* === CHANGELOG === */

.changelog-entry {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(58, 45, 24, 0.3);
  align-items: baseline;
}

.changelog-ts {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}

.changelog-detail {
  font-size: 0.9rem;
}

.changelog-values {
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.changelog-old {
  color: var(--red-bright);
  text-decoration: line-through;
}

.changelog-new {
  color: var(--green-bright);
}

.changelog-source {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  background: var(--bg-dark);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
}

/* === FILTER BAR === */

.filter-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.filter-bar label {
  display: inline;
  margin-bottom: 0;
  margin-right: 0.25rem;
}

/* === MAPPING TABLE EXTRAS === */

.mapping-category-group {
  margin-bottom: 2rem;
}

.mapping-category-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-dark);
}

.transform-flag {
  color: var(--amber-bright);
  font-weight: bold;
}

/* === TOOLTIP === */

.tooltip-wrap {
  position: relative;
  display: inline-block;
}

.tooltip-wrap .tooltip-text {
  visibility: hidden;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-dark);
  border: 1px solid var(--border-gold-dim);
  color: var(--text-parchment);
  font-family: var(--font-body);
  font-size: 0.82rem;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  white-space: normal;
  width: 280px;
  z-index: 50;
  box-shadow: 0 4px 16px var(--shadow);
  opacity: 0;
  transition: opacity 0.2s;
}

.tooltip-wrap:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* === EMPTY STATES === */

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-dim);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
  opacity: 0.4;
}

/* === UTILITIES === */

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.gap-1 { gap: 0.5rem; }

.text-dim { color: var(--text-dim); }
.text-gold { color: var(--gold); }
.text-red { color: var(--red-bright); }
.text-green { color: var(--green-bright); }

.d-flex { display: flex; }
.align-center { align-items: center; }

.actions-cell {
  display: flex;
  gap: 0.3rem;
}

/* === SCROLLBAR === */

::-webkit-scrollbar {
  width: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-dark);
  border-radius: 4px;
}

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

/* === RESPONSIVE === */

@media (max-width: 768px) {
  .site-header .page-wrap {
    flex-direction: column;
    gap: 0.5rem;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .changelog-entry {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
  .entity-header {
    flex-direction: column;
    gap: 0.25rem;
  }
}

/* === HTMX LOADING === */

.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator {
  display: inline-block;
}

.htmx-request.htmx-indicator {
  display: inline-block;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-gold-dim);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* === ORNATE DECORATIVE BORDER FOR TOP-LEVEL PANELS === */

.panel-ornate::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 1rem;
  right: 1rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-gold-dim), transparent);
}
