/* =============================================================================
   Reservas Melilla la Vieja — Public Booking Styles
   Mediterranean Patrimonial Design
   (c) 2024 Melilla Fundación Monumental
   Designer: Equipo de Desarrollo | Created: December 2024
   ============================================================================= */

/* Fonts served locally — no external requests for GDPR compliance */

/* ── Reset & Base ─────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: #faf6f0;
  font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #2d2a26;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: Georgia, 'Times New Roman', serif;
  color: #4a3728;
  line-height: 1.25;
}

a {
  color: #8B6914;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

button {
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
}

/* ── Header ───────────────────────────────────────────────────────────────── */

.header {
  background: linear-gradient(135deg, #8B6914 0%, #a67c00 60%, #7a5c10 100%);
  color: white;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  display: flex;
  flex-direction: column;
}

.header-brand h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: white;
  letter-spacing: 0.02em;
  margin: 0;
  line-height: 1.1;
}

.header-brand span {
  font-size: 0.78rem;
  font-weight: 300;
  opacity: 0.85;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-selector {
  display: flex;
  gap: 4px;
  align-items: center;
}

.lang-btn {
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  color: white;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.lang-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: white;
}

.lang-btn.active {
  background: rgba(255, 255, 255, 0.25);
  border-color: white;
}

/* ── Layout Container ─────────────────────────────────────────────────────── */

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

/* ── Section Titles ───────────────────────────────────────────────────────── */

.section-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  color: #4a3728;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid #e8d9c0;
}

/* ── Space Cards Grid ─────────────────────────────────────────────────────── */

.spaces-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.space-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(74, 55, 40, 0.10);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.space-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(74, 55, 40, 0.15);
}

.space-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background-color: #e8d9c0;
}

.space-card-image-placeholder {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #d4b896, #c9a878);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: rgba(255, 255, 255, 0.7);
}

.space-card-content {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.space-card-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: #4a3728;
  margin-bottom: 8px;
}

.space-card-description {
  font-size: 0.9rem;
  color: #6b5a4e;
  line-height: 1.5;
  flex: 1;
  margin-bottom: 16px;
  /* 2-line clamp */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.space-card-location {
  font-size: 0.8rem;
  color: #8B6914;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-book {
  background: #C4572A;
  color: white;
  border: none;
  padding: 11px 20px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  text-align: center;
  width: 100%;
}

.btn-book:hover {
  background: #a84524;
  transform: translateY(-1px);
}

.btn-book:active {
  transform: translateY(0);
}

/* ── Back Button ──────────────────────────────────────────────────────────── */

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #8B6914;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 20px;
  padding: 6px 0;
  background: none;
  border: none;
  transition: color 0.2s;
}

.back-btn:hover {
  color: #6d5010;
}

/* ── Date Picker ──────────────────────────────────────────────────────────── */

.datepicker-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.datepicker-space-info {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.datepicker-space-thumb {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  background-color: #e8d9c0;
  flex-shrink: 0;
}

.datepicker-space-thumb-placeholder {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  background: linear-gradient(135deg, #d4b896, #c9a878);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  flex-shrink: 0;
}

.datepicker-space-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  color: #4a3728;
}

/* Calendar Grid */

.calendar-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

.calendar-month {
  background: white;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(74, 55, 40, 0.08);
}

.calendar-month-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.calendar-month-title {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 600;
  color: #4a3728;
  text-align: center;
  flex: 1;
}

.cal-nav-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #8B6914;
  font-size: 1.2rem;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
  transition: background 0.15s;
}

.cal-nav-btn:hover {
  background: #f0e9d6;
}

.cal-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.calendar-days-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 6px;
}

.calendar-day-label {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: #8B6914;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 0;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.day-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  border-radius: 50%;
  cursor: default;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}

.day-cell.empty {
  visibility: hidden;
}

.day-cell.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  color: #6b5a4e;
}

.day-cell.available {
  color: #2d2a26;
  cursor: pointer;
  font-weight: 500;
}

.day-cell.available:hover {
  background: #C4572A;
  color: white;
}

.day-cell.today {
  font-weight: 700;
  border: 2px solid #8B6914;
}

.day-cell.selected {
  background: #C4572A;
  color: white;
  font-weight: 700;
}

.day-cell.selected.today {
  border-color: #a84524;
}

/* ── Slots ────────────────────────────────────────────────────────────────── */

.slots-section {
  margin-top: 8px;
}

.slots-section-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  color: #4a3728;
  margin-bottom: 14px;
}

