/* ============================================================
   HotelFinder - Modern UI Stylesheet
   ============================================================ */

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:       #1a73e8;
  --primary-dark:  #1557b0;
  --primary-light: #e8f0fe;
  --accent:        #fbbc04;
  --success:       #34a853;
  --warning:       #fbbc04;
  --danger:        #ea4335;
  --bg:            #f8f9fa;
  --surface:       #ffffff;
  --border:        #e0e0e0;
  --text:          #202124;
  --text-muted:    #5f6368;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --shadow-md:     0 4px 12px rgba(0,0,0,.12);
  --shadow-lg:     0 8px 28px rgba(0,0,0,.16);
  --radius:        12px;
  --radius-sm:     8px;
  --radius-lg:     20px;
  --transition:    .2s cubic-bezier(.4,0,.2,1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Google Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }

/* ── Typography ───────────────────────────────────────────── */
h1 { font-size: 2rem;   font-weight: 700; }
h2 { font-size: 1.5rem; font-weight: 600; }
h3 { font-size: 1.2rem; font-weight: 600; }
h4 { font-size: 1rem;   font-weight: 600; }

/* ── Layout ───────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.page-wrap  { min-height: 100vh; display: flex; flex-direction: column; }

/* ── Navbar ───────────────────────────────────────────────── */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 1000;
  box-shadow: var(--shadow-sm);
}
.navbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; padding: 0 24px;
}
.navbar-brand {
  display: flex; align-items: center; gap: 8px;
  font-size: 1.3rem; font-weight: 700; color: var(--primary);
  text-decoration: none;
}
.navbar-brand svg { width: 28px; height: 28px; }
.navbar-links { display: flex; gap: 8px; align-items: center; }
.navbar-links a {
  padding: 6px 14px; border-radius: 20px;
  color: var(--text-muted); font-size: .9rem; font-weight: 500;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}
.navbar-links a:hover,
.navbar-links a.active { background: var(--primary-light); color: var(--primary); }

/* ── Hero / Search Bar ───────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 60%, #1565c0 100%);
  padding: 56px 24px 72px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url('https://images.unsplash.com/photo-1542314831-068cd1dbfeeb?w=1600&q=60') center/cover;
  opacity: .18;
}
.hero-content { position: relative; z-index: 1; }
.hero h1 { color: #fff; font-size: 2.6rem; margin-bottom: 12px; text-shadow: 0 2px 8px rgba(0,0,0,.3); }
.hero p  { color: rgba(255,255,255,.88); font-size: 1.1rem; margin-bottom: 32px; }

.search-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 0;
  max-width: 780px; margin: 0 auto;
  overflow: hidden;
}
.search-field {
  flex: 1; display: flex; align-items: center; gap: 10px;
  padding: 14px 20px;
  border-right: 1px solid var(--border);
}
.search-field:last-of-type { border-right: none; }
.search-field input, .search-field select {
  border: none; outline: none; background: transparent;
  font-size: 1rem; color: var(--text); width: 100%; font-family: inherit;
}
.search-field label { font-size: .75rem; color: var(--text-muted); white-space: nowrap; }
.search-field .icon { color: var(--primary); flex-shrink: 0; }
.search-btn {
  background: var(--primary); color: #fff;
  border: none; padding: 0 28px; height: 100%; min-height: 56px;
  font-size: 1rem; font-weight: 600; white-space: nowrap;
  transition: background var(--transition);
}
.search-btn:hover { background: var(--primary-dark); }

/* ── View Toggle ─────────────────────────────────────────── */
.view-toggle-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0; gap: 12px; flex-wrap: wrap;
}
.view-toggle {
  display: flex; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden;
}
.view-toggle button {
  border: none; background: transparent; padding: 8px 18px;
  font-size: .9rem; font-weight: 500; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
  transition: background var(--transition), color var(--transition);
}
.view-toggle button.active { background: var(--primary); color: #fff; }
.results-count { color: var(--text-muted); font-size: .92rem; }

/* ── Filter Strip ─────────────────────────────────────────── */
.filter-strip {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 12px 0;
}
.filter-chip {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 20px; padding: 6px 14px; font-size: .85rem; color: var(--text-muted);
  cursor: pointer; transition: all var(--transition);
  display: flex; align-items: center; gap: 6px;
}
.filter-chip:hover, .filter-chip.active {
  border-color: var(--primary); color: var(--primary);
  background: var(--primary-light);
}
.filter-chip input[type=range] { width: 90px; accent-color: var(--primary); }
.filter-chip select {
  border: none; background: transparent; outline: none;
  color: inherit; font-size: .85rem; font-family: inherit;
}

/* ── Hotel Card ───────────────────────────────────────────── */
#hotels-list { display: flex; flex-direction: column; gap: 16px; }

.hotel-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: flex; overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
  border: 1px solid var(--border);
}
.hotel-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.hotel-card .card-image {
  width: 237px; height: 192px; flex-shrink: 0; position: relative;
  overflow: hidden;
}
.hotel-card .card-image img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .4s ease;
}
.hotel-card:hover .card-image img { transform: scale(1.05); }

