/* ════════════════════════════════════════════════════════════════════════════
   common.css — stili condivisi da index.php e gallery.php
   ════════════════════════════════════════════════════════════════════════════ */

/* ── TOKENS ──────────────────────────────────────────────────────────────── */
:root {
  /* Dark Theme (Default) */
  --bg:          #080808;
  --bg-rgb:      8, 8, 8;
  --surface:     #111111;
  --surface-rgb: 17, 17, 17;
  --surface2:    #1c1c1c;
  --surface2-rgb: 28, 28, 28;
  --border:      #2a2a2a;
  --border-rgb:  42, 42, 42;
  --gold:        #c9a84c;
  --gold-light:  #e5cd88;
  --gold-dark:   #9a7a2e;
  --gold-dim:    rgba(201, 168, 76, .18);
  --text:        #ede8e0;
  --text-muted:  #777;
  --text-sub:    #555;
  --glass-bg:    rgba(17, 17, 17, 0.75);
  --glass-border: rgba(255, 255, 255, 0.08);
  --hero-lines:  rgba(255, 255, 255, 0.025);
  --hero-glow:   rgba(201, 168, 76, 0.14);
  
  --serif:      'Cormorant Garamond', Georgia, serif;
  --sans:       'DM Sans', 'Hind Siliguri', 'Noto Sans KR', sans-serif;
  --radius:     4px;
  --trans:      .35s cubic-bezier(.4, 0, .2, 1);
  --shadow:     0 12px 40px rgba(0, 0, 0, 0.6);
}

body.light-theme {
  --bg:          #fdfcf9;
  --bg-rgb:      253, 252, 249;
  --surface:     #ffffff;
  --surface-rgb: 255, 255, 255;
  --surface2:    #f5f2eb;
  --surface2-rgb: 245, 242, 235;
  --border:      #e0dbd0;
  --border-rgb:  224, 219, 208;
  --gold:        #a68b3d;
  --gold-light:  #c9a84c;
  --gold-dark:   #7a6220;
  --gold-dim:    rgba(166, 139, 61, .12);
  --text:        #2a2825;
  --text-muted:  #666;
  --text-sub:    #888;
  --glass-bg:    rgba(255, 255, 255, 0.75);
  --glass-border: rgba(0, 0, 0, 0.05);
  --hero-lines:  rgba(0, 0, 0, 0.03);
  --hero-glow:   rgba(166, 139, 61, 0.08);
  --shadow:     0 12px 40px rgba(0, 0, 0, 0.08);
}

/* ── UTILS ───────────────────────────────────────────────────────────────── */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
}

/* ── RESET ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html  { scroll-behavior: smooth; }
body  {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a   { color: inherit; text-decoration: none; }

/* ── SCROLLBAR ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── TOPBAR ──────────────────────────────────────────────────────────────── */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(16px,4vw,48px); height: 56px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-logo {
  font-family: var(--serif); font-size: 1.45rem;
  font-weight: 400; letter-spacing: .08em;
}
.topbar-logo span { color: var(--gold); }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; }

/* Frecce prev/next (usate in gallery) */
.nav-arrow {
  font-size: 1.6rem; color: var(--text-sub); line-height: 1;
  padding: 4px 2px;
  transition: color var(--trans), transform var(--trans), opacity var(--trans);
  cursor: pointer;
}
.nav-arrow:hover { color: var(--gold); transform: scale(1.2); }
.nav-arrow[style*="opacity: 0.5"] { cursor: not-allowed; }

/* Select generico con chevron */
.select-wrap { position: relative; }
.select-wrap::after {
  content: '▾'; position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%); color: var(--gold);
  pointer-events: none; font-size: .7rem;
}

