/* Günstig-Schlafen – ruhiges Nacht-Indigo + warmes Beige, geborgen */
:root {
  --indigo: #3b4a8c;
  --indigo-deep: #2c3868;
  --indigo-soft: #5b6bb0;
  --beige: #f3ead8;
  --beige-warm: #e9dcc2;
  --bg: #faf6ee;
  --surface: #ffffff;
  --surface-2: #fbf7ef;
  --text: #25283a;
  --text-soft: #5c5f72;
  --border: #e3dccb;
  --danger: #b03a3a;
  --ok: #3f7a52;
  --shadow: 0 6px 22px rgba(43, 56, 104, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --tap: 44px;
}

[data-theme="dark"] {
  --indigo: #8893d6;
  --indigo-deep: #aeb6e8;
  --indigo-soft: #6d79bd;
  --beige: #2a2c3d;
  --beige-warm: #33354a;
  --bg: #161826;
  --surface: #1f2233;
  --surface-2: #262a3d;
  --text: #ecebf3;
  --text-soft: #a6a9bd;
  --border: #343856;
  --danger: #e07878;
  --ok: #7fc097;
  --shadow: 0 6px 22px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 64px;
}

.visually-hidden,
.skip-link {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.skip-link:focus {
  position: fixed;
  top: 8px; left: 8px;
  width: auto; height: auto;
  clip: auto;
  background: var(--indigo);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  z-index: 100;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--indigo) 0%, var(--indigo-deep) 100%);
  color: #fff;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
  color: var(--beige);
  flex-shrink: 0;
}
.brand-text { min-width: 0; }
.brand-text h1 { font-size: 1.18rem; margin: 0; letter-spacing: 0.2px; }
.tagline { margin: 0; font-size: 0.74rem; opacity: 0.85; }

/* Buttons */
.btn {
  font: inherit;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  min-height: var(--tap);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.05s ease, filter 0.15s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-sm { min-height: 36px; padding: 7px 12px; font-size: 0.85rem; }
.btn-primary { background: var(--indigo); color: #fff; }
.btn-primary:hover { filter: brightness(1.07); }
.btn-soft { background: var(--beige-warm); color: var(--text); }
.btn-soft:hover { filter: brightness(0.97); }
.btn-ghost { background: transparent; color: var(--indigo-deep); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }

.icon-btn {
  background: rgba(255,255,255,0.14);
  color: #fff;
  border: none;
  border-radius: 10px;
  width: var(--tap); height: var(--tap);
  min-width: var(--tap);
  font-size: 1.2rem;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.modal-head .icon-btn { background: var(--surface-2); color: var(--text-soft); }
.icon-btn:hover { filter: brightness(1.1); }

/* Honest note */
.honest-note {
  margin: 12px 16px 4px;
  padding: 12px 14px;
  background: var(--beige);
  border: 1px solid var(--border);
  border-left: 4px solid var(--indigo);
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  color: var(--text-soft);
}
.honest-note strong { color: var(--text); }

main { padding: 12px 16px 24px; max-width: 760px; margin: 0 auto; }

/* Controls */
.controls {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.search-row input[type="search"] {
  width: 100%;
}
.filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.filter-row .field:nth-child(3) { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 0.78rem; font-weight: 600; color: var(--text-soft); }
.field-hint { font-size: 0.76rem; color: var(--text-soft); margin: 4px 0 0; }

input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  min-height: var(--tap);
  width: 100%;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--indigo-soft);
  outline-offset: 1px;
  border-color: var(--indigo-soft);
}

.geo-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.geo-status { font-size: 0.78rem; color: var(--ok); flex-basis: 100%; }
.geo-status.err { color: var(--danger); }

/* Actions */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.actions .btn-primary { flex: 1 1 auto; }

.summary { font-size: 0.82rem; color: var(--text-soft); margin: 0 0 10px; }

/* List */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-name { font-size: 1.05rem; font-weight: 700; margin: 0; color: var(--text); word-break: break-word; }
.card-price {
  font-weight: 700;
  color: var(--indigo-deep);
  background: var(--beige);
  border-radius: 999px;
  padding: 4px 12px;
  white-space: nowrap;
  font-size: 0.92rem;
}
.card-price.free { color: var(--ok); }

.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--beige-warm);
  color: var(--indigo-deep);
}
.badge-dist { background: var(--surface-2); color: var(--text-soft); border: 1px solid var(--border); }

.card-place { font-size: 0.86rem; color: var(--text-soft); margin: 4px 0; word-break: break-word; }
.card-note {
  font-size: 0.85rem;
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  white-space: pre-wrap;
  word-break: break-word;
}

.card-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.card-links a {
  font-size: 0.82rem;
  color: var(--indigo-deep);
  text-decoration: none;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.card-links a:hover { background: var(--beige); }

.card-actions { display: flex; gap: 8px; margin-top: 12px; }
.card-actions .btn { flex: 1; }

/* Empty states */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-soft);
}
.empty-emoji { font-size: 2.6rem; margin: 0 0 8px; }
.empty-title { font-size: 1.1rem; font-weight: 700; color: var(--text); margin: 0 0 6px; }
.empty-sub { margin: 0 auto 16px; max-width: 320px; font-size: 0.9rem; }
.empty-state .btn { margin: 4px; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 560px) { .modal { align-items: center; } }
.modal-backdrop { position: absolute; inset: 0; background: rgba(20, 22, 40, 0.55); }
.modal-card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: slideUp 0.2s ease;
}
@media (min-width: 560px) { .modal-card { border-radius: var(--radius); } }
.modal-card-sm { max-width: 380px; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 16px 8px;
  position: sticky;
  top: 0;
  background: var(--surface);
}
.modal-head h2 { margin: 0; font-size: 1.15rem; }
.modal-body { padding: 8px 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
.modal-foot .btn { flex: 1; }

.err { font-size: 0.75rem; color: var(--danger); min-height: 1em; }
.field.invalid input, .field.invalid select { border-color: var(--danger); }

/* Install banner */
.install-banner {
  position: fixed;
  left: 12px; right: 12px; bottom: 12px;
  z-index: 40;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}
.install-banner span { flex: 1; font-weight: 600; font-size: 0.9rem; }
.install-banner .icon-btn { background: var(--surface-2); color: var(--text-soft); width: 36px; height: 36px; min-width: 36px; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 80px;
  transform: translateX(-50%) translateY(10px);
  background: var(--indigo-deep);
  color: #fff;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 60;
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.toast-err { background: var(--danger); }

/* Footer */
.app-footer {
  text-align: center;
  padding: 16px;
  color: var(--text-soft);
  font-size: 0.76rem;
}

@media (min-width: 560px) {
  .filter-row { grid-template-columns: 1fr 1fr 1fr; }
  .filter-row .field:nth-child(3) { grid-column: auto; }
  .actions .btn-primary { flex: 0 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
