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

:root {
  --gold:      #C4962A;
  --gold-light:#F0D080;
  --bordeaux:  #8B2252;
  --ivory:     #FAF6EE;
  --dark:      #2C1810;
  --mid:       #5C3D2E;
  --shadow:    rgba(44,24,16,.18);
  --radius:    10px;
  --header-h:  60px;
  --filter-h:  64px;
}

html, body { height: 100%; overflow: hidden; font-family: 'Lato', sans-serif; background: var(--ivory); color: var(--dark); }

#loading {
  position: fixed; inset: 0; background: var(--ivory);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 9999; gap: 18px;
}
#loading-logo {
  width: 200px; max-width: 70vw;
  margin-bottom: 8px;
}
#loading .spinner {
  width: 48px; height: 48px; border: 4px solid var(--gold-light);
  border-top-color: var(--bordeaux); border-radius: 50%;
  animation: spin .8s linear infinite;
}
#loading-title {
  font-family: 'Lato', sans-serif; font-size: 1.15rem; font-weight: 700;
  color: var(--mid); letter-spacing: .12em; text-transform: uppercase; margin-bottom: 4px;
}
#loading p { font-family: 'Playfair Display', serif; color: var(--bordeaux); font-size: 1.1rem; }
@keyframes spin { to { transform: rotate(360deg); } }

#header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h);
  background: #7B6851; color: #fff;
  display: flex; align-items: center; gap: 12px; padding: 0 14px;
  z-index: 1000; box-shadow: 0 2px 8px var(--shadow);
}
#logo {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%;
  background: var(--gold); display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: var(--dark); font-family: 'Playfair Display', serif;
  overflow: hidden;
}
#logo img { width: 100%; height: 100%; object-fit: cover; }
#search-wrap { flex-shrink: 0; width: 220px; position: relative; margin-left: auto; }
#search {
  width: 100%; padding: 7px 12px 7px 32px; border-radius: 20px;
  border: none; background: rgba(255,255,255,.15); color: #fff;
  font-family: 'Lato', sans-serif; font-size: .88rem; outline: none;
}
#search::placeholder { color: rgba(255,255,255,.65); }
#search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 14px; pointer-events: none; }
#lang-toggle {
  flex-shrink: 0; background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.3);
  color: #fff; border-radius: 16px; padding: 5px 12px;
  font-size: .8rem; cursor: pointer; font-family: 'Lato', sans-serif; transition: background .2s;
}
#lang-toggle:hover { background: rgba(255,255,255,.28); }

#map { position: fixed; top: var(--header-h); left: 0; right: 0; bottom: var(--filter-h); }

#filter-bar {
  position: fixed; bottom: 0; left: 0; right: 0; height: var(--filter-h);
  background: #fff; border-top: 1px solid #e8ddd0;
  display: flex; align-items: center; gap: 6px;
  padding: 0 10px; overflow-x: auto; z-index: 1000;
  box-shadow: 0 -2px 8px var(--shadow); scrollbar-width: none;
}
#filter-bar::-webkit-scrollbar { display: none; }

.filter-btn {
  flex-shrink: 0; display: flex; align-items: center; gap: 5px;
  padding: 7px 12px; border-radius: 20px; border: 2px solid transparent;
  font-family: 'Lato', sans-serif; font-size: .78rem; font-weight: 700;
  cursor: pointer; transition: all .2s; white-space: nowrap;
  background: #f2ece4; color: var(--mid);
}
.filter-btn.active { color: #fff; border-color: transparent; }
.filter-btn .emoji { font-size: 14px; }

.leaflet-popup-content-wrapper {
  border-radius: var(--radius) !important;
  box-shadow: 0 6px 24px var(--shadow) !important;
  border-top: 4px solid var(--bordeaux);
  padding: 0 !important; max-width: 280px;
  font-family: 'Lato', sans-serif;
}
.leaflet-popup-content { margin: 0 !important; width: auto !important; }
.popup-inner { padding: 14px 16px; }
.popup-category { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--gold); margin-bottom: 4px; }
.popup-name { font-family: 'Playfair Display', serif; font-size: 1.05rem; font-weight: 600; color: var(--dark); margin-bottom: 3px; }
.popup-address { font-size: .78rem; color: var(--mid); margin-bottom: 8px; }
.popup-description { font-size: .84rem; color: var(--dark); line-height: 1.45; margin-bottom: 8px; }
.popup-tip {
  background: #fdf6e3; border-left: 3px solid var(--gold);
  border-radius: 4px; padding: 7px 10px;
  font-size: .78rem; color: var(--mid); line-height: 1.4; margin-bottom: 10px;
}
.popup-tip strong { color: var(--bordeaux); }
.popup-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-maps {
  flex: 1; text-align: center; padding: 8px 10px;
  background: #7B6851; color: #fff !important; border-radius: 6px;
  text-decoration: none; font-size: .78rem; font-weight: 700; transition: background .2s;
}
.btn-maps:hover { background: #5e5040; }

.custom-marker {
  width: 32px; height: 32px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg); border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center;
}
.custom-marker .inner { transform: rotate(45deg); font-size: 14px; line-height: 1; }
.hotel-marker {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; background: #DC2626;
}