/* ── SELETTORE STATO (Header) ────────────────────────────────────────────── */
.country-select-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.country-dropdown {
  position: relative;
  width: min(220px, 38vw);
}
.country-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 400;
  padding: 6px 28px 6px 10px;
  cursor: pointer;
  transition: border-color var(--trans), color var(--trans), background var(--trans);
}
.country-btn:hover,
.country-btn:focus {
  border-color: var(--gold);
  color: var(--text);
  outline: none;
}
.country-btn-label {
  display: flex;
  align-items: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.country-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 1100;
  overflow: hidden;
}
.country-menu.open {
  display: block;
  animation: fadeUp .18s ease both;
}
.country-search-wrap {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.country-search {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--sans);
  font-size: .8rem;
  padding: 9px 10px;
  transition: border-color var(--trans), box-shadow var(--trans);
}
.country-search::placeholder { color: var(--text-sub); }
.country-search:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201,168,76,.14);
}
.country-list {
  max-height: min(360px, 58vh);
  overflow-y: auto;
  padding: 6px 0;
}
.country-placeholder,
.country-group-label,
.country-option,
.country-empty {
  display: block;
  width: 100%;
  text-align: left;
}
.country-placeholder,
.country-option,
.country-empty {
  padding: 8px 14px;
  font-size: .8rem;
}
.country-placeholder { color: var(--text-sub); }
.country-group-label {
  padding: 10px 14px 4px;
  font-size: .72rem;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.country-option {
  display: flex;
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--trans), color var(--trans);
  text-align: left;
  line-height: 1.3;
}
.country-option:hover,
.country-option:focus {
  background: rgba(201,168,76,.08);
  color: var(--text);
  outline: none;
}
.country-option.active {
  color: var(--gold-light);
  background: rgba(201,168,76,.12);
}
.country-empty { color: var(--text-sub); }

/* Force hide elementi con attributo hidden */
.country-placeholder[hidden],
.country-option[hidden],
.country-group-label[hidden],
.country-empty[hidden] {
  display: none !important;
}

[hidden] { display: none !important; }

/* ── LANGUAGE DROPDOWN ───────────────────────────────────────────────────── */
/* ── LANGUAGE DROPDOWN ───────────────────────────────────────────────────── */
/*
.lang-dropdown {
  position: relative;
  margin-left: 6px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}
.lang-btn {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 5px 10px 5px 8px;
  color: var(--text-muted); cursor: pointer;
  font-family: var(--sans); font-size: .78rem; font-weight: 400;
  transition: border-color var(--trans), color var(--trans);
  white-space: nowrap; line-height: 1;
}
.lang-btn:hover { border-color: var(--gold); color: var(--text); }
.lang-btn img   { width: 20px; height: 14px; border-radius: 2px; object-fit: cover; flex-shrink: 0; }
.lang-btn .lang-name { display: none; }
.lang-chevron { font-size: .6rem; color: var(--gold); }

@media (min-width: 560px) { .lang-btn .lang-name { display: inline; } }

.lang-menu {
  display: none;
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0,0,0,.6);
  min-width: 148px; z-index: 1100; overflow: hidden;
}
.lang-menu.open { display: block; animation: fadeUp .18s ease both; }

.lang-option {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; cursor: pointer;
  font-size: .8rem; font-weight: 400; color: var(--text-muted);
  transition: background var(--trans), color var(--trans);
  white-space: nowrap;
}
.lang-option:hover  { background: rgba(201,168,76,.08); color: var(--text); }
.lang-option.active { color: var(--gold-light); }
.lang-option .lang-check {
  margin-left: auto; font-size: .6rem; color: var(--gold);
  opacity: 0; transition: opacity var(--trans);
}
.lang-option.active .lang-check { opacity: 1; }
.lang-option img { width: 20px; height: 14px; border-radius: 2px; object-fit: cover; flex-shrink: 0; }
*/

/* ── THEME TOGGLE ────────────────────────────────────────────────────────── */
.theme-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer;
  transition: all var(--trans);
  margin: 0 4px;
}
.theme-toggle:hover { border-color: var(--gold); color: var(--gold); transform: rotate(15deg); }
.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }
body.light-theme .theme-toggle .sun { display: block; }
body.light-theme .theme-toggle .moon { display: none; }