.card-badges {
  position: absolute; top: 10px; left: 10px;
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
}
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px; font-size: .72rem; font-weight: 600;
  letter-spacing: .3px;
}
.badge-deal     { background: #e8f5e9; color: #2e7d32; }
.badge-top      { background: #fff8e1; color: #f57f17; }

.hotel-card .card-body {
  flex: 1; padding: 18px 20px; display: flex; flex-direction: column; gap: 6px;
}
.card-body .hotel-name { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.card-body .hotel-city { color: var(--text-muted); font-size: .88rem; display: flex; align-items: center; gap: 4px; }
.card-body .hotel-desc { color: var(--text-muted); font-size: .88rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-amenities { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.amenity-tag { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 2px 8px; font-size: .75rem; color: var(--text-muted); }

.hotel-card .card-right {
  padding: 18px 20px; display: flex; flex-direction: column;
  align-items: flex-end; justify-content: space-between; min-width: 160px;
}
.price-block .price-label { font-size: .75rem; color: var(--text-muted); }
.price-block .price       { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.price-block .per-night   { font-size: .75rem; color: var(--text-muted); }

.score-good    { background: var(--success); }
.score-avg     { background: var(--warning); color: #333; }
.score-bad     { background: var(--danger); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm); font-size: .9rem;
  font-weight: 600; border: none; transition: all var(--transition); cursor: pointer;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-sm { padding: 6px 14px; font-size: .82rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }

/* ── Map View ─────────────────────────────────────────────── */
#map-view { position: relative; }
#map {
  width: 100%; height: calc(100vh - 180px); min-height: 500px;
  border-radius: var(--radius); overflow: hidden;
}
/* ── Scores Display ───────────────────────────────────────── */
.scores-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.score-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; text-align: center;
}
.score-card .s-icon { font-size: 1.6rem; margin-bottom: 6px; }
.score-card .s-label { font-size: .82rem; color: var(--text-muted); margin-bottom: 8px; }
.score-bar-wrap { background: var(--bg); border-radius: 4px; height: 8px; overflow: hidden; }
.score-bar { height: 100%; border-radius: 4px; transition: width .8s ease; }
.score-bar.good  { background: var(--success); }
.score-bar.avg   { background: var(--warning); }
.score-bar.bad   { background: var(--danger); }
.score-card .s-value { font-weight: 700; font-size: 1.1rem; margin-top: 6px; }

/* ── Reviews ──────────────────────────────────────────────── */
.review-list { display: flex; flex-direction: column; gap: 14px; }
.review-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
}
.review-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.review-author { font-weight: 600; font-size: .95rem; }
.review-meta   { font-size: .8rem; color: var(--text-muted); display: flex; gap: 8px; align-items: center; }
.review-stars  { color: var(--accent); font-size: .85rem; }
.review-text   { color: var(--text-muted); font-size: .9rem; line-height: 1.7; }

.review-form {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: 6px; color: var(--text-muted); }
.form-control {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: .95rem; outline: none;
  font-family: inherit; transition: border-color var(--transition);
  background: var(--bg); color: var(--text);
}
.form-control:focus { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 3px rgba(26,115,232,.15); }
textarea.form-control { resize: vertical; min-height: 100px; }
.star-rating { display: flex; gap: 6px; flex-direction: row-reverse; justify-content: flex-end; }
.star-rating input { display: none; }
.star-rating label { font-size: 1.6rem; color: var(--border); cursor: pointer; transition: color var(--transition); }
.star-rating label:hover,
.star-rating label:hover ~ label,
.star-rating input:checked ~ label { color: var(--accent); }

/* ── Hotel Details ─────────────────────────────────────────── */
.detail-hero { position: relative; height: 420px; overflow: hidden; }
.detail-hero img { width: 100%; height: 100%; object-fit: cover; }
.detail-hero-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.7));
  padding: 40px 32px 28px;
  color: #fff;
}
.detail-hero-overlay h1 { font-size: 2rem; }
.detail-hero-overlay .city-tag { opacity: .85; font-size: .95rem; }

.detail-layout { display: grid; grid-template-columns: 1fr 360px; gap: 28px; padding: 28px 0; align-items: start; }
.detail-main   { display: flex; flex-direction: column; gap: 28px; }
.detail-sidebar { display: flex; flex-direction: column; gap: 16px; }

.sidebar-booking {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  position: sticky; top: 80px;
}
.booking-price { font-size: 2rem; font-weight: 700; margin-bottom: 4px; }
.booking-per   { color: var(--text-muted); font-size: .85rem; margin-bottom: 16px; }
.booking-sites { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.booking-link {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text); font-size: .9rem; font-weight: 500;
  transition: all var(--transition);
}
.booking-link:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); text-decoration: none; }
.booking-link .site-name { font-weight: 600; }
.booking-link .site-price { color: var(--success); font-weight: 700; }

