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

:root {
  --gold: #c8a44a;
  --gold-light: #e0c070;
  --gold-dark: #8a6a1e;
  --bg-dark: #0d0b07;
  --bg-mid: #1a1509;
  --bg-card: #1e1a0e;
  --bg-hover: #2a2210;
  --text-primary: #e8dcc0;
  --text-muted: #9a8a6a;
  --text-dim: #6a5a3a;
  --border: #3a2e14;
  --border-gold: #5a4a1a;
  --red: #8b2020;
  --red-light: #c04040;
  --shadow: 0 4px 24px rgba(0,0,0,0.7);
  --radius: 4px;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 18px;
  line-height: 1.6;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* === Navigation === */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(180deg, #0a0800 0%, #110e05 100%);
  border-bottom: 1px solid var(--border-gold);
  box-shadow: 0 2px 16px rgba(0,0,0,0.8);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  height: 60px;
}

.nav-logo {
  font-family: 'Cinzel', serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold);
  text-decoration: none;
  letter-spacing: 2px;
  text-shadow: 0 0 20px rgba(200, 164, 74, 0.4);
}

.nav-links { display: flex; gap: 1.5rem; list-style: none; }

.nav-links a {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 1px;
  transition: color 0.2s;
}

.nav-links a:hover, .nav-links a.active { color: var(--gold); }

/* === Page Header === */
.page-header {
  text-align: center;
  padding: 3rem 2rem 2rem;
  position: relative;
  z-index: 1;
}

.page-header h1 {
  font-family: 'Cinzel', serif;
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 4px;
  text-shadow: 0 0 40px rgba(200, 164, 74, 0.3);
  margin-bottom: 0.5rem;
}

.page-header .subtitle {
  color: var(--text-muted);
  font-style: italic;
  font-size: 1.1rem;
}

.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 1rem 0;
  color: var(--gold-dark);
  font-size: 1.2rem;
}

.ornament::before, .ornament::after {
  content: '';
  flex: 1;
  max-width: 200px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dark), transparent);
}

/* === Main Layout === */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  position: relative;
  z-index: 1;
}

/* === Toolbar === */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 200px;
  max-width: 400px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: 'Crimson Text', serif;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.search-box input:focus { outline: none; border-color: var(--gold-dark); }

.search-box::before {
  content: '⚔';
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 0.9rem;
  pointer-events: none;
}

/* === Buttons === */
.btn {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  letter-spacing: 1px;
  padding: 0.55rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-primary {
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dark) 100%);
  border-color: var(--gold);
  color: #1a1000;
  font-weight: 600;
}

.btn-primary:hover {
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 100%);
  box-shadow: 0 0 16px rgba(200, 164, 74, 0.3);
}

.btn-secondary {
  background: transparent;
  border-color: var(--border-gold);
  color: var(--text-muted);
}

.btn-secondary:hover { border-color: var(--gold-dark); color: var(--gold); }

.btn-danger {
  background: transparent;
  border-color: var(--red);
  color: var(--red-light);
}

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

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.72rem;
}

.btn-status {
  background: transparent;
  border-color: var(--border-gold);
  color: var(--text-muted);
}
.btn-status:hover { border-color: var(--gold-dark); color: var(--gold); }

