/* NES.css Overrides & Custom Styles */

/* User-Email in der Nav */
.user-email {
  font-size: 0.65rem;
  opacity: 0.8;
}

/* Status badges */
.status-active { color: #2e7d32; font-weight: 600; }
.status-paused { color: #f57c00; font-weight: 600; }
.status-completed { color: #999; }
.status-error { color: #c62828; font-weight: 600; }

/* Helper */
.text-muted { opacity: 0.6; font-size: 0.8rem; }

/* Stat-Kacheln auf dem Dashboard */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  text-align: center;
  padding: 1rem 0.5rem;
  border: 4px solid #000;
  border-radius: 0;
  background: #fff;
}
[data-theme="dark"] .stat-card {
  background: #212529;
}
.stat-card strong {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}
.stat-number {
  font-size: 1.8rem;
  font-weight: 700;
}

/* Inline-Formulare */
.inline-form {
  display: inline;
  margin: 0;
}

/* Buttons in Tabellen: kleine Pixel-Buttons */
.nes-btn.is-small {
  padding: 0.2rem 0.6rem;
  font-size: 0.6rem;
  height: auto;
}

/* Details/Summary für Termin-Vorschau */
details {
  margin-bottom: 1rem;
}
details summary {
  cursor: pointer;
  font-weight: 600;
}

/* Tabelle an NES anpassen */
.nes-table {
  font-size: 0.75rem;
}
.nes-table td, .nes-table th {
  padding: 0.4rem 0.6rem;
}
.nes-table a {
  text-decoration: underline;
}

/* Links in Tabellen */
td a {
  font-size: 0.75rem;
}

/* Forms innerhalb von NES */
.nes-input, .nes-select, .nes-textarea {
  margin-bottom: 0.5rem;
}

/* Pre-Text (Reminder-Inhalt) */
pre {
  white-space: pre-wrap;
  background: #f5f5f5;
  padding: 1rem;
  border: 2px solid #ccc;
}
[data-theme="dark"] pre {
  background: #1a1d23;
  border-color: #444;
}

/* Main container nicht zu groß */
main.nes-container {
  min-height: 60vh;
}

/* ========== WENIGER GRELLER LIGHT MODE ========== */
:root {
  --color-bg: #f4f3ee;
  --color-container: #fafaf8;
  --color-border: #d4d2cb;
  --color-text: #3a3a3a;
  --color-heading: #2a2a2a;
  --color-muted: #8a8a8a;
}

/* Body-Sanierung — global (Light ist default) */
body {
  background-color: var(--color-bg) !important;
  color: var(--color-text) !important;
}

.nes-container,
.nes-container.is-rounded,
.nes-container.with-title {
  background-color: var(--color-container);
  border-color: var(--color-border);
  color: var(--color-text);
}

h1, h2, h3 {
  color: var(--color-heading);
}

header {
  border-bottom-color: var(--color-border) !important;
  background-color: var(--color-container) !important;
}

.nes-btn {
  background-color: #e8e6e0;
  border-color: #c4c2ba;
  color: var(--color-text);
}
.nes-btn::after {
  border-color: #c4c2ba;
}
.nes-btn.is-primary {
  background-color: #4a7c9e;
  border-color: #3a6a8a;
  color: #fff;
}

.nes-input,
.nes-select,
.nes-textarea {
  background-color: #fcfcfa;
  border-color: var(--color-border);
  color: var(--color-text);
}

.nes-table.is-bordered {
  border-color: var(--color-border);
  color: var(--color-text);
}
.nes-table.is-bordered thead th,
.nes-table.is-bordered tbody td {
  border-color: var(--color-border);
}

.stat-card {
  background: var(--color-container);
  border-color: var(--color-border);
}

pre {
  background: #efeee9;
  border-color: var(--color-border);
  color: var(--color-text);
}

hr {
  border-color: var(--color-border);
}

details {
  background-color: var(--color-container);
  border: 1px solid var(--color-border);
}

.nes-text.is-disabled {
  color: var(--color-muted);
}

/* Light-Spezifisch (wenn kein Dark) überschreiben */
body:not([data-theme="dark"]) {
  background-color: var(--color-bg) !important;
}

/* ========== DARK MODE (Custom, da NES.css kein natives Dark/Light hat) ========== */
[data-theme="dark"] {
  --color-bg: #1a1d23;
  --color-fg: #e0e0e0;
  --color-border: #555;
  --color-primary: #7fc7ff;
  --color-error: #ff6b6b;
  --color-success: #69db7c;
  --color-warning: #ffd43b;
}

[data-theme="dark"] body {
  background-color: var(--color-bg) !important;
  color: var(--color-fg) !important;
}

[data-theme="dark"] .nes-container,
[data-theme="dark"] .nes-container.is-rounded,
[data-theme="dark"] .nes-container.is-dark,
[data-theme="dark"] .nes-container.with-title {
  background-color: #22252d;
  border-color: var(--color-border);
  color: var(--color-fg);
}

[data-theme="dark"] .nes-container > :is(h1, h2, h3, h4, h5, h6) {
  color: #f0f0f0;
}

[data-theme="dark"] header {
  border-bottom-color: var(--color-border) !important;
  background-color: #1e2128;
}

[data-theme="dark"] a {
  color: var(--color-primary);
}

[data-theme="dark"] a:visited {
  color: #b197fc;
}

/* NES Buttons im Dark Mode */
[data-theme="dark"] .nes-btn {
  background-color: #333842;
  border-color: var(--color-border);
  color: var(--color-fg);
  box-shadow: none;
}
[data-theme="dark"] .nes-btn::after {
  border-color: var(--color-border);
}
[data-theme="dark"] .nes-btn.is-primary {
  background-color: #2b5f8a;
  border-color: #4a8fd4;
  color: #fff;
}
[data-theme="dark"] .nes-btn.is-error {
  background-color: #8a2b2b;
  border-color: #d44a4a;
  color: #fff;
}
[data-theme="dark"] .nes-btn.is-success {
  background-color: #2b6e3a;
  border-color: #4ad46a;
  color: #fff;
}
[data-theme="dark"] .nes-btn.is-warning {
  background-color: #8a742b;
  border-color: #d4b84a;
  color: #fff;
}

[data-theme="dark"] .nes-input,
[data-theme="dark"] .nes-select,
[data-theme="dark"] .nes-textarea {
  background-color: #2a2d35;
  border-color: var(--color-border);
  color: var(--color-fg);
}
[data-theme="dark"] .nes-input::placeholder,
[data-theme="dark"] .nes-textarea::placeholder {
  color: #888;
}

[data-theme="dark"] .nes-table,
[data-theme="dark"] .nes-table.is-bordered {
  border-color: var(--color-border);
  color: var(--color-fg);
}
[data-theme="dark"] .nes-table.is-bordered thead th,
[data-theme="dark"] .nes-table.is-bordered tbody td {
  border-color: var(--color-border);
}
[data-theme="dark"] .nes-table tbody tr {
  background-color: transparent;
}
[data-theme="dark"] .nes-table tbody tr:nth-child(even) {
  background-color: rgba(255,255,255,0.03);
}
[data-theme="dark"] .nes-table tbody tr:hover {
  background-color: rgba(255,255,255,0.06);
}

[data-theme="dark"] .nes-text.is-primary {
  color: var(--color-primary);
}
[data-theme="dark"] .nes-text.is-success {
  color: var(--color-success);
}
[data-theme="dark"] .nes-text.is-warning {
  color: var(--color-warning);
}
[data-theme="dark"] .nes-text.is-error {
  color: var(--color-error);
}
[data-theme="dark"] .nes-text.is-disabled {
  color: #666;
}

[data-theme="dark"] .stat-card {
  background: #22252d;
  border-color: var(--color-border);
}

[data-theme="dark"] pre {
  background: #22252d;
  border-color: var(--color-border);
  color: var(--color-fg);
}

[data-theme="dark"] table.nes-table.is-bordered {
  background-color: #1e2128;
}

[data-theme="dark"] hr {
  border-color: var(--color-border);
}

[data-theme="dark"] details {
  background-color: #22252d;
  padding: 0.5rem;
  border: 1px solid var(--color-border);
}
