/* ═══════════════════════════════════════════════════════════════════════════
   components.css — Buttons, Cards, Forms, Modals/Sheets, Tabs, Pills, Listen,
   Toast, Stat-Karten. Mobile-first.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  font-size: .9rem;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  transition: all var(--t-fast);
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.btn:hover { border-color: var(--gold); color: var(--gold-bright); }
.btn:disabled { opacity: .5; pointer-events: none; }

.btn-primary {
  background: linear-gradient(160deg, var(--gold-bright), var(--gold));
  border-color: transparent;
  color: var(--text-on-gold);
}
.btn-primary:hover { box-shadow: var(--glow-gold); color: var(--text-on-gold); filter: brightness(1.05); }

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

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { color: var(--gold-bright); background: var(--gold-alpha-08); }

.btn-sm { min-height: 34px; padding: 0 13px; font-size: .8rem; }

.btn-icon {
  min-height: 40px;
  width: 40px;
  padding: 0;
  border-radius: var(--radius-pill);
  font-size: 1rem;
}

.btn-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn-loading::after {
  content: '';
  position: absolute;
  width: 17px; height: 17px;
  border: 2px solid var(--gold);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-card);
  margin-bottom: 14px;
}
.card-title {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-faint);
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* ── Stat-Karten ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  min-width: 0;
}
.stat-label { font-size: .7rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: .06em; }
.stat-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin-top: 4px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-value.gold  { color: var(--gold-bright); }
.stat-value.green { color: var(--green); }
.stat-value.red   { color: var(--red); }
.stat-sub { font-size: .72rem; color: var(--text-faint); margin-top: 2px; }

/* ── Pills / Status ── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 11px;
  border-radius: var(--radius-pill);
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
}
.pill-green { background: var(--green-dim); color: var(--green); }
.pill-amber { background: var(--amber-dim); color: var(--amber); }
.pill-red   { background: var(--red-dim);   color: var(--red); }
.pill-blue  { background: var(--blue-dim);  color: var(--blue); }
.pill-gold  { background: var(--gold-alpha-15); color: var(--gold-bright); }
.pill-dim   { background: var(--surface-3); color: var(--text-dim); }

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 14px;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  flex-shrink: 0;
  min-height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  font-size: .84rem;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: all var(--t-fast);
}
.tab-btn.active {
  background: var(--gold-alpha-15);
  border-color: var(--gold);
  color: var(--gold-bright);
}

/* ── Forms ── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; }
.field label { font-size: .78rem; font-weight: 600; color: var(--text-dim); }
.input, select.input, textarea.input {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  font-size: 16px; /* verhindert iOS-Auto-Zoom */
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-alpha-15); }
.input::placeholder { color: var(--text-faint); }
textarea.input { min-height: 90px; resize: vertical; }
select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23A8A69B' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}
.form-row { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 560px) { .form-row { grid-template-columns: 1fr 1fr; } }
.checkbox-row { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: .9rem; }
.checkbox-row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--gold); }

/* ── Modals: mobil Fullscreen-Sheet, Desktop Dialog ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(5, 8, 5, .65);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal-backdrop.open { display: flex; }

.modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: calc(100dvh - var(--safe-top) - 24px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  animation: sheetUp var(--t-med) both;
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  flex: 1;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.modal-close {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: var(--radius-pill);
  color: var(--text-dim);
  font-size: 1.05rem;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--gold-alpha-15); color: var(--gold-bright); }

.modal-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 18px;
}

.modal-footer {
  flex-shrink: 0;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px 18px calc(14px + var(--safe-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.modal-footer .btn { flex: 1; }

/* kleines Modal (Confirm) auch mobil zentriert */
.modal-backdrop.modal-center { align-items: center; padding: 24px; }
.modal-backdrop.modal-center .modal {
  max-width: 380px;
  border-radius: var(--radius-lg);
  animation: dialogIn var(--t-med) both;
}
@keyframes dialogIn { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }

@media (min-width: 768px) {
  .modal-backdrop { align-items: center; padding: 32px; }
  .modal {
    max-width: 620px;
    max-height: 90vh;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-modal);
    animation: dialogIn var(--t-med) both;
  }
  .modal-lg { max-width: 780px; }
  .modal-footer .btn { flex: 0 0 auto; }
}

/* ── Listen: Desktop Tabellenzeilen, mobil Karten ── */
.list { display: flex; flex-direction: column; gap: 8px; }
.list-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color var(--t-fast);
  cursor: pointer;
}
.list-row:hover { border-color: var(--border-strong); }
.list-row-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.list-row-title { font-weight: 600; font-size: .93rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; font-size: .78rem; color: var(--text-faint); }
.list-row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Toast ── */
#toast-container {
  position: fixed;
  z-index: 200;
  left: 12px; right: 12px;
  bottom: calc(var(--bottombar-h) + var(--safe-bottom) + 12px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  font-size: .88rem;
  opacity: 1;
  transition: opacity .3s;
  animation: toastIn var(--t-med) both;
}
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast-success { border-color: var(--green); }
.toast-success .toast-icon { color: var(--green); }
.toast-error { border-color: var(--red); }
.toast-error .toast-icon { color: var(--red); }
.toast-icon { font-weight: 700; }

@media (min-width: 768px) {
  #toast-container { left: auto; right: 24px; bottom: 24px; width: 340px; }
}

/* ── Quick Actions ── */
.quick-actions { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 14px; scrollbar-width: none; padding-bottom: 2px; }
.quick-actions::-webkit-scrollbar { display: none; }
.quick-action-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: .84rem;
  font-weight: 600;
  color: var(--text-dim);
  transition: all var(--t-fast);
}
.quick-action-btn:hover, .quick-action-btn:active {
  border-color: var(--gold);
  color: var(--gold-bright);
  box-shadow: var(--glow-gold);
}

/* ── Segmented (z.B. Check-in) ── */
.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
}
.segmented button {
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-dim);
  transition: all var(--t-fast);
  white-space: nowrap;
}
.segmented button.active { background: var(--gold); color: var(--text-on-gold); }
