/* ================================================================
   Nepal Ultimate Trekking Map v6 — Frontend CSS
   Full viewport · Legend outside map · Premium Himalayan design
   ================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=Inter:wght@300;400;500;600&display=swap');

:root {
  --e:       #130A06;
  --bark:    #4A2210;
  --gold:    #C4861A;
  --snow:    #F9F6F0;
  --cream:   #F2EDE3;
  --fog:     #E8E1D4;
  --stone:   #8A7D6E;
  --smoke:   #C2B8A8;
  --border:  #D8CFC0;
  --sky:     #1E6DB5;
  --red:     #C0392B;
  --green:   #27794A;
  --amber:   #B06010;
  --serif:   'Playfair Display', Georgia, serif;
  --sans:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --ease:    cubic-bezier(.4,0,.2,1);
}

/* ── Reset ─────────────────────────────────────────────── */
#ntm-app, #ntm-app *, #ntm-app *::before, #ntm-app *::after {
  box-sizing: border-box; margin: 0; padding: 0;
}

/* ══════════════════════════════════════════════════════════
   APP SHELL — true fullscreen via position:fixed
   ══════════════════════════════════════════════════════════ */
#ntm-app {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--e);
  background: var(--snow);
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9990;
}
.admin-bar #ntm-app { top: 32px; }
@media (max-width: 782px) { .admin-bar #ntm-app { top: 46px; } }

/* ══════════════════════════════════════════════════════════
   HEADER
   ══════════════════════════════════════════════════════════ */
.ntm-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 13px 24px 11px;
  background: linear-gradient(135deg, #0D0503 0%, #2A0E08 52%, #130A06 100%);
  position: relative;
  overflow: hidden;
}
/* 12-region rainbow stripe */
.ntm-header::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg,
    #1D9E75 0%,  #3A7BD5 13%,  #D85A30 24%,
    #5A9E27 33%, #7F77DD 42%,  #BA7517 51%,
    #E24B4A 59%, #607D8B 68%,  #D4537E 76%,
    #0F6E56 84%, #6B3FA0 92%,  #2C2C2A 100%);
}
/* Mountain silhouette watermark */
.ntm-header::before {
  content: '';
  position: absolute; inset: 0; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 90' preserveAspectRatio='none'%3E%3Cpath d='M0,90 L0,58 L80,42 L160,52 L240,30 L320,46 L400,14 L480,34 L540,8 L600,28 L660,4 L720,24 L800,18 L880,38 L960,22 L1040,42 L1120,28 L1200,48 L1200,90Z' fill='rgba(255,255,255,0.025)'/%3E%3C/svg%3E")
  no-repeat bottom/cover;
}
.ntm-header-left { display: flex; align-items: center; gap: 13px; position: relative; }
.ntm-logo { font-size: 28px; line-height: 1; }
.ntm-title {
  font-family: var(--serif); font-size: 20px; font-weight: 700;
  color: #FFF8EE; letter-spacing: -.3px; line-height: 1.2;
  margin: 0;
}
.ntm-subtitle {
  font-size: 10px; color: rgba(255,248,238,.4);
  text-transform: uppercase; letter-spacing: .07em; margin-top: 3px;
}
.ntm-stats-row { display: flex; gap: 24px; position: relative; }
.ntm-stat-box { text-align: center; }
.ntm-stat-box strong {
  display: block; font-family: var(--serif);
  font-size: 26px; font-weight: 700;
  color: var(--gold); line-height: 1;
}
.ntm-stat-box small {
  display: block; margin-top: 2px;
  font-size: 9px; text-transform: uppercase;
  letter-spacing: .08em; color: rgba(255,248,238,.32);
}

/* ══════════════════════════════════════════════════════════
   TOOLBAR
   ══════════════════════════════════════════════════════════ */
.ntm-toolbar {
  flex-shrink: 0;
  display: flex; align-items: center; flex-wrap: nowrap;
  gap: 8px; padding: 9px 16px;
  background: var(--cream); border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.ntm-toolbar::-webkit-scrollbar { height: 0; }

.ntm-search-wrap {
  flex: 1; min-width: 140px; max-width: 260px;
  position: relative; flex-shrink: 0;
}
.ntm-search-ico {
  position: absolute; left: 9px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--stone);
  pointer-events: none;
}
#ntm-search {
  width: 100%; padding: 7px 10px 7px 30px;
  border: 1px solid #CABFB0; border-radius: 8px;
  font-family: var(--sans); font-size: 12px;
  background: #fff; color: var(--e); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
