/* Clean travel UI — warm, light, modern */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #f7f5f2;
  --bg-white: #ffffff;
  --bg-warm: #faf8f5;
  --border: #e8e4df;
  --border-light: #f0ece7;
  --text: #2d2b28;
  --text-secondary: #6b6560;
  --text-light: #9a948d;
  --accent: #c8553a;
  --accent-hover: #b14a32;
  --accent-light: #fef0ec;
  --blue: #2563eb;
  --blue-light: #eff6ff;
  --green: #16a34a;
  --green-light: #f0fdf4;
  --purple: #7c3aed;
  --purple-light: #f5f3ff;
  --gold: #d97706;
  --gold-light: #fffbeb;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
  --radius: 10px;
  --radius-sm: 6px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Search */
header {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  padding: 20px 24px 16px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  position: relative;
  z-index: 20;
}

h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  letter-spacing: -0.3px;
}

h1 span { color: var(--accent); }

.form-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.form-row-2 {
  margin-top: 8px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-dest { flex: 1; min-width: 180px; }

.field-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.field-submit { align-self: flex-end; }

/* Price range grouped input */
.field-price-range { min-width: 200px; }

.price-range-inputs {
  display: flex;
  align-items: center;
  gap: 4px;
}

.price-prefix {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 14px;
}

.price-separator {
  color: var(--text-light);
  font-size: 12px;
  padding: 0 2px;
}

.price-range-inputs input[type="number"] {
  width: 75px;
}

input, select {
  font-family: inherit;
  font-size: 14px;
  background: var(--bg-white);
  color: var(--text);
  border: 1.5px solid var(--border);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

input[type="text"] { width: 100%; }
input[type="date"] { width: 150px; }
input[type="number"] { width: 80px; }
select { width: 85px; }

/* Nights control */
.nights-control {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-white);
}

.nights-btn {
  width: 34px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: var(--bg-warm);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.nights-btn:hover { background: var(--border); }

#nights-display {
  width: 36px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.stay-summary {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  min-height: 20px;
}

.stay-summary strong { color: var(--accent); font-weight: 600; }

button[type="submit"] {
  font-family: inherit;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: none;
  padding: 8px 28px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.2px;
  transition: background 0.15s, transform 0.1s;
  box-shadow: var(--shadow-sm);
}

button[type="submit"]:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
button[type="submit"]:active { transform: translateY(0); }
button[type="submit"]:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Progress */
#progress-bar {
  padding: 12px 24px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.progress-text {
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
}

.progress-track {
  height: 4px;
  background: var(--border-light);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #e8795c);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 4px;
}

/* Filters */
#filters {
  padding: 12px 24px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.filter-row {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.filter-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
}

.filter-group label {
  display: flex;
  gap: 4px;
  align-items: center;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.filter-group input[type="checkbox"] {
  width: auto;
  cursor: pointer;
  accent-color: var(--accent);
}

.filter-group input[type="range"] {
  width: 120px;
  padding: 0;
  accent-color: var(--accent);
}

.filter-group input[type="text"] {
  width: 200px;
  font-size: 13px;
  padding: 6px 10px;
}

.filter-group select {
  font-size: 13px;
  padding: 4px 8px;
  width: auto;
}

.filter-price-input {
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 1px;
}

#filter-price-val {
  width: 65px;
  padding: 3px 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--border);
  background: var(--bg-white);
  border-radius: var(--radius-sm);
}

/* Stats */
#stats {
  padding: 10px 24px;
  color: var(--text-secondary);
  font-size: 13px;
  background: var(--bg-warm);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#stats b { color: var(--text); font-weight: 600; }

/* Main layout */
#main-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#results-wrap {
  flex: 1;
  overflow: auto;
  min-width: 0;
}

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

th {
  background: var(--bg-warm);
  color: var(--text-light);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  cursor: pointer;
  user-select: none;
}

th:hover { color: var(--text); }

th.sort-asc::after { content: ' \25b2'; color: var(--accent); font-size: 9px; }
th.sort-desc::after { content: ' \25bc'; color: var(--accent); font-size: 9px; }

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  font-size: 13px;
}

td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
td.center { text-align: center; }

tr { background: var(--bg-white); transition: background 0.1s; }
tr:hover td { background: var(--bg-warm); }

tr.highlight-row {
  border-left: 3px solid var(--accent);
}

tr.selected-row td {
  background: var(--accent-light);
}

.clickable-hotel {
  color: var(--blue);
  font-weight: 500;
}

