@import url('https://fonts.googleapis.com/css2?family=PT+Serif:ital,wght@0,400;0,700;1,400;1,700&display=swap');

:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1c2128;
  --muted: #667085;
  --navy: #1a2540;
  --navy-dark: #101728;
  --accent: var(--navy);
  --border: #e0e3e9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "PT Serif", Georgia, "Times New Roman", serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

.page-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px;
}

/* ─── Site Header ──────────────────────────────────── */
.site-header {
  background: var(--navy);
  border-bottom: 1px solid var(--navy-dark);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-brand h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.header-brand p {
  margin: 2px 0 0;
  color: #c3cadb;
  font-size: 0.85rem;
}

/* ─── Filter Bar ─────────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  background: #f8f9fb;
  border: 1px solid var(--border);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 140px;
  min-width: 120px;
}

.filter-group label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.filter-group input,
.filter-group select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  font: inherit;
  font-size: 0.9rem;
  background: #fff;
  transition: border-color 0.2s;
}

.filter-group input:focus,
.filter-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(26, 37, 64, 0.15);
}

.filter-group-search {
  flex: 2 1 220px;
}

.filter-group-btn {
  flex: 0 1 auto;
  min-width: unset;
}

.filter-group-btn button {
  padding: 8px 20px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.filter-group-btn button:hover {
  background: var(--navy-dark);
}

/* ─── Loading Spinner ────────────────────────────────── */
.loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  color: var(--muted);
  gap: 16px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}

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

/* ─── Error Message ──────────────────────────────────── */
.error-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 24px;
  text-align: center;
  background: #f5eaea;
  border: 1px solid #e2c9c9;
  color: #8a3232;
  margin-bottom: 16px;
}

.error-message p {
  margin: 0;
  font-size: 0.95rem;
}

.retry-btn {
  padding: 8px 20px;
  border: 1px solid var(--text);
  background: var(--text);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.retry-btn:hover {
  opacity: 0.85;
}

/* ─── Results Grid ───────────────────────────────────── */
.results-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

/* ─── Hotel Cards ────────────────────────────────────── */
.hotel-card {
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--card);
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s;
}

.hotel-card:hover {
  border-color: var(--accent);
}

/* ─── Hotel Image ───────────────────────────────────── */
.hotel-image-wrapper {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
  background: #e2e8f0;
}

.hotel-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hotel-card h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 700;
}

.hotel-card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hotel-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  color: #94a3b8;
}

.placeholder-icon {
  display: block;
  width: 48px;
  height: 48px;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  position: relative;
}

.placeholder-icon::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 10px;
  background: #cbd5e1;
  border-radius: 3px 3px 0 0;
}

.placeholder-icon::after {
  content: "";
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 14px;
  background: #cbd5e1;
  border-radius: 2px;
}

.hotel-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.meta-rating {
  color: #d97706;
  font-weight: 600;
}

.meta-price {
  font-weight: 700;
  color: var(--accent);
}

.detail-icon {
  flex-shrink: 0;
  font-weight: 700;
  color: var(--muted);
}

.modal-addr-icon {
  font-weight: 700;
  color: var(--muted);
}

.view-details-btn {
  display: block;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--navy);
  background: var(--navy);
  color: #ffffff;
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.view-details-btn:hover {
  background: var(--navy-dark);
  border-color: var(--navy-dark);
}

.hotel-details {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 0.9rem;
}

.detail-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

/* Shared room-row styling, used inside the detail modal's room list */
.room-type {
  font-weight: 600;
  color: var(--text);
}

.room-price {
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.room-features {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

/* ─── Favorites ─────────────────────────────────────── */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.favorites-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid #3a4867;
  background: transparent;
  color: #ffffff;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.favorites-toggle-btn:hover {
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.fav-count {
  font-size: 0.75rem;
  font-weight: 700;
  background: #2c3a5c;
  color: #ffffff;
  padding: 1px 7px;
  min-width: 20px;
  text-align: center;
}

.favorites-toggle-btn.active {
  border-color: #ffffff;
  color: var(--navy);
  background: #ffffff;
}

.favorites-toggle-btn.active .fav-count {
  background: var(--navy);
  color: #fff;
}

.fav-btn {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  background: var(--card);
  border: 1px solid var(--border);
  width: 36px;
  height: 36px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
  color: var(--muted);
}

.fav-btn:hover {
  border-color: var(--accent);
}

.fav-btn.favorited {
  color: var(--accent);
  border-color: var(--accent);
}

.filter-group-actions {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.filter-group-actions .clear-filters-btn {
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-group-actions .clear-filters-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── Empty State ───────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  background: #fbfdff;
}

.empty-icon {
  font-size: 3rem;
  opacity: 0.5;
}

/* ─── Detail Modal ──────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--card);
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  border: 1px solid var(--border);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: border-color 0.15s;
}

.modal-close:hover {
  border-color: var(--accent);
}

.modal-body {
  padding: 0;
}

.modal-image {
  width: 100%;
  height: 300px;
  object-fit: cover;
  display: block;
}

.modal-info {
  padding: 24px;
}

.modal-info h2 {
  margin: 0 0 4px;
  font-size: 1.5rem;
  font-weight: 700;
}

.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.modal-address {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  color: var(--muted);
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.modal-section {
  margin-bottom: 20px;
}

.modal-section h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.modal-rooms-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.modal-room-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #eef2f7;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-room-item .room-type {
  font-weight: 600;
  flex: 1;
  min-width: 120px;
}

.modal-room-item .room-price {
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.modal-room-item .room-features {
  width: 100%;
  color: var(--muted);
  font-size: 0.8rem;
}

.modal-fav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}

.modal-fav-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.modal-fav-btn.favorited {
  background: #ffffff;
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── Toast Notifications ───────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 12px 20px;
  background: var(--text);
  color: #fff;
  font-size: 0.85rem;
  animation: toastIn 0.2s ease, toastOut 0.2s ease 2.5s forwards;
  display: flex;
  align-items: center;
  gap: 8px;
}

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* ─── Responsive ─────────────────────────────────────── */
@media (max-width: 768px) {
  .page-shell {
    padding: 16px;
  }

  .header-inner {
    padding: 16px;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .header-actions {
    justify-content: center;
  }

  .filter-bar {
    flex-direction: column;
  }

  .filter-group {
    flex: 1 1 auto;
    min-width: unset;
  }

  .results-list {
    grid-template-columns: 1fr;
  }

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

  .hotel-image-wrapper,
  .hotel-image {
    height: 160px;
  }

  .modal-room-item {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ─── Favorites Popup ──────────────────────────────── */
.fav-popup-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fav-popup-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #eef2f7;
  gap: 12px;
}

.fav-popup-info {
  flex: 1;
  min-width: 0;
}

.fav-popup-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.fav-popup-meta {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 2px;
}

.fav-popup-remove {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b91c1c;
  flex-shrink: 0;
  transition: border-color 0.15s;
}

.fav-popup-remove:hover {
  border-color: #b91c1c;
}

@media (max-width: 480px) {
  .page-shell {
    padding: 12px;
  }

  .header-inner {
    padding: 14px 16px;
  }

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

  .card {
    padding: 16px;
  }

  .hotel-card-body {
    padding: 12px;
  }
}