#ntm-search:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(196,134,26,.14);
}
#ntm-search::placeholder { color: var(--smoke); }

.ntm-toolbar select {
  flex-shrink: 0; padding: 7px 9px;
  border: 1px solid #CABFB0; border-radius: 8px;
  font-family: var(--sans); font-size: 12px;
  background: #fff; color: var(--e);
  cursor: pointer; outline: none; white-space: nowrap;
  transition: border-color .2s;
}
.ntm-toolbar select:focus { border-color: var(--gold); }

.ntm-permit-chk {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--stone);
  cursor: pointer; user-select: none; white-space: nowrap;
}
.ntm-permit-chk input { accent-color: var(--gold); cursor: pointer; }

.ntm-shown-count {
  flex-shrink: 0; margin-left: auto;
  font-size: 11px; color: var(--stone); white-space: nowrap;
}
#ntm-route-count { font-weight: 600; color: var(--e); }

/* ══════════════════════════════════════════════════════════
   LEGEND STRIP — full-width, OUTSIDE the map, no overlap
   ══════════════════════════════════════════════════════════ */
.ntm-legend-strip {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  height: 36px;
  background: var(--fog);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 0 0 12px;
  gap: 0;
}
.ntm-legend-strip::-webkit-scrollbar { height: 3px; }
.ntm-legend-strip::-webkit-scrollbar-thumb { background: var(--smoke); border-radius: 2px; }

.ntm-legend-prefix {
  flex-shrink: 0;
  font-size: 9px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--stone); white-space: nowrap;
  margin-right: 8px; padding-right: 10px;
  border-right: 1px solid var(--border);
}
.ntm-leg-item {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 5px;
  height: 100%; padding: 0 10px;
  border-right: 1px solid var(--border);
  cursor: pointer; white-space: nowrap;
  transition: background .15s;
  user-select: none;
}
.ntm-leg-item:first-of-type { border-left: 1px solid var(--border); }
.ntm-leg-item:hover  { background: rgba(196,134,26,.1); }
.ntm-leg-item.active { background: rgba(196,134,26,.22); }
.ntm-leg-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ntm-leg-name { font-size: 10px; color: var(--e); line-height: 1; }

/* ══════════════════════════════════════════════════════════
   BODY — map + sidebar fill all remaining height
   ══════════════════════════════════════════════════════════ */
.ntm-body {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

/* ── MAP ──────────────────────────────────────────────── */
.ntm-map-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
}
#ntm-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.leaflet-container {
  font-family: var(--sans) !important;
  background: #D5CDB8 !important;
  width:  100% !important;
  height: 100% !important;
}
.leaflet-tile-pane {
  filter: saturate(.84) brightness(1.04) contrast(1.01);
}