.clickable-hotel:hover {
  text-decoration: underline;
}

tr.hotel-separator td {
  background: var(--bg);
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

/* Tags */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.tag-suite { background: var(--gold-light); color: var(--gold); }
.tag-premium { background: var(--purple-light); color: var(--purple); }
.tag-view { background: var(--green-light); color: var(--green); }
.tag-unique { background: var(--blue-light); color: var(--blue); }
.tag-standard { background: var(--bg); color: var(--text-light); }

/* Detail panel */
#detail-panel {
  width: 440px;
  flex-shrink: 0;
  background: var(--bg-white);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  position: relative;
  padding: 0;
  box-shadow: -4px 0 16px rgba(0,0,0,0.05);
}

#detail-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 28px;
  height: 28px;
  font-size: 18px;
  color: var(--text-light);
  cursor: pointer;
  z-index: 5;
  line-height: 28px;
  text-align: center;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
}

#detail-close:hover { background: var(--bg); color: var(--text); }

#detail-content {
  padding: 20px;
}

.detail-header {
  display: flex;
  gap: 14px;
  margin-bottom: 20px;
}

.detail-photo {
  width: 130px;
  height: 100px;
  object-fit: cover;
  border-radius: var(--radius);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

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

.detail-info h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.3;
  word-wrap: break-word;
  white-space: normal;
}

.detail-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.detail-stars {
  color: var(--gold);
  font-size: 14px;
  letter-spacing: 1px;
}

.review-badge {
  background: var(--blue);
  color: #fff;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
}

.review-word {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}

.review-count {
  color: var(--text-light);
  font-size: 11px;
}

.detail-location {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 8px;
  white-space: normal;
}

.detail-booking-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 0;
}

#detail-content h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.detail-rooms {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-room-card {
  background: var(--bg-warm);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius);
  padding: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.detail-room-card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.detail-room-card.detail-room-selected {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: var(--shadow-sm);
}

.detail-room-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.detail-room-name {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
  white-space: normal;
  line-height: 1.3;
}

.detail-room-price {
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  flex-shrink: 0;
}

.detail-room-tags {
  margin-bottom: 8px;
}

.detail-room-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.detail-room-meta span {
  white-space: nowrap;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  padding: 2px 8px;
  border-radius: 20px;
}

.detail-room-desc {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
  white-space: normal;
  margin-bottom: 6px;
}

.detail-room-meal {
  color: var(--text-light);
  font-size: 12px;
  white-space: normal;
  font-style: italic;
}

/* View toggle */
#view-toggle {
  display: flex;
  gap: 0;
  padding: 8px 24px;
  background: var(--bg-warm);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.view-btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 20px;
  border: 1.5px solid var(--border);
  background: var(--bg-white);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.view-btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.view-btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: none; }

.view-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.view-btn:hover:not(.active) { background: var(--bg); }

/* Map */
#map-container {
  flex: 1;
  min-height: 0;
}

#map {
  width: 100%;
  height: calc(100vh - 260px);
  min-height: 400px;
}

.map-marker { background: none !important; border: none !important; pointer-events: auto !important; }

.leaflet-marker-icon { pointer-events: auto !important; }

.map-pin {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 6px;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  text-align: center;
  line-height: 1.3;
  cursor: pointer;
  pointer-events: auto !important;
  -webkit-tap-highlight-color: rgba(0,0,0,0.1);
}

.map-popup {
  font-family: 'Inter', sans-serif;
}

.map-popup-name {
  font-size: 14px;
  font-weight: 700;
  color: #2d2b28;
  margin-bottom: 2px;
}

.map-popup-meta {
  font-size: 12px;
  color: #6b6560;
  margin-bottom: 8px;
}

.map-room-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 0;
  font-size: 12px;
  border-bottom: 1px solid #f0ece7;
}

.map-room-price {
  font-weight: 600;
  color: #c8553a;
  white-space: nowrap;
}

.map-room-clickable {
  cursor: pointer;
  border-radius: 4px;
  padding: 3px 4px;
  margin: 0 -4px;
}

.map-room-clickable:hover {
  background: #f5f3f0;
}

.map-more {
  font-size: 11px;
  color: #9a948d;
  padding-top: 4px;
  text-align: center;
}

.map-popup-link {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid #e8e4df;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: #2563eb;
  cursor: pointer;
}

.map-popup-link:hover { text-decoration: underline; }

