/*
  Discover Sri Lanka
  Premium editorial travel theme

  This stylesheet is shared by:
  - index.html       Interactive map
  - experiences.html Travel experiences cart
  - visa.html        Passport and visa guide
*/

/* ==========================================================
   1. Design tokens
========================================================== */

:root {
  --primary: #174c43;
  --primary-2: #2f6f62;
  --primary-dark: #0f332e;

  --accent: #c9a24a;
  --accent-soft: #efe2bf;
  --danger: #9c2f2f;

  --bg: #f6f1e8;
  --surface: #fffaf2;
  --surface-2: #f0e7d8;
  --surface-3: #eadcc4;

  --text: #1d2622;
  --muted: #68756f;
  --border: #dfd0b8;

  --shadow: 0 24px 70px rgba(36, 31, 22, 0.18);
  --shadow-soft: 0 12px 32px rgba(36, 31, 22, 0.10);

  --radius: 20px;
  --radius-lg: 32px;
  --topbar-height: 78px;

  --font-ui: Roboto, Arial, sans-serif;
  --font-display: Georgia, "Times New Roman", serif;
}

body.dark {
  --bg: #101412;
  --surface: #171f1b;
  --surface-2: #202b26;
  --surface-3: #293730;
  --text: #f6f1e8;
  --muted: #c0c9c3;
  --border: #3d4b43;

  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 12px 32px rgba(0, 0, 0, 0.28);
}

/* ==========================================================
   2. Base elements
========================================================== */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-ui);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(201, 162, 74, 0.16), transparent 34rem),
    linear-gradient(180deg, #fbf7ef, var(--bg));
}

body.dark {
  background:
    radial-gradient(circle at top left, rgba(201, 162, 74, 0.12), transparent 34rem),
    linear-gradient(180deg, #101412, var(--bg));
}

body.large-text {
  font-size: 112%;
}

body.reduced-motion *,
body.reduced-motion *::before,
body.reduced-motion *::after {
  animation: none !important;
  transition: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

/* ==========================================================
   3. Header and navigation
========================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;

  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 20px;

  padding: 14px 26px;
  color: #fffaf2;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border-bottom: 1px solid rgba(201, 162, 74, 0.28);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.brand {
  min-width: 255px;
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand .material-icons {
  color: var(--accent);
  font-size: 35px;
}

.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  line-height: 1.1;
}

.brand p {
  margin: 2px 0 0;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.82;
}

.page-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-link {
  padding: 10px 15px;
  color: #fffaf2;
  text-decoration: none;
  font-weight: 700;
  border: 1px solid rgba(239, 226, 191, 0.34);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.08);
  backdrop-filter: blur(8px);
}

.nav-link:hover {
  background: rgba(255, 250, 242, 0.16);
  border-color: rgba(201, 162, 74, 0.75);
}

/* ==========================================================
   4. Shared controls
========================================================== */

.top-search {
  flex: 1;
  max-width: 760px;
  display: flex;
  align-items: center;
  gap: 10px;

  padding: 9px 15px;
  border: 1px solid rgba(239, 226, 191, 0.28);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.14);
}

.top-search input {
  flex: 1;
  color: #fffaf2;
  border: 0;
  outline: 0;
  background: transparent;
}

.top-search input::placeholder {
  color: rgba(255, 250, 242, 0.72);
}

.top-search.light {
  max-width: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
}

.top-search.light input {
  color: var(--text);
}

.top-search.light input::placeholder {
  color: var(--muted);
}

.icon-button,
.tool-button,
.cart-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;

  color: var(--primary-dark);
  cursor: pointer;
  border: 1px solid rgba(201, 162, 74, 0.34);
  border-radius: 999px;
  background: linear-gradient(180deg, #fffaf2, #eadcc4);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.cart-button {
  position: relative;
  width: 52px;
}

.cart-button strong {
  position: absolute;
  top: -6px;
  right: -5px;

  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;

  color: #1d2622;
  font-size: 0.72rem;
  border-radius: 999px;
  background: var(--accent);
}

.button {
  width: 100%;
  padding: 13px 18px;

  cursor: pointer;
  border: 0;
  border-radius: 999px;

  font-weight: 800;
  letter-spacing: 0.01em;
  text-align: center;
}

.button.primary {
  color: #fffaf2;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-2));
  box-shadow: 0 10px 22px rgba(23, 76, 67, 0.22);
}

.button.secondary {
  color: var(--primary-dark);
  background: var(--surface);
  border: 1px solid var(--border);
}

.button:hover,
.chip:hover,
.nav-link:hover {
  transform: translateY(-1px);
  filter: brightness(1.02);
}

.select,
.passport-input {
  width: 100%;
  padding: 12px 13px;

  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface);
}