.slots-container {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.slot-pill {
  display: inline-block;
  padding: 10px 20px;
  border: 2px solid #8B6914;
  border-radius: 24px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #4a3728;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.slot-pill:hover {
  background: #8B6914;
  color: white;
}

.slot-pill.full {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: #c8b89a;
  color: #6b5a4e;
}

.slot-pill.full:hover {
  background: transparent;
  color: #6b5a4e;
}

.slots-hint {
  color: #8a7560;
  font-style: italic;
  font-size: 0.9rem;
  padding: 12px 0;
}

.slots-loading {
  color: #8a7560;
  font-size: 0.9rem;
  padding: 12px 0;
}

/* ── Booking Form ─────────────────────────────────────────────────────────── */

.booking-form-wrapper {
  max-width: 520px;
  margin: 0 auto;
}

.booking-summary-card {
  background: white;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(74, 55, 40, 0.08);
  border-left: 4px solid #8B6914;
}

.booking-summary-card h3 {
  font-size: 1rem;
  color: #8B6914;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 600;
}

.summary-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.summary-label {
  color: #8a7560;
  font-size: 0.85rem;
  min-width: 80px;
  flex-shrink: 0;
}

.summary-value {
  color: #2d2a26;
  font-weight: 500;
}

.booking-form {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(74, 55, 40, 0.08);
}

.booking-form h3 {
  margin-bottom: 20px;
  font-size: 1.1rem;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: #4a3728;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.form-group input {
  width: 100%;
  border: 1.5px solid #d4c5a9;
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 0.95rem;
  font-family: inherit;
  color: #2d2a26;
  background: #fffdf9;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-group input:focus {
  border-color: #8B6914;
  box-shadow: 0 0 0 3px rgba(139, 105, 20, 0.12);
}

.form-group input::placeholder {
  color: #b9a98c;
}

.form-group input.error-field {
  border-color: #C4572A;
}

.field-error {
  font-size: 0.82rem;
  color: #C4572A;
  margin-top: 6px;
  display: none;
  font-weight: 500;
  line-height: 1.3;
}

.field-error.visible {
  display: block;
}

.btn-submit {
  background: #C4572A;
  color: white;
  border: none;
  padding: 14px 32px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  width: 100%;
  margin-top: 8px;
  transition: background 0.2s, transform 0.1s;
}

.btn-submit:hover {
  background: #a84524;
  transform: translateY(-1px);
}

.btn-submit:active {
  transform: translateY(0);
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.form-error {
  background: #fdf0ec;
  border: 1px solid #e8b4a0;
  border-radius: 8px;
  padding: 12px 16px;
  color: #8c3518;
  font-size: 0.9rem;
  margin-top: 14px;
  display: none;
}

.form-error.visible {
  display: block;
}

/* ── Confirmation ─────────────────────────────────────────────────────────── */

.confirmation {
  text-align: center;
  max-width: 520px;
  margin: 0 auto;
}

.confirmation-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  display: block;
}

.confirmation h2 {
  font-size: 1.8rem;
  margin-bottom: 8px;
  color: #2C5530;
}

.confirmation-subtitle {
  color: #6b5a4e;
  margin-bottom: 24px;
  font-size: 0.95rem;
}

.confirm-code-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #8a7560;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.confirm-code {
  font-size: 2.2rem;
  font-weight: 700;
  color: #2C5530;
  letter-spacing: 6px;
  padding: 18px 28px;
  background: #f0f7f0;
  border-radius: 12px;
  margin: 0 auto 24px;
  display: inline-block;
  border: 2px solid #c6e0c8;
  font-family: 'Courier New', monospace;
}

.confirmation-details {
  background: white;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(74, 55, 40, 0.08);
  text-align: left;
}

.confirmation-email-note {
  color: #6b5a4e;
  font-size: 0.9rem;
  margin-bottom: 24px;
  padding: 12px 16px;
  background: #faf6f0;
  border-radius: 8px;
  border: 1px solid #e8d9c0;
}

.btn-new-booking {
  background: #8B6914;
  color: white;
  border: none;
  padding: 13px 32px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  display: inline-block;
}

.btn-new-booking:hover {
  background: #6d5010;
}

/* ── Cancel ───────────────────────────────────────────────────────────────── */

.cancel-wrapper {
  max-width: 480px;
  margin: 0 auto;
}

.cancel-card {
  background: white;
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 2px 8px rgba(74, 55, 40, 0.08);
}

.cancel-card h2 {
  margin-bottom: 16px;
  color: #4a3728;
}

.cancel-warning {
  background: #fff8e7;
  border: 1px solid #e8c96a;
  border-radius: 8px;
  padding: 12px 16px;
  color: #7a5c10;
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.btn-cancel-confirm {
  background: #C4572A;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
  margin-top: 8px;
}

.btn-cancel-confirm:hover {
  background: #a84524;
}

.cancel-success {
  text-align: center;
  padding: 20px 0;
}

.cancel-success-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 12px;
}

/* ── Loading & Error States ───────────────────────────────────────────────── */

.loading-state {
  text-align: center;
  padding: 60px 20px;
  color: #8a7560;
}

.loading-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 3px solid #e8d9c0;
  border-top-color: #8B6914;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

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

.error-state {
  text-align: center;
  padding: 60px 20px;
  color: #8c3518;
}

.error-state p {
  margin-bottom: 16px;
}

.btn-retry {
  background: #C4572A;
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-retry:hover {
  background: #a84524;
}

/* ── Divider ──────────────────────────────────────────────────────────────── */

.divider {
  border: none;
  border-top: 2px solid #e8d9c0;
  margin: 28px 0;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 680px) {
  .header {
    padding: 12px 16px;
  }

  .header-brand h1 {
    font-size: 1.1rem;
  }

  .container {
    padding: 16px 14px 40px;
  }

  /* Stack calendar months vertically on mobile */
  .calendar-wrapper {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* Spaces grid: single column */
  .spaces-grid {
    grid-template-columns: 1fr;
  }

  .datepicker-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-title {
    font-size: 1.3rem;
  }

  .confirm-code {
    font-size: 1.5rem;
    letter-spacing: 4px;
    padding: 14px 20px;
  }

  .booking-form {
    padding: 18px;
  }

  .cancel-card {
    padding: 18px;
  }
}

@media (max-width: 420px) {
  .slot-pill {
    padding: 8px 14px;
    font-size: 0.84rem;
  }

  .lang-btn {
    padding: 3px 7px;
    font-size: 0.75rem;
  }
}
