/* Fix: Box-Modell und Überlauf */
*, *::before, *::after { box-sizing: border-box; }

.lightbox { 
  max-width: 560px; 
  width: min(100%, 560px);
  overflow: hidden; 
}

input[type="text"], input[type="number"], select, textarea { 
  max-width: 100%; 
}

/* ===== Pull-to-Refresh ===== */
.pull-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  transform: translateY(-60px);
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 1000;
  pointer-events: none;
}

.pull-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
}

.pull-indicator.ready .pull-spinner {
  border-top-color: var(--success);
}

.pull-indicator.refreshing .pull-spinner {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.pull-text {
  font-size: 14px;
  color: var(--muted);
}

.pull-indicator.ready .pull-text {
  color: var(--success);
}

/* ===== Base ===== */
:root {
  --bg: #1a1510;
  --card: #252019;
  --card-alt: #1a1510;
  --border: #3d3428;
  --text: #f0e6d8;
  --muted: #a89880;
  --accent: #d4a24c;
  --accent-hover: #e6b860;
  --success: #7cb342;
  --error: #cf6650;
  --shadow: 0 10px 30px rgba(0,0,0,.45);
}

html { height: 100%; }
body {
  min-height: 100%;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  margin: 1rem;
  padding-bottom: 2rem;
  background: radial-gradient(1200px 600px at 10% -10%, rgba(212,162,76,.08), transparent 60%),
              radial-gradient(1200px 600px at 110% 20%, rgba(180,120,60,.06), transparent 60%),
              var(--bg);
  background-attachment: fixed;
  color: var(--text);
  overscroll-behavior-y: contain;
}
@media (min-width: 600px) {
  body { margin: 2rem; }
}

/* ===== Cards / Accordion ===== */
.accordion-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--card), var(--card-alt));
  box-shadow: var(--shadow);
}

.accordion-header {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  cursor: pointer;
  border: 0;
  font-size: 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  background: transparent;
  color: var(--text);
}

.accordion-header:hover { background: rgba(255,255,255,.03); }

.accordion-item.open {
  border-color: var(--accent);
  box-shadow: var(--shadow), 0 0 0 1px rgba(212, 162, 76, .2);
}
.accordion-item.open .accordion-header {
  background: rgba(212, 162, 76, .08);
}

.accordion-arrow {
  transform: rotate(0deg);
  transition: transform .18s ease;
  opacity: .8;
}
.accordion-item.open .accordion-arrow {
  transform: rotate(180deg);
  opacity: 1;
}