/* ── CAMERA MARKERS ──────────────────────────────────────────────────────── */
.camera-marker-icon {
  background: none !important; border: none !important;
}
.camera-marker-svg {
  width: 24px; height: 24px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.camera-marker-svg:hover {
  transform: scale(1.2) rotate(-5deg);
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.6));
}

/* ── HERO ────────────────────────────────────────────────────────────────── */
#hero {
  position: relative; min-height: 100svh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 80px 24px 60px; overflow: hidden;
  background: var(--bg);
}
.hero-bg-lines {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 79px, var(--hero-lines) 80px),
    repeating-linear-gradient(90deg, transparent, transparent 79px, var(--hero-lines) 80px);
}
.hero-glow {
  position: absolute; width: min(80vw, 600px); height: min(80vw, 600px);
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, var(--hero-glow) 0%, transparent 70%);
  animation: glowPulse 6s ease-in-out infinite;
}
.hero-title {
  font-family: var(--serif); font-size: clamp(4rem,14vw,9rem);
  font-weight: 300; line-height: 1; color: var(--text);
  margin-bottom: 20px; animation: fadeUp .8s .2s ease both;
}
/* Porzione dorata nel titolo hero (usata in index.php per "Moreno") */
.hero-title span { color: var(--gold); }

.hero-divider {
  width: 60px; height: 1px; margin: 0 auto 20px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  animation: fadeUp .8s .3s ease both;
}
.hero-subtitle {
  font-family: var(--serif); font-style: italic;
  font-size: 1.1rem; color: #ffffff;
  font-weight: bold;
  margin-bottom: 40px; animation: fadeUp .8s .35s ease both;
}
body.light-theme .hero-subtitle {
  color: #000000;
}
.hero-stats {
  display: flex; gap: 40px; justify-content: center; flex-wrap: wrap;
  animation: fadeUp .8s .4s ease both;
}
.hero-stat .num {
  font-family: var(--serif); font-size: 2.2rem;
  font-weight: 300; color: var(--gold-light); line-height: 1;
}
.hero-stat .lbl {
  font-size: .72rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--text-sub); margin-top: 4px;
}
.scroll-cue {
  position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: var(--text-sub); font-size: .68rem; letter-spacing: .2em;
  text-transform: uppercase; animation: fadeUp 1s .7s ease both;
}
.scroll-cue-arrow {
  width: 1px; height: 36px;
  background: linear-gradient(180deg, var(--gold), transparent);
  animation: arrowDrop 2s 1.5s ease-in-out infinite;
}

/* ── MAP SECTION (condiviso) ─────────────────────────────────────────────── */
#map-section { padding: clamp(48px,7vw,80px) clamp(16px,4vw,64px); }
.map-header  { margin-bottom: 24px; }
.map-header .eyebrow {
  font-size: .68rem; font-weight: 500; letter-spacing: .25em;
  text-transform: uppercase; color: var(--gold); margin-bottom: 4px;
}
.map-header h2 { font-family: var(--serif); font-size: clamp(1.6rem,3vw,2.2rem); font-weight: 300; }

#leaflet-map {
  width: 100%; border-radius: 6px;
  border: 1px solid var(--border); overflow: hidden;
}
.map-loading {
  display: flex; align-items: center; justify-content: center;
  height: 100%; background: var(--surface);
  color: var(--text-muted); font-size: .85rem;
  letter-spacing: .1em; gap: 12px;
}
.spinner {
  width: 20px; height: 20px; flex-shrink: 0;
  border: 2px solid var(--border); border-top-color: var(--gold);
  border-radius: 50%; animation: spin .8s linear infinite;
}

/* ── UNIFIED MAP SYSTEM (3D & LEAFLET) ──────────────────────────────────── */
.map-container-unified {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}

.map-toolbar-modes {
  display: flex;
  align-items: center;
  gap: 6px;
}

.map-mode-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--sans);
  font-size: .75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--trans);
}

.map-mode-btn svg {
  width: 16px;
  height: 16px;
}

