/**
 * Dokidoki Trip theme
 * Overrides the original dark TravelMap UI with the mobile app visual system.
 */
:root {
  --bg: #f2f3f6;
  --panel: #ffffff;
  --raised: #f2f3f6;
  --overlay: #eaebee;
  --border: #eaebee;
  --border2: #dcdfE3;
  --border3: #c8cbd0;
  --text: #141517;
  --text2: #5f646c;
  --text3: #868b94;
  --accent: #ff5c8a;
  --accent-strong: #e83d70;
  --accent-soft: #fff0f4;
  --sh-sm: 0 1px 4px rgba(20,21,23,.07);
  --sh-md: 0 10px 24px rgba(20,21,23,.10);
  --sh-lg: 0 18px 42px rgba(20,21,23,.13);
}

html,
body {
  background: var(--bg);
  color: var(--text);
}

body {
  height: 100dvh;
}

header {
  height: 66px;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(20,21,23,.02);
  color: var(--text);
}

header::before {
  content: '♥';
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: #ff5c8a;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 900;
  flex-shrink: 0;
  box-shadow: 0 10px 22px rgba(255,92,138,.22);
}

.h-back {
  height: 38px;
  border-radius: 999px;
  background: var(--raised);
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 0 13px;
}

.h-back:hover {
  background: var(--overlay);
  color: var(--text);
}

.h-divider {
  background: var(--border);
}

.h-logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  font-size: 21px;
}

.h-title {
  color: var(--text);
  font-size: 1rem;
  font-weight: 900;
}

.h-sub,
.h-hint {
  color: var(--text3);
}

.h-controls {
  gap: 8px;
}

.toggle-group {
  background: var(--raised);
  border-color: var(--border);
  border-radius: 999px;
}

.tg-btn {
  color: var(--text2);
  border-radius: 999px;
}

.tg-btn:hover {
  color: var(--text);
  background: rgba(20,21,23,.05);
}

.tg-btn.active {
  background: #141517;
  color: #fff;
}

.planner-btn {
  height: 38px;
  border-radius: 999px;
  background: #ff5c8a;
  border: none;
  color: #fff;
  box-shadow: 0 8px 18px rgba(255,92,138,.20);
}

.planner-btn:hover {
  background: var(--accent-strong);
}

.main {
  background: var(--bg);
}

.sidebar {
  width: 326px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  box-shadow: 8px 0 26px rgba(20,21,23,.04);
}

.sidebar.collapsed {
  width: 0;
}

.sb-toggle {
  left: 326px;
  width: 24px;
  height: 54px;
  background: #fff;
  border-color: var(--border);
  color: var(--text3);
  box-shadow: var(--sh-sm);
}

.sec {
  padding: 16px;
  border-bottom: 8px solid var(--bg);
}

.sec-title,
.pn-sec-label {
  color: var(--text);
  font-size: .75rem;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 900;
}

.area-count {
  background: var(--raised);
  color: var(--text3);
  border-color: var(--border);
}

.type-grid {
  gap: 8px;
}

.type-btn,
.comp-btn,
.ovl-btn,
.ts-btn {
  background: var(--raised);
  border-color: transparent;
  border-radius: 14px;
  color: var(--text2);
}

.type-btn {
  padding: 12px 7px 10px;
}

.type-btn:hover,
.comp-btn:hover,
.ovl-btn:hover,
.ts-btn:hover {
  border-color: var(--border3);
  background: #fff;
}

.type-btn.active,
.comp-btn.active,
.ovl-btn.active,
.ts-btn.active {
  border-color: #ff5c8a;
  background: var(--accent-soft);
  color: #e83d70;
}

.t-picto {
  background: #fff;
  border-radius: 12px;
}

.type-btn.active .t-picto {
  background: #fff;
}

.t-name,
.comp-btn .comp-label,
.ts-btn .ts-name {
  color: inherit;
}

.t-range,
.notes,
.leg-labels,
.sl-org,
.types-hint,
.budget-suffix,
.nights-suffix {
  color: var(--text3);
}

.leg-row,
.sl-name {
  color: var(--text2);
}

#map {
  background: #e8eaed;
}

.leaflet-control-zoom {
  border: none !important;
  box-shadow: var(--sh-md) !important;
}