.section-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.section-card h3 { margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }

/* ── Gallery ─────────────────────────────────────────────── */
.gallery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gallery-grid img { width: 100%; height: 130px; object-fit: cover; border-radius: 8px; cursor: pointer; transition: transform var(--transition); }
.gallery-grid img:hover { transform: scale(1.03); }

/* ── Loading Spinner ──────────────────────────────────────── */
.spinner { display: inline-block; width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: flex; align-items: center; justify-content: center;
  padding: 60px; flex-direction: column; gap: 16px;
}
.loading-overlay p { color: var(--text-muted); }

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3 { font-size: 1.2rem; color: var(--text); margin-bottom: 8px; }

/* ── Admin ────────────────────────────────────────────────── */
.admin-layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.admin-sidebar {
  background: #1a1a2e; color: #e0e0e0;
  padding: 24px 0; display: flex; flex-direction: column; gap: 4px;
}
.admin-sidebar .brand { padding: 0 20px 24px; font-size: 1.1rem; font-weight: 700; color: #fff; }
.admin-sidebar a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; color: #aaa; text-decoration: none;
  font-size: .9rem; transition: all var(--transition);
}
.admin-sidebar a:hover, .admin-sidebar a.active {
  background: rgba(255,255,255,.08); color: #fff;
}
.admin-content { padding: 32px; background: var(--bg); }
.admin-header { margin-bottom: 28px; }
.admin-header h1 { font-size: 1.6rem; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { color: var(--text-muted); font-size: .85rem; margin-top: 4px; }

.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table-card table { width: 100%; border-collapse: collapse; }
.table-card th { background: var(--bg); padding: 12px 16px; font-size: .82rem; font-weight: 600; color: var(--text-muted); text-align: left; text-transform: uppercase; letter-spacing: .5px; }
.table-card td { padding: 12px 16px; border-top: 1px solid var(--border); font-size: .9rem; }
.table-card tr:hover td { background: rgba(26,115,232,.04); }

.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: .9rem; }
.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.alert-error   { background: #ffebee; color: #c62828; border: 1px solid #ef9a9a; }
.alert-info    { background: var(--primary-light); color: var(--primary); border: 1px solid #90caf9; }

/* ── Toast notifications ──────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: #333; color: #fff; padding: 12px 20px;
  border-radius: 8px; font-size: .9rem; box-shadow: var(--shadow-md);
  animation: toastIn .3s ease;
  display: flex; align-items: center; gap: 10px; min-width: 220px;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
@keyframes toastIn { from { transform: translateY(20px); opacity: 0 } to { transform: none; opacity: 1 } }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .detail-layout { grid-template-columns: 1fr; }
  .detail-sidebar { order: -1; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .scores-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .hotel-card { flex-direction: column; }
  .hotel-card .card-image { width: 100%; height: 200px; }
  .hotel-card .card-right { flex-direction: row; align-items: center; padding: 12px 16px; min-width: unset; }
  .hero h1 { font-size: 1.8rem; }
  .search-box { flex-direction: column; border-radius: var(--radius); }
  .search-field { border-right: none; border-bottom: 1px solid var(--border); }
  .search-btn { width: 100%; border-radius: 0 0 var(--radius) var(--radius); }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { display: none; }
  .scores-grid { grid-template-columns: repeat(2, 1fr); }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Pagination ─────────────────────────────────────────────── */
.pagination-container {
  display: flex;
  justify-content: center;
  margin: 30px 0 50px;
}

.pagination {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.page-btn {
  background: white;
  border: 1px solid #e2e8f0;
  color: #1a202c;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  min-width: 40px;
}

.page-btn:hover {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
}

.page-btn.active {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.pagination-dots {
  color: #718096;
  padding: 0 5px;
  font-weight: bold;
}

/* ── AI Highlights Box ─────────────────────────────────────── */
.hotel-desc-box {
  background: #f8fafc;
  border-radius: 12px;
  padding: 10px 14px;
  border-left: 4px solid var(--primary);
  margin: 10px 0;
  font-size: 0.88rem;
  color: #475569;
  line-height: 1.5;
}

/* ── Skyscanner Image Link ──────────────────────────────────── */
.skyscanner-img-link {
  display: block;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
  text-align: center;
}

.skyscanner-img-link:hover {
  transform: scale(1.15) rotate(2deg);
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15));
}

.skyscanner-img-link img {
  width: 180px; /* Enhanced visibility */
  height: auto;
  display: block;
  margin: 0 auto;
}