.map-mode-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.map-mode-btn.active {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: var(--gold);
}

.map-toolbar-globe-ctrls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-view-area {
  position: relative;
  width: 100%;
}

.map-wrapper {
  width: 100%;
  height: clamp(400px, 60vh, 800px); /* Usato da index.php */
  position: relative;
}

#leaflet-map, #globe-container {
  width: 100%;
  height: 100%;
}

/* Popup Leaflet (usati in entrambe le pagine) */
.lf-popup-center { text-align: center; }   /* wrapper centrato per i popup di index.js */
.lf-popup-title {
  font-family: var(--serif); font-size: 1.05rem;
  color: var(--gold); display: block;
}
.lf-popup-sub  { font-size: .78rem; color: #aaa; display: block; }
.lf-popup-link {
  font-size: .72rem; color: var(--gold);
  letter-spacing: .1em; margin-top: 8px; display: block;
}

/* ── LEAFLET OVERRIDE ────────────────────────────────────────────────────── */
.leaflet-popup-content-wrapper {
  background: #111 !important; border: 1px solid #2a2a2a !important;
  border-radius: 4px !important; box-shadow: 0 8px 32px rgba(0,0,0,.7) !important;
  color: #ede8e0 !important; font-family: 'DM Sans', sans-serif !important;
}
.leaflet-popup-tip     { background: #111 !important; }
.leaflet-popup-content { margin: 12px 16px !important; line-height: 1.7 !important; }
.leaflet-control-zoom a { background: #111 !important; border-color: #2a2a2a !important; color: #c9a84c !important; }
.leaflet-control-zoom a:hover { background: #1c1c1c !important; color: #e5cd88 !important; }
.leaflet-control-attribution { background: rgba(0,0,0,.6) !important; color: #444 !important; font-size: .65rem !important; }
.leaflet-control-attribution a { color: #666 !important; }

/* ── FOOTER ──────────────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 40px clamp(16px,4vw,64px);
  display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap; gap: 16px;
}
.footer-brand { font-family: var(--serif); font-size: 1.4rem; font-weight: 300; color: var(--text-muted); }
.footer-brand span { color: var(--gold); }
.footer-copy { font-size: .72rem; color: var(--text-sub); letter-spacing: .1em; }
footer a:hover { color: var(--gold); }

/* ── BACK TO TOP ─────────────────────────────────────────────────────────── */
#back-top-btn {
  position: fixed; bottom: 28px; right: 24px; z-index: 800;
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer; font-size: 1.1rem;
  transition: all var(--trans); opacity: 0; transform: translateY(12px);
}
#back-top-btn.visible { opacity: 1; transform: translateY(0); }
#back-top-btn:hover   { background: var(--gold-dim); border-color: var(--gold); color: var(--gold); }

/* ── ANIMATIONS ──────────────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes glowPulse {
  0%,100% { transform: scale(1);    opacity: .6; }
  50%     { transform: scale(1.18); opacity: 1;  }
}
@keyframes arrowDrop {
  0%   { transform: scaleY(0); transform-origin: top;    opacity: 1; }
  50%  { transform: scaleY(1); transform-origin: top;    opacity: 1; }
  100% { transform: scaleY(1); transform-origin: bottom; opacity: 0; }
}
@keyframes spin { to { transform: rotate(360deg); } }

.reveal         { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* ── RESPONSIVE COMUNE ───────────────────────────────────────────────────── */
@media (max-width: 600px) {
  /* Fix per il titolo Hero (.hero-title) che esce dai margini su smartphone */
  .hero-title {
    font-size: clamp(2rem, 12vw, 4.5rem) !important;
    overflow-wrap: break-word;
    padding: 0 20px;
  }
}

@media (max-width: 480px) {
  .topbar-logo { font-size: 1.15rem; }
  .nav-arrow   { display: none; }
  .country-dropdown { width: min(150px, 42vw); }
  .country-btn { font-size: .72rem; }
  .country-menu { width: 100%; }
  #hero        { padding: 60px 16px 48px; }
}

/* ── COOKIE / GDPR BANNER ────────────────────────────────────────────────── */

/*
 * Banner di consenso cookie GDPR — si apre in ingresso dalla parte bassa.
 * Rimane nascosto (.cookie-banner) fino all'aggiunta della classe .visible.
 * La classe .hiding avvia l'uscita prima della rimozione dal DOM.
 */
.cookie-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 9500;
  background: rgba(13,13,13,.98);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding: 20px clamp(16px,4vw,48px) 24px;
  transform: translateY(102%);           /* inizialmente fuori schermo */
  transition: transform .45s cubic-bezier(.4,0,.2,1);
  will-change: transform;
}
.cookie-banner.visible { transform: translateY(0); }
.cookie-banner.hiding  { transform: translateY(102%); }

.cookie-banner-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

/* Testo informativo */
.cookie-banner-text { flex: 1; min-width: 260px; }

.cookie-banner-title {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: .03em;
}

.cookie-banner-body {
  font-size: .8rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.cookie-banner-body a {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.cookie-banner-body a:hover { color: var(--gold-light); }

/* Pulsanti azione */
.cookie-banner-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.cookie-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .08em;
  padding: 9px 20px;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--trans), border-color var(--trans),
              color var(--trans), transform .15s;
}
.cookie-btn:hover  { transform: translateY(-1px); }
.cookie-btn:active { transform: translateY(0); }

/* "Solo necessari" — stile secondario */
.cookie-btn--secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.cookie-btn--secondary:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

/* "Accetta tutto" — stile primario dorato */
.cookie-btn--primary {
  background: var(--gold);
  border: 1px solid var(--gold);
  color: #080808;
}
.cookie-btn--primary:hover {
  background: var(--gold-light);
  border-color: var(--gold-light);
}

/* Link "Impostazioni" testuale */
.cookie-settings-link {
  font-size: .72rem;
  color: var(--text-sub);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--sans);
  padding: 4px 0;
  transition: color var(--trans);
}
.cookie-settings-link:hover { color: var(--text-muted); }

/* Variante che occupa lo spazio disponibile (per i pulsanti del modal footer) */
.cookie-btn--flex { flex: 1; }

/* ── COOKIE MODAL — pannello impostazioni dettagliate ────────────────────── */
.cookie-modal-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 9600;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
  padding: 16px;
}
.cookie-modal-overlay.open { display: flex; }

.cookie-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 24px 64px rgba(0,0,0,.7);
  max-width: 560px;
  width: 100%;
  max-height: 90svh;
  overflow-y: auto;
  padding: 32px;
  animation: fadeUp .3s ease;
}

.cookie-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.cookie-modal-title {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 300;
  color: var(--text);
}
.cookie-modal-close {
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  line-height: 1;
  padding: 2px 4px;
  transition: color var(--trans);
  flex-shrink: 0;
}
.cookie-modal-close:hover { color: var(--text); }

.cookie-modal-intro {
  font-size: .82rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

/* Categoria cookie */
.cookie-category {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.cookie-category:last-of-type { border-bottom: none; }

.cookie-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
}
.cookie-category-name {
  font-size: .85rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: .05em;
}
.cookie-category-desc {
  font-size: .78rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* Toggle switch */
.cookie-toggle {
  position: relative;
  width: 40px; height: 22px;
  flex-shrink: 0;
}
.cookie-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.cookie-toggle-slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 22px;
  cursor: pointer;
  transition: background var(--trans);
}
.cookie-toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  top: 3px; left: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform var(--trans), background var(--trans);
}
.cookie-toggle input:checked + .cookie-toggle-slider { background: var(--gold-dim); }
.cookie-toggle input:checked + .cookie-toggle-slider::before {
  transform: translateX(18px);
  background: var(--gold);
}
.cookie-toggle input:disabled + .cookie-toggle-slider { cursor: not-allowed; opacity: .5; }

/* Pulsanti in fondo al modal */
.cookie-modal-footer {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ── RESPONSIVE BANNER ───────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .cookie-banner-inner       { flex-direction: column; gap: 16px; }
  .cookie-banner-actions     { width: 100%; justify-content: flex-end; }
  .cookie-modal              { padding: 20px; }
}

/* ══════════════════════════════════════════════════════════════════════════════
   ADMIN AUTHENTICATION
   ══════════════════════════════════════════════════════════════════════════════ */

/* Admin badge in header (quando loggato) */
.admin-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  background: rgba(76, 175, 80, .12);
  border: 1px solid #4CAF50;
  border-radius: var(--radius);
  font-size: .7rem; font-weight: 500;
  color: #4CAF50;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.admin-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #4CAF50;
  animation: pulse-green 2s ease-in-out infinite;
}

