/* booking-app / style.css — Mobile-first */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #dbeafe;
  --danger: #dc2626;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #f59e0b;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans TC", sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--gray-100);
  color: var(--gray-800);
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  line-height: 1.5;
}

/* Header */
.app-header {
  background: var(--primary);
  color: #fff;
  padding: 24px 16px 20px;
}
.header-inner {
  max-width: 640px;
  margin: 0 auto;
}
.eyebrow {
  margin: 0 0 2px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.75;
}
.app-header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}
.subtitle {
  margin: 4px 0 0;
  font-size: 0.875rem;
  opacity: 0.85;
}

/* App shells */
.app-shell {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 12px calc(80px + var(--safe-bottom));
}
.login-shell {
  padding-top: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50dvh;
}

/* Cards */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 16px;
  margin-bottom: 16px;
}
.card h2 {
  margin: 0 0 4px;
  font-size: 1.125rem;
  font-weight: 600;
}
.card .hint {
  margin: 0 0 12px;
  font-size: 0.8125rem;
  color: var(--gray-500);
}
.card-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

/* Login */
.login-card {
  text-align: center;
  padding: 32px 24px;
}
.login-badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: 12px;
}

/* Profile card */
.profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}
.profile-card .avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--gray-200);
}
.profile-card .profile-info {
  display: flex;
  flex-direction: column;
}
.profile-card .profile-name {
  font-weight: 600;
  font-size: 0.9375rem;
}
.profile-card .profile-sub {
  font-size: 0.75rem;
  color: var(--gray-500);
}

/* History */
.history-panel {
  padding: 0;
  overflow: hidden;
}
.history-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 16px;
  cursor: pointer;
  font-size: 1.0625rem;
  font-weight: 600;
  list-style: none;
}
.history-summary::-webkit-details-marker {
  display: none;
}
.history-summary::after {
  content: "▾";
  color: var(--gray-500);
  font-size: 0.9375rem;
  transition: transform 0.15s ease;
}
.history-panel[open] .history-summary::after {
  transform: rotate(180deg);
}
.history-body {
  padding: 0 16px 16px;
  border-top: 1px solid var(--gray-200);
}
.history-body .hint {
  margin-top: 12px;
}
.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.history-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--gray-50);
  padding: 14px 12px;
}
.history-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.history-card-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
}
.history-card-time {
  font-size: 0.75rem;
  color: var(--gray-500);
  text-align: right;
}
.history-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 600;
}
.history-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 0.8125rem;
}
.history-meta-row {
  color: var(--gray-600);
}
.history-label {
  color: var(--gray-500);
  font-weight: 600;
}
.history-date-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.history-date-item {
  border-top: 1px dashed var(--gray-200);
  padding-top: 10px;
}
.history-date-item:first-child {
  border-top: none;
  padding-top: 0;
}
.history-date-title {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.history-wish-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.history-wish-item {
  font-size: 0.8125rem;
  color: var(--gray-600);
}

/* Form fields */
.form-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.field-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--gray-700);
}
.required { color: var(--danger); }
.field-hint {
  font-size: 0.75rem;
  color: var(--gray-500);
}
.field-hint.error { color: var(--danger); }
.field-hint.success { color: var(--success); }

.text-input, .select-input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font);
  color: var(--gray-800);
  background: #fff;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.text-input:focus, .select-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.text-input.error, .select-input.error {
  border-color: var(--danger);
}

.select-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 6l3.5 4 3.5-4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* Date block */
.date-blocks {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.date-block {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  background: var(--gray-50);
  position: relative;
}
.date-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.date-block-header .badge {
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 10px;
  border-radius: 999px;
}
.remove-date-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--gray-200);
  color: var(--gray-600);
  font-size: 1.125rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.remove-date-btn:hover { background: var(--gray-300); }

.booth-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}
.booth-row {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 10px;
}
.booth-row.is-disabled {
  background: var(--gray-100);
  border-style: dashed;
}
.booth-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.booth-row .booth-label {
  font-size: 0.75rem;
  color: var(--gray-500);
  font-weight: 500;
}
.booth-clear-btn {
  border: none;
  background: transparent;
  color: var(--primary);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
}
.booth-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.booth-chip {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 999px;
  background: #fff;
  color: var(--gray-700);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.booth-chip:hover,
.booth-chip:focus-visible {
  border-color: var(--primary);
  outline: none;
}
.booth-chip.is-selected {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}
.booth-chip:disabled,
.booth-clear-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.booth-chip-special {
  border-style: dashed;
}
.booth-row-summary {
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--gray-500);
}

/* Buttons */
.primary-button {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 14px 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.primary-button:hover { background: var(--primary-hover); }
.primary-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.ghost-button {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 12px 24px;
  background: transparent;
  color: var(--primary);
  border: 1.5px dashed var(--primary);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.ghost-button:hover { background: var(--primary-light); }
.add-date-btn {
  margin-top: 12px;
}

/* Sticky action bar */
.sticky-action {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 12px calc(12px + var(--safe-bottom));
  background: #fff;
  border-top: 1px solid var(--gray-200);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
  z-index: 100;
}
.sticky-action .primary-button {
  max-width: 640px;
  margin: 0 auto;
}

/* Messages */
.inline-message {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  line-height: 1.4;
  margin-bottom: 10px;
}
.inline-message.info {
  background: var(--primary-light);
  color: var(--primary);
}
.inline-message.error {
  background: #fef2f2;
  color: var(--danger);
}
.inline-message.success {
  background: var(--success-light);
  color: var(--success);
}

/* Success */
.success-card {
  text-align: center;
  padding: 40px 24px;
}
.success-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

/* Utilities */
[hidden] { display: none !important; }

/* Spinner */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (min-width: 480px) {
  .app-shell { padding-left: 16px; padding-right: 16px; }
  .card { padding: 24px 20px; }
  .form-grid.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
}