.leaflet-control-zoom a {
  width: 40px !important;
  height: 40px !important;
  line-height: 40px !important;
  background: #fff !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

.area-label {
  background: #000 !important;
  background-color: #000 !important;
  border: 2px solid rgba(255,255,255,.9);
  border-radius: 999px;
  color: #fff !important;
  padding: 7px 12px;
  box-shadow: 0 3px 14px rgba(0,0,0,.68);
  backdrop-filter: none;
}

.area-label .al-icons,
.area-label .al-tagline {
  display: none;
}

.al-name {
  color: #fff !important;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: 0;
  text-shadow: 0 1px 2px rgba(0,0,0,.85);
}

.leaflet-popup-content-wrapper {
  background: #fff !important;
  border: 1px solid var(--border) !important;
  border-radius: 18px !important;
  box-shadow: 0 20px 48px rgba(20,21,23,.20) !important;
}

.leaflet-popup-tip {
  background: #fff !important;
}

.pu-name,
.pu-val {
  color: var(--text);
}

.pu-sub,
.pu-label,
.pu-na,
.pu-night {
  color: var(--text3);
}

.pu-tag {
  background: var(--raised);
  color: var(--text2);
}

.pu-table {
  border-color: var(--border);
}

.pu-row {
  border-bottom-color: var(--border);
}

.pu-row.pu-active {
  background: var(--accent-soft);
}

.planner-overlay {
  top: 66px;
}

.planner-panel {
  background: #fff;
  border-left: 1px solid var(--border);
  box-shadow: -18px 0 42px rgba(20,21,23,.12);
}

.pn-head {
  border-bottom-color: var(--border);
}

.pn-head-title,
.ns-val,
.day-title,
.step-name,
.rec-name,
.pn-result-hd {
  color: var(--text);
}

.pn-close,
.nights-stepper,
.budget-input,
.day-card {
  background: var(--raised);
  border-color: var(--border);
  color: var(--text);
}

.pn-gen-btn {
  border-radius: 999px;
  background: #ff5c8a;
}

.pn-gen-btn:hover {
  background: #e83d70;
}

.day-hd {
  background: #fff;
  border-bottom-color: var(--border);
}

.step-desc,
.day-zone,
.rec-why {
  color: var(--text3);
}

.dd-city-tabs,
.dd-bottom-nav {
  display: none;
}

@media (min-width: 769px) {
  .dd-city-tabs {
    height: 54px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }

  .dd-city-tab {
    height: 36px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--raised);
    color: var(--text2);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
  }

  .dd-city-tab.active {
    background: var(--text);
    color: #fff;
    border-color: var(--text);
  }
}

@media (max-width: 768px) {
  body {
    background: #f2f3f6;
  }

  header {
    height: auto;
    min-height: 56px;
    padding: 9px 12px;
    gap: 8px;
    position: relative;
    z-index: 1200;
  }

  header::before {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    font-size: 17px;
  }

  .h-back,
  .h-divider,
  .h-sub,
  .h-hint {
    display: none;
  }

  .h-city {
    flex: 1;
    min-width: 0;
  }

  .h-logo {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    font-size: 17px;
  }

  .h-title {
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .h-controls {
    width: 100%;
    margin-left: 0;
    display: grid;
    grid-template-columns: 1fr;
  }

  .h-controls .toggle-group:first-child {
    display: none;
  }

  .h-controls .toggle-group {
    overflow-x: auto;
    scrollbar-width: none;
  }

  .h-controls .toggle-group::-webkit-scrollbar {
    display: none;
  }

  .planner-btn {
    position: fixed;
    right: 12px;
    bottom: 158px;
    z-index: 700;
    box-shadow: 0 4px 16px rgba(20,21,23,.18);
  }

  .dd-city-tabs {
    display: flex;
    height: 46px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 1100;
  }

  .dd-city-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border-bottom: 2.5px solid transparent;
    color: var(--text2);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
  }

  .dd-city-tab.active {
    color: #ff5c8a;
    border-bottom-color: #ff5c8a;
    font-weight: 900;
  }

  .main {
    flex-direction: column-reverse;
    padding-bottom: 64px;
  }

  #map {
    min-height: 100%;
  }

  .sidebar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 64px;
    width: 100% !important;
    max-height: 39vh;
    border-top: 1px solid var(--border);
    border-right: none;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 22px rgba(20,21,23,.12);
    z-index: 650;
    display: block;
    overflow-y: auto;
  }

  .sidebar::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: #dcdfE3;
    margin: 10px auto 0;
    position: sticky;
    top: 10px;
    z-index: 1;
  }

  .sec {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
  }

  .sec:nth-of-type(n+4) {
    display: none;
  }

  .type-grid {
    display: flex;
    overflow-x: auto;
    gap: 7px;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .type-grid::-webkit-scrollbar {
    display: none;
  }

  .type-btn {
    min-width: 118px;
    flex: 0 0 118px;
    border-radius: 999px;
    flex-direction: row;
    justify-content: center;
    padding: 8px 12px;
  }

  .t-picto {
    width: 24px;
    height: 24px;
    background: transparent;
  }

  .t-picto .material-symbols-outlined {
    font-size: 17px;
  }

  .t-range {
    display: none;
  }

  .leg-items {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 4px 7px;
  }

  .leg-row {
    font-size: .6rem;
  }

  .leg-row::after {
    display: none;
  }

  .leaflet-control-zoom {
    margin-bottom: 42vh !important;
  }

  .leaflet-popup-content-wrapper {
    max-width: calc(100vw - 34px);
  }

  .planner-overlay {
    top: 0;
    background: rgba(20,21,23,.28);
    align-items: flex-end;
    justify-content: center;
  }

  .planner-overlay.open {
    pointer-events: auto;
  }

  .planner-panel {
    width: 100%;
    max-height: 86vh;
    border-radius: 20px 20px 0 0;
    border-left: none;
    transform: translateY(100%);
  }

  .planner-overlay.open .planner-panel {
    transform: translateY(0);
  }

  .dd-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 64px;
    background: #fff;
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(5,1fr);
    z-index: 9000;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .dd-bottom-item {
    border: none;
    background: none;
    color: #adb1b8;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 10px;
    font-weight: 800;
    text-decoration: none;
  }

  .dd-bottom-item.active {
    color: #ff5c8a;
  }

  .dd-bottom-item.center .dd-bottom-icon {
    width: 50px;
    height: 50px;
    border-radius: 999px;
    background: #ff5c8a;
    color: #fff;
    display: grid;
    place-items: center;
    margin-top: -18px;
    border: 2px solid #fff;
    box-shadow: 0 4px 16px rgba(20,21,23,.18);
  }
}