/* ==========================================================
   5. Shared layout components
========================================================== */

.panel,
.hero-card {
  padding: 20px;

  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 250, 242, 0.88);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
}

body.dark .panel,
body.dark .hero-card {
  background: rgba(23, 31, 27, 0.90);
}

.hero-card {
  color: #fffaf2;
  border-color: rgba(201, 162, 74, 0.38);
  background:
    linear-gradient(135deg, rgba(15, 51, 46, 0.94), rgba(47, 111, 98, 0.82)),
    url("https://images.unsplash.com/photo-1586610124297-6817c67bc53a?auto=format&fit=crop&w=900&q=80") center / cover;
}

.hero-card h2 {
  margin: 8px 0 10px;
  font-family: var(--font-display);
  font-size: 2rem;
}

.hero-card p {
  margin: 0;
  line-height: 1.58;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
  font-size: 0.92rem;
}

.badge {
  display: inline-flex;
  padding: 5px 11px;

  color: var(--primary-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;

  border-radius: 999px;
  background: var(--accent-soft);
}

/* ==========================================================
   6. Chips, lists and cards
========================================================== */

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 8px 13px;

  color: var(--text);
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.chip.active {
  color: #fffaf2;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: var(--primary);
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;

  margin: 10px 0;
  color: var(--text);
}

.stats-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  text-align: center;
}

.stats-panel div,
.fact-grid div,
.modal-facts div {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
}

.stats-panel strong,
.stats-panel span {
  display: block;
}

.stats-panel strong {
  color: var(--primary-dark);
  font-family: var(--font-display);
  font-size: 1.28rem;
}

body.dark .stats-panel strong {
  color: var(--accent-soft);
}

.stats-panel span {
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.fact-grid,
.modal-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;

  margin: 16px 0;
}

.fact-grid strong,
.fact-grid span,
.modal-facts strong,
.modal-facts span {
  display: block;
}

.fact-grid span,
.modal-facts span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

/* ==========================================================
   7. Saved places, itinerary and gallery
========================================================== */

.selected-panel img {
  width: 100%;
  height: 178px;
  object-fit: cover;

  margin-bottom: 12px;
  border-radius: 22px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
}

.saved-list {
  display: grid;
  gap: 8px;
}

.saved-list.empty {
  color: var(--muted);
  font-size: 0.92rem;
}

.saved-item {
  position: relative;
  padding: 11px;

  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.saved-item span {
  display: block;
  margin-top: 3px;

  color: var(--muted);
  font-size: 0.84rem;
}

.saved-item button {
  position: absolute;
  top: 8px;
  right: 8px;

  color: var(--muted);
  cursor: pointer;
  border: 0;
  background: transparent;
}

.saved-clear {
  margin-top: 12px;
}

.itinerary-controls,
.itinerary-output,
.featured-cards,
.saved-list {
  display: grid;
  gap: 10px;
}

.itinerary-controls label {
  display: grid;
  gap: 6px;

  color: var(--muted);
  font-size: 0.9rem;
}

.itinerary-output {
  margin-top: 12px;
}

.itinerary-output.empty {
  color: var(--muted);
  font-size: 0.9rem;
}

.day-card {
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
}

.day-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--primary-dark);
}

.day-card ul {
  margin: 0;
  padding-left: 18px;
}

.route-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;

  margin: 8px 0 10px;
}

.route-meta span,
.preference-pill {
  padding: 6px 8px;

  color: var(--muted);
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
}

.preference-pill {
  display: inline-block;
  margin-top: 8px;
}

.featured-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  align-items: center;

  padding: 8px;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
}