@keyframes pulse-green {
  0%, 100% { opacity: 1; }
  50%      { opacity: .4; }
}

.admin-text { display: none; }

@media (min-width: 480px) {
  .admin-text { display: inline; }
}

/* Footer layout */
#footer {
  border-top: 1px solid var(--border);
  padding: 40px clamp(16px,4vw,64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-content {
  display: flex; align-items: center;
  justify-content: flex-start; flex-wrap: wrap; gap: 20px;
}

.footer-brand { font-family: var(--serif); font-size: 1.4rem; font-weight: 300; color: var(--text-muted); }
.footer-brand span { color: var(--gold); }

.footer-copy { font-size: .72rem; color: var(--text-sub); letter-spacing: .1em; }
.footer-copy a:hover { color: var(--gold); }

/* ── ADMIN LOGIN MODAL ───────────────────────────────────────────────────── */
.admin-modal-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
}
.admin-modal-overlay.open { display: flex; }

.admin-modal {
  display: none;
  position: fixed; inset: 0; z-index: 10100;
  align-items: center; justify-content: center;
}
.admin-modal.open { display: flex; }

.admin-modal-content {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 24px 64px rgba(0,0,0,.8);
  padding: 40px 32px;
  max-width: 380px;
  width: 100%;
  max-height: 90svh;
  overflow-y: auto;
  animation: modalSlideUp .3s ease;
  margin: 16px;
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(48px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.admin-modal-close {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none;
  font-size: 1.6rem; color: var(--text-muted);
  cursor: pointer;
  transition: color var(--trans); border-radius: var(--radius);
}
.admin-modal-close:hover {
  color: var(--text);
  background: rgba(255,255,255,.05);
}

.admin-modal-title {
  font-family: var(--serif);
  font-size: 1.5rem; font-weight: 300;
  color: var(--text);
  margin-bottom: 24px;
  text-align: center;
  letter-spacing: .04em;
}

/* Form */
.admin-form-group {
  margin-bottom: 16px;
}

.admin-form-label {
  display: block;
  font-size: .8rem; font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.admin-form-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 12px;
  font-family: var(--sans); font-size: .85rem;
  transition: border-color var(--trans);
}

.admin-form-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201,168,76,.15);
}