.hidden { display: none !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* Desktop/mobile visibility */
.mobile-only { display: none; }
.desktop-only { display: table; }

/* Mobile card styles (always defined, shown via media query) */
.room-card {
  background: var(--bg-white);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.room-card:active { border-color: var(--accent); }

.room-card-highlight {
  border-left: 3px solid var(--accent);
}

.room-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}

.room-card-hotel {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  line-height: 1.3;
}

.room-card-price {
  font-weight: 700;
  font-size: 18px;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.room-card-per {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-light);
}

.room-card-room {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
}

.room-card-details {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-light);
}

.room-card-details span {
  white-space: nowrap;
}

.room-card-good {
  color: var(--green);
  font-weight: 500;
}

.room-card-tags {
  margin-bottom: 4px;
}

.room-card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.room-card-total {
  font-size: 12px;
  color: var(--text-light);
}

.room-card-book {
  font-size: 12px;
  font-weight: 600;
  color: var(--blue);
}

#mobile-sort {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-warm);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 5;
}

#mobile-sort select {
  font-size: 13px;
  padding: 6px 10px;
  flex: 1;
}

/* Mobile */
@media (max-width: 768px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: block; }
  #mobile-sort { display: flex; }

  body { height: auto; min-height: 100vh; }

  header { padding: 14px 16px; }
  h1 { font-size: 18px; margin-bottom: 10px; }

  /* Force all form rows to be vertical on mobile */
  .form-row,
  .form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 0;
  }

  .form-row-2 { margin-top: 10px; }

  /* Destination spans full width */
  .field-dest { grid-column: 1 / -1; }

  /* Price range spans full width */
  .field-price-range { grid-column: 1 / -1; }

  /* Submit button spans full width */
  .field-submit { grid-column: 1 / -1; }

  /* Reset field widths for mobile */
  .field input[type="text"],
  .field input[type="date"] {
    width: 100%;
  }

  .field input[type="number"] {
    width: 100%;
  }

  .field select {
    width: 100%;
  }

  .price-range-inputs input[type="number"] {
    flex: 1;
    min-width: 50px;
    width: auto;
  }

  button[type="submit"] {
    width: 100%;
    padding: 14px;
    font-size: 16px;
  }

  .stay-summary {
    font-size: 13px;
    margin-top: 8px;
  }

  /* Filters — stack vertically */
  #filters { padding: 10px 16px; }

  .filter-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  .filter-group {
    flex-wrap: wrap;
    width: 100%;
  }

  .filter-group input[type="range"] { flex: 1; min-width: 80px; }

  .filter-group input[type="text"] {
    width: 100%;
    font-size: 14px;
    padding: 8px 12px;
  }

  .filter-group label { font-size: 13px; }

  /* Stats */
  #stats { padding: 8px 16px; font-size: 12px; }

  /* Layout — vertical stack */
  #main-layout {
    flex-direction: column;
    overflow: visible;
    flex: none;
  }

  #results-wrap {
    flex: none;
    overflow: visible;
  }

  /* Card list */
  #results-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 16px;
  }

  /* Detail panel — full screen overlay */
  #detail-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    z-index: 100;
    border-left: none;
    box-shadow: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--bg-white);
  }

  #detail-close {
    position: sticky;
    top: 8px;
    float: right;
    width: 40px;
    height: 40px;
    font-size: 24px;
    line-height: 40px;
    text-align: center;
    background: var(--bg-white);
    border-radius: 50%;
    box-shadow: var(--shadow-md);
    z-index: 101;
    margin: 8px;
  }

  #detail-content {
    padding: 16px;
    padding-top: 0;
    clear: both;
  }

  .detail-header {
    flex-direction: column;
    gap: 12px;
  }

  .detail-photo {
    width: 100%;
    height: 200px;
    border-radius: var(--radius);
  }

  .detail-info h2 { font-size: 18px; }

  .detail-room-card { padding: 12px; }

  .detail-room-header {
    flex-direction: column;
    gap: 4px;
  }

  .detail-room-name { font-size: 14px; }

  .detail-room-price { font-size: 16px; }

  .detail-room-meta { gap: 4px; }

  .detail-room-meta span {
    font-size: 11px;
    padding: 3px 8px;
  }

  .detail-booking-link {
    display: block;
    text-align: center;
    background: var(--blue);
    color: #fff;
    padding: 10px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-top: 4px;
  }

  .detail-booking-link:hover {
    text-decoration: none;
    opacity: 0.9;
  }

  /* Map mobile */
  #view-toggle { padding: 8px 16px; }

  #map { height: calc(100vh - 280px); min-height: 300px; }
}
