/* --- Farbvariablen --- */
:root {
  --bg: #0f172a;
  --card: #111827;
  --muted: #9ca3af;
  --text: #e5e7eb;
  --accent: #22c55e;
  --accent2: #3b82f6;
  --danger: #ef4444;
  --pad-bg: #0a0f1e;
  --pad-stroke: #e5e7eb;
}

/* Farben für das "AWO"-Theme */
body.theme-awo {
  --bg: #1a1a1a;
  --card: #2a2a2a;
  --text: #f0f0f0;
  --accent: #C8102E;
  --pad-bg: #111111;
  --pad-stroke: #f0f0f0;
}

/* Farben für das "Sandra"-Theme */
body.theme-sandra {
  --bg: #f09bc9;
  --card: #f8c6e9;
  --muted: #6b7280;
  --text: #374151;
  --accent: #ec4899;
  --accent2: #8b5cf6;
  --danger: #ef4444;
  --pad-bg: #f8fafc;
  --pad-stroke: #e04a95;
}

/* --- Allgemeine Stile --- */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, "Helvetica Neue", Arial;
  transition: background .3s, color .3s;
}

.wrap {
  max-width: 1100px;
  margin: 24px auto;
  padding: 16px;
}

/* --- Header und Überschriften --- */
header {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

h1 {
  font-size: clamp(20px, 2.4vw, 28px);
  margin: 0;
}

/* --- Karten-Container --- */
.card {
  background: var(--card);
  backdrop-filter: saturate(140%) blur(6px);
  border: 1px solid #1f2937;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

body.theme-sandra .card {
  border-color: #e5e7eb;
}

/* --- Formularelemente --- */
label {
  display: block;
  font-weight: 600;
  margin: .4rem 0 .25rem;
}

input,
textarea,
select,
button {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #0b1220;
  color: var(--text);
}

body.theme-sandra input,
body.theme-sandra textarea,
body.theme-sandra select,
body.theme-sandra button {
  background: #f1f5f9;
  color: var(--text);
  border-color: #cbd5e1;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--accent2);
  outline-offset: 0;
}

/* --- Layout-Helfer --- */
.grid {
  display: grid;
  gap: 12px;
}

@media (min-width: 840px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  cursor: pointer;
  border: none;
}

.btn.primary {
  background: var(--accent2);
  color: white;
}

.btn.success {
  background: var(--accent);
  color: white;
}

.btn.danger {
  background: var(--danger);
  color: white;
}

.btn.secondary {
  background: var(--bg);
  border: 1px solid #334155;
  color: var(--text);
}

body.theme-sandra .btn.secondary {
  border-color: #cbd5e1;
}

.btn:disabled {
  opacity: .6;
  cursor: not-allowed;
}

/* --- Signatur-Pad --- */
.pad {
  border: 2px dashed #374151;
  border-radius: 14px;
  background: var(--pad-bg);
  height: 260px;
  position: relative;
  touch-action: none;
}

.pad canvas {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  touch-action: none;
}

/* --- Sonstige Elemente --- */
.hint {
  color: var(--muted);
  font-size: .9rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

th,
td {
  border-bottom: 1px solid #223047;
  padding: 8px;
  text-align: left;
  font-size: .95rem;
}

body.theme-sandra th,
body.theme-sandra td {
  border-color: #e5e7eb;
}

th {
  color: var(--text);
  font-weight: 700;
}

.tag {
  display: inline-block;
  padding: .2rem .5rem;
  border-radius: 999px;
  border: 1px solid #334155;
  color: var(--text);
  font-size: .8rem;
}

body.theme-sandra .tag {
  border-color: #cbd5e1;
}

.right {
  margin-left: auto;
}

#exportArea {
  border-top: 1px solid #223047;
  margin-top: 16px;
  padding-top: 16px;
}

body.theme-sandra #exportArea {
  border-color: #e5e7eb;
}

#themeSwitcher .btn {
  padding: .2rem .6rem;
  width: auto;
  font-size: .8rem;
}

#themeSwitcher .btn.active {
  background: var(--accent);
  color: white;
}

body.theme-sandra #themeSwitcher .btn.active {
  color: white;
}

#feedbackContainer {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
}

.feedback-message {
    background: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
    transform: translateY(-20px);
}

.feedback-message.show {
    opacity: 1;
    transform: translateY(0);
}