.featured-card img {
  width: 72px;
  height: 62px;
  object-fit: cover;
  border-radius: 14px;
}

.featured-card h4 {
  margin: 0 0 4px;
  color: var(--primary-dark);
}

.featured-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

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

.gallery-tile {
  position: relative;
  min-height: 98px;
  overflow: hidden;

  cursor: pointer;
  border-radius: 18px;
  background: #ddd;
  box-shadow: var(--shadow-soft);
}

.gallery-tile img {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-tile span {
  position: absolute;
  right: 8px;
  bottom: 8px;
  left: 8px;

  overflow: hidden;
  padding: 6px 9px;

  color: #fffaf2;
  font-size: 0.76rem;
  white-space: nowrap;
  text-overflow: ellipsis;

  border-radius: 999px;
  background: rgba(15, 51, 46, 0.72);
}

/* ==========================================================
   8. Modals and notifications
========================================================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 2500;

  display: grid;
  place-items: center;
  padding: 20px;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;

  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  z-index: 1;

  width: min(760px, 100%);
  max-height: 90vh;
  overflow: auto;

  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal-card > img {
  width: 100%;
  height: 280px;
  object-fit: cover;
}

.modal-body {
  padding: 24px;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;

  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;

  color: var(--text);
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 3000;

  padding: 13px 18px;
  color: #fffaf2;
  border: 1px solid rgba(201, 162, 74, 0.28);
  border-radius: 16px;
  background: var(--primary-dark);
  box-shadow: var(--shadow);
}

/* ==========================================================
   9. Utilities
========================================================== */

.keyboard-panel p {
  display: flex;
  align-items: center;
  gap: 8px;

  margin: 8px 0;
  color: var(--muted);
}

kbd {
  min-width: 28px;
  display: inline-grid;
  place-items: center;

  padding: 4px 7px;
  color: var(--text);
  font-weight: 700;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

/* ==========================================================
   10. Touch and mobile adaptation
========================================================== */

.has-touch button,
.has-touch .button,
.has-touch .chip,
.has-touch .nav-link,
.has-touch .tool-button,
.has-touch .icon-button,
.has-touch .cart-button,
.has-touch input,
.has-touch select,
.has-touch textarea {
  min-height: 44px;
}

.is-mobile body {
  overflow-x: hidden;
}

.is-mobile .topbar {
  min-height: auto;
  padding: 10px 12px;
  gap: 10px;
}

.is-mobile .brand {
  width: 100%;
  min-width: 0;
}

.is-mobile .brand .material-icons {
  font-size: 30px;
}

.is-mobile .brand h1 {
  font-size: 1.16rem;
}

.is-mobile .brand p {
  font-size: 0.72rem;
}

.is-mobile .page-nav {
  width: 100%;
  margin-left: 0;
  overflow-x: auto;
  flex-wrap: nowrap;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.is-mobile .page-nav::-webkit-scrollbar {
  display: none;
}

.is-mobile .nav-link {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 9px 12px;
}

.is-mobile .top-search {
  order: 3;
  min-width: 100%;
}

.is-mobile .panel,
.is-mobile .hero-card {
  padding: 15px;
  border-radius: 22px;
}

.is-mobile .modal {
  align-items: end;
  padding: 8px;
}

.is-mobile .modal-card {
  width: 100%;
  max-height: 92vh;
  border-radius: 24px 24px 0 0;
}

.is-mobile .modal-card > img {
  height: 210px;
}

.is-mobile .modal-actions,
.is-mobile .fact-grid,
.is-mobile .modal-facts,
.is-mobile .route-meta {
  grid-template-columns: 1fr;
}

.is-mobile .toast {
  right: 12px;
  bottom: 12px;
  left: 12px;
  text-align: center;
}

.is-mobile .button {
  padding: 13px 16px;
}

.is-mobile .select,
.is-mobile .passport-input,
.is-mobile textarea {
  font-size: 16px;
}

.is-mobile .app-layout {
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: calc(var(--vh, 1vh) * 100 - var(--topbar-height));
}

.is-mobile .map-stage {
  order: 1;
  height: calc(var(--vh, 1vh) * 58);
  min-height: 390px;
  border-bottom: 1px solid var(--border);
}

.is-mobile .sidebar {
  order: 2;
  display: grid;
  gap: 12px;
  overflow: visible;
  padding: 12px;
}

.is-mobile .map-toolbar {
  top: 12px;
  left: 12px;
  flex-direction: row;
  gap: 8px;
}

.is-mobile .tool-button {
  width: 42px;
  height: 42px;
}

.is-mobile .legend {
  display: none;
}

.is-mobile .statusbar {
  padding: 8px 10px;
  font-size: 0.76rem;
}

.is-mobile .search-results {
  top: 66px;
  right: 12px;
  left: 12px;
  width: auto;
  max-height: 280px;
}

.is-mobile .stats-panel {
  grid-template-columns: 1fr;
}

.is-mobile .gallery-grid {
  grid-template-columns: 1fr 1fr;
}

/* ==========================================================
   11. Media queries
========================================================== */

@media (max-width: 980px) {
  .topbar {
    height: auto;
    flex-wrap: wrap;
  }

  .brand {
    width: calc(100% - 64px);
    min-width: 0;
  }

  .top-search {
    order: 3;
    min-width: 100%;
  }

  .page-nav {
    order: 2;
    flex-wrap: wrap;
    margin-left: 0;
  }

  .stats-panel {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 10px 12px;
  }

  .brand h1 {
    font-size: 1.12rem;
  }

  .brand p {
    font-size: 0.72rem;
  }

  .page-nav {
    gap: 6px;
  }

  .nav-link {
    padding: 8px 10px;
    font-size: 0.85rem;
  }

  .gallery-grid,
  .stats-panel {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================
   12. Print
========================================================== */

@media print {
  .topbar,
  .map-stage,
  .chip-grid,
  .button,
  .keyboard-panel,
  .toast {
    display: none !important;
  }

  .app-layout {
    display: block !important;
    height: auto !important;
  }

  .sidebar {
    overflow: visible !important;
  }

  .panel,
  .hero-card {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
  }

  body {
    color: black;
    background: white;
  }
}


/* ==========================================================
   13. Map sidebar tabs
========================================================== */

.tabbed-sidebar {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
}

.sidebar-tabs {
  position: sticky;
  top: 0;
  align-self: start;

  max-height: calc(100vh - var(--topbar-height) - 36px);
  overflow-y: auto;
  display: grid;
  gap: 8px;
  padding-right: 2px;
  scrollbar-width: thin;
}

.sidebar-tab {
  min-height: 74px;
  display: grid;
  place-items: center;
  gap: 4px;

  padding: 8px 6px;
  color: var(--muted);
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.sidebar-tab .material-icons {
  font-size: 23px;
}

.sidebar-tab span:last-child {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.sidebar-tab.active {
  color: #fffaf2;
  border-color: rgba(201, 162, 74, 0.62);
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-2));
}

.sidebar-tab-content {
  min-width: 0;
  max-height: calc(100vh - var(--topbar-height) - 36px);
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}

.sidebar-tab-panel {
  display: none;
}

.sidebar-tab-panel.active {
  display: grid;
  gap: 14px;
  align-content: start;
}

.sidebar-tab-panel > .panel,
.sidebar-tab-panel > .hero-card {
  margin: 0;
}

/* Keep map-page sidebar manageable on tablets and mobile. */
.is-mobile .tabbed-sidebar {
  display: grid;
  grid-template-columns: 1fr;
}

.is-mobile .sidebar-tabs {
  position: sticky;
  top: 0;
  z-index: 20;

  max-height: none;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 0 8px;
}

.is-mobile .sidebar-tab {
  min-width: 88px;
  min-height: 58px;
  flex: 0 0 auto;
}

.is-mobile .sidebar-tab-content {
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

@media (max-width: 980px) {
  .tabbed-sidebar {
    grid-template-columns: 1fr;
  }

  .sidebar-tabs {
    position: sticky;
    top: 0;
    z-index: 20;

    max-height: none;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 8px;
  }

  .sidebar-tab {
    min-width: 92px;
    min-height: 60px;
    flex: 0 0 auto;
  }

  .sidebar-tab-content {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
}
