/* ==========================================================================
   style.css – Familie Preuß Kalender
   ========================================================================== */

:root {
  --cream: #fbf6ee;
  --card: #ffffff;
  --ink: #3a332c;
  --muted: #8a7f72;
  --border: #ece2d3;

  --primary: #e2703a;
  --primary-dark: #c85a29;
  --primary-tint: #fdece2;

  --sage: #6f9d81;
  --sage-tint: #e6f2ea;

  --weekend-bg: #fff2df;
  --ferien-bg: #e3f3ec;
  --feiertag-dot: #d9534f;
  --today-ring: #e2703a;

  --danger: #c0453c;
  --danger-tint: #fbe7e5;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 9px;

  --shadow: 0 6px 20px rgba(80, 60, 30, 0.08);
  --shadow-lg: 0 18px 45px rgba(60, 40, 20, 0.18);
}

* { box-sizing: border-box; }

/* Sorgt dafür, dass [hidden] IMMER gewinnt, egal welche display-Regel
   sonst noch für ein Element gilt (z. B. .app-screen, .modal-overlay). */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: "Nunito Sans", system-ui, sans-serif;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: "Quicksand", "Nunito Sans", sans-serif;
  font-weight: 700;
  margin: 0 0 8px;
}

p { margin: 0 0 10px; line-height: 1.5; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

button { font-family: inherit; cursor: pointer; }

/* ---------------- Screens ---------------- */
.screen { min-height: 100vh; }

/* ---------------- Login ---------------- */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top left, #fff7ec, var(--cream) 60%);
  padding: 24px;
}

.login-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.login-emblem { font-size: 3rem; margin-bottom: 6px; }

.login-sub { color: var(--muted); margin-bottom: 22px; }

.login-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.login-buttons button {
  border: 2px solid var(--border);
  background: var(--cream);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: "Quicksand", sans-serif;
  color: var(--ink);
  transition: all 0.15s ease;
}

.login-buttons button:hover {
  border-color: var(--primary);
  background: var(--primary-tint);
  transform: translateY(-1px);
}

.login-hint { font-size: 0.8rem; color: var(--muted); margin: 0; }

/* ---------------- App shell ---------------- */
.app-screen { display: flex; flex-direction: column; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 8px; font-family: "Quicksand", sans-serif; font-weight: 700; font-size: 1.15rem; }
.brand-emoji { font-size: 1.5rem; }

.tabs { display: flex; gap: 6px; background: var(--cream); padding: 4px; border-radius: 999px; }

.tab-btn {
  border: none;
  background: transparent;
  padding: 8px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-family: "Quicksand", sans-serif;
  color: var(--muted);
}

.tab-btn.is-active { background: var(--primary); color: #fff; }

.user-box { display: flex; align-items: center; gap: 10px; }

.user-pill {
  background: var(--sage-tint);
  color: var(--sage);
  padding: 7px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
}

.icon-btn {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 700;
  color: var(--ink);
}
.icon-btn:hover { background: var(--cream); }

.app-main { flex: 1; padding: 22px 24px 60px; max-width: 1400px; width: 100%; margin: 0 auto; }

.app-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 16px;
}

/* ---------------- Buttons ---------------- */
.btn {
  border-radius: 12px;
  padding: 10px 18px;
  font-weight: 700;
  font-family: "Quicksand", sans-serif;
  border: 2px solid transparent;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-ghost { background: var(--card); border-color: var(--border); color: var(--ink); }
.btn-ghost:hover { border-color: var(--primary); }

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

/* ---------------- Cards / Overview ---------------- */
.overview-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 18px;
}

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

.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 22px;
}

.welcome-card { background: linear-gradient(135deg, var(--primary-tint), #fff); }

.list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }

.list-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--cream);
  border: 1px solid var(--border);
  text-align: left;
  width: 100%;
}

.list-item.clickable { cursor: pointer; transition: transform 0.1s ease, box-shadow 0.1s ease; }
.list-item.clickable:hover { transform: translateY(-1px); box-shadow: var(--shadow); }