/* ── SIDEBAR ──────────────────────────────────────────── */
.ntm-sidebar {
  width: 300px; flex-shrink: 0;
  background: #fff;
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.ntm-sb-head {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 15px 11px;
  background: var(--cream);
  border-bottom: 1px solid #E2D9CC;
}
.ntm-sb-title {
  font-family: var(--serif); font-size: 14px; font-weight: 600; color: var(--e);
}
.ntm-sb-badge {
  background: var(--e); color: var(--snow);
  font-size: 11px; font-weight: 500;
  padding: 2px 10px; border-radius: 20px;
}
.ntm-sb-scroll {
  flex: 1; overflow-y: auto; overflow-x: hidden;
}
.ntm-sb-scroll::-webkit-scrollbar { width: 4px; }
.ntm-sb-scroll::-webkit-scrollbar-thumb { background: #D0C8BC; border-radius: 2px; }

/* Sidebar region groups */
.ntm-sg { border-bottom: 1px solid #EDE5DA; }
.ntm-sg-hdr {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 13px; background: #F9F5EF;
  cursor: pointer; user-select: none; transition: background .15s;
}
.ntm-sg-hdr:hover { background: var(--cream); }
.ntm-sg-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.ntm-sg-name { font-size: 11px; font-weight: 500; color: var(--e); flex: 1; line-height: 1.35; }
.ntm-sg-cnt  { font-size: 10px; color: var(--stone); }
.ntm-sg-arr  { font-size: 9px; color: var(--smoke); transition: transform .2s; }
.ntm-sg-arr.open { transform: rotate(90deg); }
.ntm-sg-routes { display: none; }
.ntm-sg-routes.open { display: block; }

.ntm-ri {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px 7px 24px;
  border-top: 1px solid #F0E8DF;
  cursor: pointer; font-size: 12px; color: var(--e);
  transition: background .12s;
}
.ntm-ri:hover    { background: #FFF7EC; }
.ntm-ri.sel      { background: #FFF2D8; }
.ntm-ri.hidden   { display: none; }
.ntm-ri-name { flex: 1; line-height: 1.35; }

/* Badges */
.ntm-badge {
  font-size: 9px; font-weight: 500;
  padding: 1px 6px; border-radius: 4px;
  flex-shrink: 0; white-space: nowrap;
}
.ntm-badge-Easy      { background: #E8F5E9; color: #1B5E20; }
.ntm-badge-Moderate  { background: #FFF8E1; color: #7B4F00; }
.ntm-badge-Strenuous { background: #FFF0E0; color: #7A2E00; }
.ntm-badge-Extreme   { background: #FFEBEE; color: #7B0000; }
.ntm-badge-permit    { background: #FFEBEE; color: var(--red); font-weight: 600; }

/* ══════════════════════════════════════════════════════════
   LEAFLET POPUP
   ══════════════════════════════════════════════════════════ */
.leaflet-popup-content-wrapper {
  border-radius: 16px !important;
  padding: 0 !important; border: none !important;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(13,5,3,.28) !important;
}
.leaflet-popup-content { margin: 0 !important; min-width: 252px; width: auto !important; }
.leaflet-popup-tip-container { display: none !important; }
.leaflet-popup-close-button { display: none !important; }

.ntm-pop-head {
  padding: 13px 16px 11px;
  background: linear-gradient(135deg, #0D0503, #2A0E08);
}
.ntm-pop-region {
  font-size: 9px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: 5px;
}
.ntm-pop-name {
  font-family: var(--serif); font-size: 16px; font-weight: 700;
  color: #FFF8EE; line-height: 1.25;
}
.ntm-pop-body { padding: 12px 16px 14px; background: #fff; }
.ntm-pop-badges { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 10px; }
.ntm-pop-badge { font-size: 10px; font-weight: 500; padding: 2px 9px; border-radius: 20px; }
.ntm-pop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.ntm-pop-cell { background: var(--snow); border-radius: 8px; padding: 8px 10px; }
.ntm-pop-cl { font-size: 9px; text-transform: uppercase; letter-spacing: .05em; color: var(--stone); margin-bottom: 3px; }
.ntm-pop-cv { font-size: 12px; font-weight: 500; color: var(--e); }
.ntm-pop-btn {
  display: block; width: 100%; padding: 10px 12px;
  background: var(--e); color: #FFF8EE !important;
  text-align: center; border-radius: 9px;
  font-family: var(--sans); font-size: 12px; font-weight: 600;
  border: none; cursor: pointer; text-decoration: none;
  transition: background .15s, transform .1s;
}
.ntm-pop-btn:hover { background: var(--bark); transform: translateY(-1px); }

/* ══════════════════════════════════════════════════════════
   DETAIL PANEL (slide-in from right)
   ══════════════════════════════════════════════════════════ */
.ntm-scrim {
  display: none; position: fixed; inset: 0;
  background: rgba(10,4,2,.5); z-index: 10001;
  backdrop-filter: blur(4px);
}
.ntm-scrim.open { display: block; }

.ntm-panel {
  position: fixed; top: 0; right: -500px; bottom: 0;
  width: 480px; max-width: 98vw;
  z-index: 10002;
  transition: right .35s var(--ease);
}
.ntm-panel.open { right: 0; }
.ntm-panel-wrap {
  height: 100%; background: #fff;
  box-shadow: -10px 0 60px rgba(10,4,2,.25);
  display: flex; flex-direction: column;
  overflow-y: auto; position: relative;
}
.ntm-panel-close {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,248,238,.13);
  border: 1px solid rgba(255,248,238,.22);
  color: rgba(255,248,238,.8); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.ntm-panel-close svg { width: 12px; height: 12px; }
.ntm-panel-close:hover { background: var(--red); border-color: var(--red); color: #fff; }

/* Panel sections */
.ntm-pd-hero {
  flex-shrink: 0; padding: 32px 26px 24px;
  background: linear-gradient(150deg, #0D0503 0%, #2A0E08 60%, #130A06 100%);
}
.ntm-pd-breadcrumb {
  font-size: 10px; text-transform: uppercase;
  letter-spacing: .08em; margin-bottom: 10px; line-height: 1.4;
}
.ntm-pd-name {
  font-family: var(--serif); font-size: 26px; font-weight: 700;
  color: #FFF8EE; line-height: 1.2; margin-bottom: 14px;
}
.ntm-pd-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.ntm-pd-tag {
  font-size: 11px; padding: 3px 12px; border-radius: 20px;
  border: 1px solid rgba(255,248,238,.18); color: rgba(255,248,238,.75);
}
.ntm-pd-tag.diff   { background: rgba(220,80,60,.14); border-color: rgba(220,80,60,.4); color: #FF8C78; }
.ntm-pd-tag.permit { background: rgba(220,80,60,.2); border-color: rgba(220,80,60,.5); color: #FF7060; }

.ntm-pd-stats {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1px; background: #E0D8CC; flex-shrink: 0;
}
.ntm-pd-stat { background: #fff; padding: 16px 22px; }
.ntm-pd-stat-label {
  font-size: 9px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--stone); margin-bottom: 5px;
}
.ntm-pd-stat-value { font-size: 18px; font-weight: 500; color: var(--e); line-height: 1.2; }
.ntm-pd-stat-value.sky  { color: var(--sky); }
.ntm-pd-stat-value.easy { color: var(--green); }
.ntm-pd-stat-value.mod  { color: var(--amber); }
.ntm-pd-stat-value.str  { color: #A03000; }
.ntm-pd-stat-value.ext  { color: var(--red); }

.ntm-pd-permit {
  flex-shrink: 0; padding: 14px 22px;
  background: #FFF0EE; border-bottom: 1px solid #FFCDD2;
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 12px; color: #7B1A0E; line-height: 1.65;
}
.ntm-pd-permit svg { flex-shrink: 0; margin-top: 2px; width: 16px; height: 16px; }

.ntm-pd-desc {
  flex-shrink: 0; padding: 18px 22px;
  font-size: 13px; color: #584E44; line-height: 1.8;
  border-bottom: 1px solid #EDE5DA; font-style: italic;
}

.ntm-pd-contact {
  flex-shrink: 0; padding: 14px 22px;
  border-bottom: 1px solid #EDE5DA;
  display: flex; flex-wrap: wrap; gap: 10px;
}
.ntm-pd-contact a {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; color: var(--e);
  text-decoration: none; padding: 6px 12px;
  background: var(--snow); border: 1px solid var(--border);
  border-radius: 20px; transition: background .15s;
}
.ntm-pd-contact a:hover { background: var(--fog); }

.ntm-pd-footer { padding: 20px 22px 28px; margin-top: auto; }

.ntm-book-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 16px 22px;
  background: var(--e); color: #FFF8EE !important;
  border-radius: 12px; border: none; cursor: pointer;
  font-family: var(--sans); font-size: 15px; font-weight: 600;
  text-decoration: none; letter-spacing: .02em;
  box-shadow: 0 4px 18px rgba(13,5,3,.22);
  transition: background .2s, transform .12s, box-shadow .2s;
}
.ntm-book-btn:hover {
  background: var(--bark); transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(13,5,3,.32);
}
.ntm-book-btn:active { transform: translateY(0); }
.ntm-book-btn.nolink {
  background: #E5DDD2; color: var(--stone) !important;
  cursor: not-allowed; box-shadow: none; transform: none;
}
.ntm-book-btn.nolink:hover { background: #E5DDD2; transform: none; box-shadow: none; }

.ntm-pd-footer-note {
  margin-top: 10px; text-align: center;
  font-size: 11px; color: var(--stone); line-height: 1.5;
}

/* ══════════════════════════════════════════════════════════
   LOADING SPLASH
   ══════════════════════════════════════════════════════════ */
.ntm-splash {
  position: absolute; inset: 0; z-index: 9999;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px;
  background: var(--snow);
}
.ntm-splash p { font-size: 13px; color: var(--stone); }
.ntm-spin {
  width: 46px; height: 46px;
  border: 3px solid #D8D0C0;
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: ntm-spin .8s linear infinite;
}
@keyframes ntm-spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 1024px) { .ntm-sidebar { width: 260px; } }
@media (max-width: 900px)  { .ntm-sidebar { display: none; } }
@media (max-width: 700px) {
  .ntm-stats-row { display: none; }
  .ntm-subtitle  { display: none; }
  .ntm-toolbar select, .ntm-permit-chk, .ntm-shown-count { display: none; }
  .ntm-legend-strip { display: none; }
  .ntm-header { padding: 11px 14px 9px; }
  .ntm-title  { font-size: 16px; }
  .ntm-panel  { width: 100%; max-width: 100%; }
}