.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large { background-color: rgba(139,34,82,.18) !important; }
.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background-color: var(--bordeaux) !important;
  color: #fff !important; font-family: 'Lato', sans-serif; font-weight: 700;
}

#toast {
  position: fixed; bottom: calc(var(--filter-h) + 12px); left: 50%; transform: translateX(-50%);
  background: var(--dark); color: #fff; padding: 9px 18px; border-radius: 20px;
  font-size: .82rem; opacity: 0; transition: opacity .3s; pointer-events: none; z-index: 1001;
}
#toast.show { opacity: 1; }

@media (min-width: 768px) {
  #header-title { font-size: 1.2rem; }
  #search-wrap { max-width: 320px; }
  #filter-bar { justify-content: center; gap: 10px; }
  .filter-btn { font-size: .82rem; padding: 8px 16px; }
}

/* ─── Sidebar ─────────────────────────────────────────────────────────────── */
/* ─── Tab switcher ────────────────────────────────────────────────────────── */
#tab-switcher {
  display: flex; gap: 4px; flex-shrink: 0;
}
.tab-btn {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.3);
  color: rgba(255,255,255,.75); border-radius: 16px; padding: 5px 11px;
  font-family: 'Lato', sans-serif; font-size: .75rem; font-weight: 700;
  cursor: pointer; transition: background .2s, color .2s, border-color .2s;
  white-space: nowrap;
}
.tab-btn.active {
  background: #fff; color: var(--bordeaux); border-color: #fff;
}
.tab-btn:hover:not(.active) { background: rgba(255,255,255,.25); color: #fff; }
@media (max-width: 480px) {
  #sidebar-toggle-text { display: none; }
}
@media (max-width: 400px) {
  .tab-btn { font-size: .65rem; padding: 4px 8px; }
}

/* ─── Popup ristorante ────────────────────────────────────────────────────── */
.popup-rest-row {
  display: flex; align-items: baseline; gap: 6px;
  font-size: .78rem; color: var(--dark); line-height: 1.4; margin-bottom: 4px;
}
.popup-rest-label {
  font-weight: 700; color: var(--bordeaux); flex-shrink: 0;
}

#sidebar-toggle {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.45);
  color: #fff; border-radius: 20px; padding: 6px 14px 6px 10px;
  cursor: pointer; transition: background .2s, box-shadow .2s;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
#sidebar-toggle:hover { background: rgba(255,255,255,.32); box-shadow: 0 2px 8px rgba(0,0,0,.2); }
#sidebar-toggle .st-icon { font-size: 16px; line-height: 1; }
#sidebar-toggle-text {
  font-family: 'Lato', sans-serif; font-size: .7rem;
  font-weight: 700; letter-spacing: .07em;
  white-space: nowrap;
}

#sidebar {
  position: fixed;
  top: var(--header-h); left: 0; bottom: var(--filter-h);
  width: 300px;
  background: var(--ivory);
  z-index: 950;
  transform: translateX(-100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
  box-shadow: 4px 0 20px var(--shadow);
}
#sidebar.open { transform: translateX(0); }

#sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(44,24,16,.4);
  z-index: 940;
}
#sidebar-overlay.show { display: block; }

.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid #e2d8cc;
  flex-shrink: 0;
}
#sidebar-title {
  font-family: 'Playfair Display', serif;
  font-size: 1rem; font-weight: 600; color: var(--dark);
}
#sidebar-close {
  background: none; border: none; font-size: 18px;
  color: var(--mid); cursor: pointer; padding: 2px 4px; line-height: 1;
  border-radius: 4px; transition: background .15s;
}
#sidebar-close:hover { background: #e8ddd0; }

.sidebar-body {
  overflow-y: auto; flex: 1;
  padding-bottom: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-light) transparent;
}
.sidebar-body::-webkit-scrollbar { width: 4px; }
.sidebar-body::-webkit-scrollbar-thumb { background: var(--gold-light); border-radius: 2px; }

.sidebar-cat-label {
  position: sticky; top: 0;
  padding: 10px 16px 5px;
  font-size: .68rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--gold);
  background: var(--ivory);
  border-bottom: 1px solid #ede5d8;
}

.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px;
  font-family: 'Lato', sans-serif; font-size: .84rem; color: var(--dark);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background .15s, border-color .15s;
}
.sidebar-item:hover {
  background: #f0e8dc;
  border-left-color: var(--bordeaux);
  color: var(--bordeaux);
}
.sidebar-item .si-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}

@media (max-width: 480px) {
  #sidebar { width: 85vw; }
}