.status-next-inaktiv { color: #c89040; border-color: #7a5020; }
.status-next-tot     { color: #c85050; border-color: #7a2020; }
.status-next-aktiv   { color: #8fc870; border-color: #4a7a30; }

.toolbar-right {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* === Character Grid === */
.char-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 0.75rem;
}

@media (max-width: 1200px) { .char-grid { grid-template-columns: repeat(8, 1fr); } }
@media (max-width: 900px)  { .char-grid { grid-template-columns: repeat(5, 1fr); } }
@media (max-width: 500px)  { .char-grid { grid-template-columns: repeat(3, 1fr); } }

.char-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
}

.char-card:hover {
  border-color: var(--gold-dark);
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 16px rgba(200,164,74,0.1);
}

.char-card-img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  object-position: top;
  display: block;
  background: var(--bg-mid);
}

.char-card-img-placeholder {
  width: 100%;
  aspect-ratio: 3/4;
  background: linear-gradient(180deg, var(--bg-mid) 0%, var(--bg-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--text-dim);
}

.char-card-body {
  padding: 0.5rem 0.6rem;
  border-top: 1px solid var(--border);
}

.char-card-name {
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  color: var(--gold-light);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.char-status-badge {
  position: absolute;
  top: 0.5rem;
  cursor: pointer;
  user-select: none;
  right: 0.5rem;
  font-size: 0.65rem;
  font-family: 'Cinzel', serif;
  padding: 0.15rem 0.5rem;
  border-radius: 2px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.status-aktiv   { background: rgba(60,90,40,0.85);  color: #8fc870; border: 1px solid #4a7a30; }
.status-inaktiv { background: rgba(80,50,20,0.85);  color: #c89040; border: 1px solid #7a5020; }
.status-tot     { background: rgba(90,20,20,0.85);  color: #c85050; border: 1px solid #7a2020; }

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-dim);
  grid-column: 1 / -1;
}

.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state p { font-size: 1.1rem; font-style: italic; }

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.modal-overlay.open { opacity: 1; visibility: visible; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius);
  width: 100%;
  max-width: 700px;
  box-shadow: 0 16px 64px rgba(0,0,0,0.9), 0 0 32px rgba(200,164,74,0.05);
  transform: translateY(20px);
  transition: transform 0.25s;
  margin: auto;
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-family: 'Cinzel', serif;
  font-size: 1.2rem;
  color: var(--gold);
  letter-spacing: 2px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem;
  transition: color 0.2s;
}

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

.modal-body { padding: 1.5rem; }

/* === Detail View === */
.detail-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1.5rem;
}

@media (max-width: 560px) {
  .detail-layout { grid-template-columns: 1fr; }
}

.detail-img {
  width: 200px;
  border: 1px solid var(--border-gold);
  border-radius: var(--radius);
  object-fit: cover;
}

.detail-img-placeholder {
  width: 200px;
  height: 260px;
  background: var(--bg-mid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--text-dim);
}

.detail-info h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.6rem;
  color: var(--gold-light);
  margin-bottom: 0.75rem;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
}

.info-item label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: 'Cinzel', serif;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 0.1rem;
}

.info-item span { color: var(--text-primary); font-size: 1rem; }

.detail-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.detail-section h3 {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  color: var(--gold-dark);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.detail-section p { color: var(--text-primary); font-size: 1rem; white-space: pre-wrap; }

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

/* === Edit Form === */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

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

.form-group { display: flex; flex-direction: column; gap: 0.3rem; }
.form-group.full { grid-column: 1 / -1; }

.form-group label {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.form-group input,
.form-group textarea,
.form-group select {
  background: var(--bg-mid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: 'Crimson Text', serif;
  font-size: 1rem;
  padding: 0.5rem 0.75rem;
  transition: border-color 0.2s;
  width: 100%;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { outline: none; border-color: var(--gold-dark); }

.form-group textarea { resize: vertical; min-height: 80px; }
.form-group select option { background: var(--bg-mid); }

/* === Index Page === */
.hero {
  text-align: center;
  padding: 6rem 2rem 4rem;
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-family: 'Cinzel', serif;
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 6px;
  text-shadow: 0 0 60px rgba(200, 164, 74, 0.4);
  margin-bottom: 0.5rem;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.3rem;
  font-style: italic;
  margin-bottom: 3rem;
}

.nav-cards {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  max-width: 800px;
  margin: 0 auto;
}

.nav-card {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius);
  padding: 2rem;
  min-width: 200px;
  text-decoration: none;
  text-align: center;
  transition: all 0.25s;
}

.nav-card:hover {
  border-color: var(--gold);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 20px rgba(200,164,74,0.1);
  transform: translateY(-2px);
}

.nav-card .icon { font-size: 2.5rem; display: block; margin-bottom: 0.75rem; }

.nav-card h2 {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  color: var(--gold-light);
  letter-spacing: 2px;
  margin-bottom: 0.5rem;
}

.nav-card p { color: var(--text-muted); font-size: 0.95rem; }

/* === Scrollbar === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border-gold); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dark); }

/* === Toast === */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--gold-dark);
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  color: var(--gold-light);
  z-index: 9999;
  box-shadow: var(--shadow);
  transform: translateY(10px);
  opacity: 0;
  transition: all 0.3s;
}

.toast.show { transform: translateY(0); opacity: 1; }