.accordion-content {
  display: none;
  padding: 0;
  background: transparent;
  border-top: 1px solid var(--border);
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

.content-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.content-section:last-child {
  border-bottom: none;
}

.section-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.section-label {
  font-weight: 600;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.section-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.btn-w3w {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(180deg, #e74c3c, #c0392b);
  border-color: #e74c3c;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}
.btn-w3w:hover {
  background: linear-gradient(180deg, #ff5f4f, #e74c3c);
  border-color: #ff5f4f;
}
.w3w-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.comments-list {
  margin-top: 8px;
}

/* Opening Hours */
.opening-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 16px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.opening-status.open {
  color: var(--success);
}

.opening-status.open .status-dot {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.opening-status.closed {
  color: var(--error);
}

.opening-status.closed .status-dot {
  background: var(--error);
  box-shadow: 0 0 8px var(--error);
}

.hours-today {
  margin-top: 6px;
  font-size: 14px;
  color: var(--muted);
}

.meta { color: var(--muted); margin-bottom: 10px; }
.meta a { color: var(--accent); text-decoration: none; }
.meta a:hover { text-decoration: underline; }

.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.meta-info {
  color: var(--muted);
}

.comments { margin-top: 16px; }
.comment {
  border-top: 1px dashed var(--border);
  padding: 10px 0;
  color: var(--text);
}
.comment.empty {
  color: var(--muted);
  font-style: italic;
}

/* ===== Buttons ===== */
.actions { margin-bottom: 1.5rem; display: flex; gap: 10px; flex-wrap: wrap; }
.actions .btn { flex: 1; text-align: center; }

.btn {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.02);
  color: var(--text);
  cursor: pointer;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
  backdrop-filter: blur(2px);
  -webkit-tap-highlight-color: transparent;
}

.btn-small {
  padding: 6px 12px;
  font-size: 14px;
}

.btn:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,.05);
  border-color: #334155;
}
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(180deg, #d4a24c, #b8862e);
  border-color: #d4a24c;
  color: #1a1510;
  font-weight: 600;
}
.btn-primary:hover {
  background: linear-gradient(180deg, #e6b860, #d4a24c);
  border-color: #e6b860;
}

/* ===== Lightbox ===== */
.lightbox-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 999;
  padding: 1rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
@media (min-width: 600px) {
  .lightbox-backdrop {
    align-items: center;
    padding: 2rem;
  }
}
.lightbox {
  background: linear-gradient(180deg, var(--card), var(--card-alt));
  padding: 18px;
  border-radius: 14px;
  max-width: 560px; width: 100%;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  animation: pop .15s ease;
  margin: auto 0;
}
@keyframes pop { from { transform: scale(.98); opacity: 0 } to { transform: scale(1); opacity: 1 } }

/* ===== Forms ===== */
.field { margin-bottom: 14px; }
label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--text); }
input[type="text"], input[type="number"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,.03);
  color: var(--text);
  outline: none;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
select {
  background-color: #252019;
}
select option {
  background-color: #252019;
  color: #f0e6d8;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212,162,76,.25);
  background: rgba(255,255,255,.06);
}
.helper { color: var(--muted); font-size: 13px; margin-top: 6px; }

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 8px;
}
.form-actions .btn {
  flex: 1 1 auto;
  min-width: 120px;
  text-align: center;
}
@media (min-width: 400px) {
  .form-actions .btn {
    flex: 0 0 auto;
  }
}

/* ===== Badges / Alerts ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,.08);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  margin-left: 8px;
  color: var(--muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.badge.good {
  background: rgba(47, 191, 113, .15);
  border-color: rgba(47, 191, 113, .4);
  color: #7ee6a8;
}
.badge.mid {
  background: rgba(245, 166, 35, .15);
  border-color: rgba(245, 166, 35, .4);
  color: #f5c86a;
}
.badge.bad {
  background: rgba(241, 96, 96, .15);
  border-color: rgba(241, 96, 96, .4);
  color: #ff9e9e;
}
.error, .success {
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 12px;
  font-weight: 600;
}
.error {
  background: rgba(241, 96, 96, .08);
  border: 1px solid rgba(241, 96, 96, .35);
  color: #ffb3b3;
}
.success {
  background: rgba(47, 191, 113, .08);
  border: 1px solid rgba(47, 191, 113, .35);
  color: #b7f0cf;
}

/* ===== Stars ===== */
.stars {
  display: flex; gap: 4px; justify-content: flex-start; align-items: center;
}
.stars input { display: none; }
.stars label {
  cursor: pointer; 
  font-size: 36px; 
  line-height: 1; 
  color: #808aa0;
  transition: color .15s ease, transform .05s ease;
  padding: 4px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.stars label::before { content: '☆'; }
.stars label.active::before, .stars label.preview::before { content: '★'; color: #f5a623; }
.stars label:active { transform: scale(.92); }

@media (hover: none) {
  .stars label.preview::before { content: '☆'; color: #808aa0; }
  .stars label.active.preview::before { content: '★'; color: #f5a623; }
}

/* ===== Utilities ===== */
h1 { margin-top: 0; letter-spacing: .2px; }

/* ===== Header Logo ===== */
.header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1.5rem;
}
.header-logo {
  width: 80px;
  height: 80px;
  border-radius: 18px;
  box-shadow: var(--shadow);
  border: 2px solid var(--border);
}
@media (min-width: 600px) {
  .header-logo {
    width: 100px;
    height: 100px;
    border-radius: 22px;
  }
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}
.empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  filter: grayscale(0.3);
}
.empty-state p {
  margin: 0.5rem 0;
  font-size: 1.1rem;
}
.empty-hint {
  font-size: 0.95rem !important;
  opacity: 0.7;
}

/* ===== Toast-Meldungen ===== */
#toast-container {
  position: fixed;
  top: 20px; right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
}
.toast {
  padding: 12px 16px;
  border-radius: 10px;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
  animation: toastIn .3s ease, toastOut .3s ease 4.7s forwards;
}
.toast.error { background: #a04030; }
.toast.success { background: #5d8a30; }
@keyframes toastIn { from {opacity:0; transform:translateY(-5px)} to {opacity:1; transform:translateY(0)} }
@keyframes toastOut { to {opacity:0; transform:translateY(-5px)} }