.admin-form-input::placeholder {
  color: var(--text-muted);
}

/* Error message */
.admin-form-error {
  display: none;
  padding: 10px 12px;
  background: rgba(244,67,54,.12);
  border: 1px solid #F44336;
  border-radius: var(--radius);
  color: #ff6b6b;
  font-size: .78rem;
  margin-bottom: 12px;
  line-height: 1.5;
}
.admin-form-error:not(:empty) { display: block; }

/* Submit button */
.admin-form-submit {
  width: 100%;
  background: var(--gold);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  color: #080808;
  padding: 11px 16px;
  font-family: var(--sans); font-size: .85rem; font-weight: 600;
  letter-spacing: .08em;
  cursor: pointer;
  transition: all var(--trans);
  text-transform: uppercase;
}

.admin-form-submit:hover:not(:disabled) {
  background: var(--gold-light);
  border-color: var(--gold-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(201,168,76,.3);
}

.admin-form-submit:active:not(:disabled) {
  transform: translateY(0);
}

.admin-form-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Confirm Modal */
.admin-modal-text {
  font-size: .9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

.admin-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.admin-form-submit--secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.admin-form-submit--secondary:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

/* ── HAMBURGER MENU ───────────────────────────────────────────────────────── */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 8px;
  transition: all var(--trans);
}

.hamburger-btn:hover {
  border-color: var(--gold);
}

.hamburger-btn .hamburger-line {
  width: 18px;
  height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: all var(--trans);
}

.hamburger-btn:hover .hamburger-line {
  background: var(--text);
}

.hamburger-btn.admin-logged .hamburger-line {
  background: #4CAF50;
}

.hamburger-btn.admin-logged:hover .hamburger-line {
  background: #66bb6a;
}

.hamburger-btn[aria-expanded="true"] .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-btn[aria-expanded="true"] .hamburger-line:nth-child(2) {
  opacity: 0;
}

.hamburger-btn[aria-expanded="true"] .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

.hamburger-menu {
  display: none;
  position: fixed;
  top: 56px;
  left: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  z-index: 1150;
  box-shadow: var(--shadow);
}

.hamburger-menu.open {
  display: block;
  animation: fadeUp .2s ease;
}

.hamburger-menu-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
}