.list-item .li-top { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-family: "Quicksand", sans-serif; }
.list-item .li-conflict { border-color: #f1c7bd; background: #fff6f2; }

.empty-hint { color: var(--muted); font-style: italic; padding: 10px 2px; }

/* ---------------- Toolbar / Legend ---------------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

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

.month-label {
  font-family: "Quicksand", sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  min-width: 190px;
  text-align: center;
}

.date-input, input[type="date"], input[type="time"], input[type="text"], textarea {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 0.95rem;
  background: #fff;
  color: var(--ink);
}

.goto-label { font-size: 0.85rem; color: var(--muted); font-weight: 700; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  color: var(--muted);
}

.legend-item { display: flex; align-items: center; gap: 6px; }

.dot { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.dot-weekend { background: var(--weekend-bg); border: 1px solid #f0d9ad; }
.dot-ferien { background: var(--ferien-bg); border: 1px solid #b9ddc9; }
.dot-feiertag { background: #fff; border: 1px solid var(--feiertag-dot); box-shadow: inset 0 0 0 3px var(--feiertag-dot); border-radius: 50%; }
.dot-today { background: #fff; border: 2px solid var(--today-ring); }

/* ---------------- Calendar table ---------------- */
.calendar-scroll {
  overflow-x: auto;
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 4px;
}

.calendar-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 900px;
}

.calendar-table thead th {
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 5;
  padding: 12px 10px;
  font-family: "Quicksand", sans-serif;
  text-align: left;
  border-bottom: 2px solid var(--border);
}

.col-date { width: 150px; }

.cat-th { text-align: center !important; }
.cat-th .cat-emoji { font-size: 1.2rem; display: block; }

.calendar-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.day-row.is-weekend { background: var(--weekend-bg); }
.day-row.is-ferien { background: var(--ferien-bg); }
.day-row.is-weekend.is-ferien { background: linear-gradient(90deg, var(--ferien-bg), var(--weekend-bg)); }

.day-row.is-today .col-date-cell { box-shadow: inset 3px 0 0 var(--today-ring); }
.day-row.is-today { outline: 2px solid var(--today-ring); outline-offset: -2px; }

.day-row.flash { animation: flashRow 1.4s ease; }
@keyframes flashRow {
  0% { background-color: #ffe3c4; }
  100% { background-color: transparent; }
}

.col-date-cell {
  font-family: "Quicksand", sans-serif;
  font-weight: 700;
  white-space: nowrap;
  position: sticky;
  left: 0;
  background: inherit;
}

.day-weekday { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; margin-right: 6px; }

.day-badges { display: block; margin-top: 3px; }

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  margin-right: 4px;
  margin-top: 2px;
}

.badge-ferien { background: var(--sage-tint); color: var(--sage); }
.badge-feiertag { background: #fdeceb; color: var(--feiertag-dot); }

.cat-cell { min-width: 130px; }

.cat-cell-inner { display: flex; flex-direction: column; gap: 5px; align-items: stretch; }

.event-chip {
  border: none;
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-size: 0.76rem;
  text-align: left;
  color: #3a332c;
  font-weight: 700;
  line-height: 1.25;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.event-chip:hover { filter: brightness(0.95); }
.event-chip .chip-time { display: block; font-size: 0.72rem; opacity: 0.8; }
.event-chip .chip-ort { display: block; font-weight: 600; opacity: 0.85; }

.add-chip-btn {
  border: 1.5px dashed var(--border);
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.85rem;
  padding: 3px 0;
  font-weight: 700;
}
.add-chip-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ---------------- Category checkboxes (form) ---------------- */
.category-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cat-check {
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  font-weight: 700;
  font-size: 0.9rem;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.cat-check input { display: none; }
.cat-check.checked { border-color: transparent; color: #fff; }

/* ---------------- Modal ---------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(58, 51, 44, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
}

.modal-body { padding: 20px 22px 24px; }

.form-row { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.form-row label { font-weight: 700; font-family: "Quicksand", sans-serif; font-size: 0.92rem; }
.form-row input, .form-row textarea { width: 100%; }
.form-row textarea { resize: vertical; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.two-col > div { display: flex; flex-direction: column; gap: 6px; }

.char-counter { text-align: right; font-size: 0.75rem; color: var(--muted); }

.form-error {
  background: var(--danger-tint);
  color: var(--danger);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 14px;
}

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ---------------- Detail list ---------------- */
.detail-list { display: flex; flex-direction: column; gap: 12px; margin: 0 0 8px; }
.detail-list dt { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); font-weight: 700; }
.detail-list dd { margin: 2px 0 0; font-size: 1rem; }
.detail-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.meta-note { font-size: 0.82rem; color: var(--muted); border-top: 1px dashed var(--border); padding-top: 10px; margin-top: 4px; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 14px 22px;
  border-radius: 12px;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  max-width: 90vw;
  text-align: center;
}
.toast.is-error { background: var(--danger); }
.toast.is-success { background: var(--sage); }

@media (max-width: 640px) {
  .app-header { padding: 12px 14px; }
  .brand-text { display: none; }
  .app-main { padding: 16px 12px 50px; }
  .month-label { min-width: unset; font-size: 1.05rem; }
}