/* Hamburger action buttons (unified style for all buttons in menu) */
.hamburger-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--trans);
  padding: 0;
  text-decoration: none;
}

.hamburger-action-btn:hover {
  border-color: var(--gold);
  color: var(--text);
  background: rgba(201,168,76,.08);
}

/* Theme toggle sun/moon icons */
.hamburger-action-btn .sun,
.hamburger-action-btn .moon {
  color: var(--text-muted);
  transition: color var(--trans);
}

.hamburger-action-btn:hover .sun,
.hamburger-action-btn:hover .moon {
  color: var(--text);
}

.hamburger-action-btn .sun { display: block; }
.hamburger-action-btn .moon { display: none; }

body.light-theme .hamburger-action-btn .sun { display: none; }
body.light-theme .hamburger-action-btn .moon { display: block; }

/* Hamburger Language Dropdown */
.hamburger-lang-dropdown {
  position: relative;
}

.hamburger-lang-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 0;
  overflow: hidden;
}

.hamburger-lang-btn img {
  width: 24px;
  height: 16px;
  object-fit: cover;
  border-radius: 2px;
}

.hamburger-lang-btn:hover {
  border-color: var(--gold);
}

.hamburger-lang-menu {
  display: none;
  position: absolute;
  top: -12rem;
  left: calc(100% + 8px);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 140px;
  max-height: 280px;
  z-index: 1200;
  overflow-y: auto;
}

.hamburger-lang-dropdown.admin-logged .hamburger-lang-menu {
  top: -15rem;
}

.hamburger-lang-menu.open {
  display: block;
  animation: fadeUp .18s ease both;
}

.hamburger-lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: .8rem;
  color: var(--text-muted);
  transition: background var(--trans), color var(--trans);
}

.hamburger-lang-option:hover {
  background: rgba(201,168,76,.08);
  color: var(--text);
}

.hamburger-lang-option.active {
  color: var(--gold-light);
  background: rgba(201,168,76,.12);
}

.hamburger-lang-option img {
  width: 20px;
  height: 14px;
  border-radius: 2px;
  object-fit: cover;
}

/* Hamburger sempre visibile */
.hamburger-btn {
  display: flex;
}

@media (max-width: 768px) {
  #footer {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .footer-content {
    flex-direction: column;
    gap: 12px;
  }

  .admin-modal-content {
    padding: 32px 24px;
  }
}

/* FLAGS */
.country-flag-icon {
  width: 20px;
  height: 14px;
  object-fit: cover;
  margin-right: 10px;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  vertical-align: middle;
  flex-shrink: 0;
}
.active .country-flag-icon {
  box-shadow: 0 0 5px rgba(201, 164, 74, 0.5);
}
#country-btn-label .country-flag-icon {
  margin-right: 8px;
  margin-top: -2px;
}