/*!
 * Don Geppi Restaurant - Sidebar Styles
 * Copyright (c) 2025 Manolo De Angelis - Mdaweb
 * All rights reserved.
 */

/* ========================================
   VARIABILI GLOBALI
   ======================================== */
:root {
  --nero: #000000;
  --nero60: rgba(0, 0, 0, 0.6);
  --nero33: #333333;
  --bianco: #ffffff;
  --transition-speed: 0.3s;
}
 
/* ========================================
   SIDEBAR DESKTOP
   ======================================== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 140px;
  height: 100vh;
  background-color: transparent;
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  z-index: 1000;
  color: var(--bianco);
  transition: background-color var(--transition-speed) ease, 
              color var(--transition-speed) ease;
}

/* Cambia stato allo scroll */
.sidebar.scrolled {
  background-color: var(--bianco);
  color: var(--nero);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

/* ========================================
   SEZIONI SIDEBAR DESKTOP
   ======================================== */
.sidebar-section {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 0;
  font-family: 'Julius', sans-serif;
}

.sidebar-center-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex-grow: 1;
}

/* ========================================
   HAMBURGER
   ======================================== */
.hamburger {
  background: none;
  border: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
  cursor: pointer;
}

.hamburger .line {
  width: 36px;
  height: 1px;
  background-color: var(--bianco);
  transition: background-color var(--transition-speed) ease, 
              width var(--transition-speed) ease;
}

.hamburger .line-short {
  width: 20px;
}

.hamburger:hover .line-short {
  width: 36px;
}

/* Linee scure quando scrollato */
.sidebar.scrolled .hamburger .line,
body.scrolled .hamburger .line,
html.scrolled .hamburger .line {
  background-color: var(--nero);
}

/* ========================================
   MENU HAMBURGER FULLSCREEN
   ======================================== */
.hamburger-menu-overlay {
  position: fixed;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100vh;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 9998;
  transition: left 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Menu aperto */
.hamburger-menu-overlay.active {
  left: 0;
}

/* Bottone chiusura */
.hamburger-menu-close {
  position: absolute;
  top: 30px;
  right: 30px;
  background: none;
  border: none;
  cursor: pointer;
  width: 40px;
  height: 40px;
  z-index: 9999;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* X di chiusura */
.hamburger-menu-close::before,
.hamburger-menu-close::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 2px;
  background: var(--nero);
  left: 50%;
  top: 50%;
  transform-origin: center;
}

.hamburger-menu-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.hamburger-menu-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* Contenuto menu */
.hamburger-menu-content {
  padding: 100px 40px 40px 40px;
  min-height: calc(100vh - 160px);
}

/* Body con menu aperto */
body.menu-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

/* ========================================
   HAMBURGER RESPONSIVE MOBILE
   ======================================== */
@media (max-width: 768px) {
  /* Hamburger ridotto su mobile (già esistente, lo mantengo) */
  .hamburger .line {
    width: 26px;
    height: 1px;
  }
  
  .hamburger .line-short {
    width: 14px;
  }
  
  .hamburger:hover .line-short {
    width: 26px;
  }
  
  /* Menu fullscreen mobile */
  .hamburger-menu-content {
    padding: 80px 20px 20px 20px;
  }
  
  .hamburger-menu-close {
    top: 25px;
    right: 25px;
    width: 35px;
    height: 35px;
  }
  
  .hamburger-menu-close::before,
  .hamburger-menu-close::after {
    width: 20px;
  }
}

/* ========================================
   LOGO
   ======================================== */
.logo-img {
  max-width: 110px;
  width: 100%;
  height: auto;
  margin: 30px auto;
  display: block;
  transition: opacity var(--transition-speed) ease;
}

/* ========================================
   MENU LINGUA - STILI BASE
   ======================================== */
.sidebar-lang {
  position: relative;
  z-index: 1001;
}

.language-selector {
  position: relative;
  display: inline-block;
}

.current-lang {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 10px 10px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition-speed) ease;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

.current-lang:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
}

.current-lang .arrow-icon {
  transition: transform var(--transition-speed) ease;
  width: 8px;
  height: 8px;
}

.language-selector.open .arrow-icon {
  transform: rotate(90deg);
}

/* ========================================
   MENU LINGUA - DROPDOWN DESKTOP
   ======================================== */
.language-menu {
  position: absolute;
  left: 100%;
  top: -6px;
  transform: none;
  margin-left: 10px;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 4px;
  display: none;
  flex-direction: row;
  align-items: center;
  gap: 2px;
  z-index: 9999;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  opacity: 0;
  visibility: hidden;
  min-height: 40px;
  font-family: 'Julius', sans-serif;
}

/* IMPORTANTE: Mostra il menu quando open */
.language-selector.open .language-menu {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.lang-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 13px;
  font-family: 'Julius', sans-serif;
  font-weight: 500;
  transition: all 0.2s ease;
  border-radius: 4px;
  min-width: 35px;
}

.lang-option:hover {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

.lang-option.active {
  color: white;
  background: rgba(255, 255, 255, 0.2);
  font-weight: 600;
}

/* ========================================
   MENU LINGUA - STATO SCROLLED (BIANCO)
   ======================================== */
.sidebar.scrolled .current-lang,
body.scrolled .current-lang,
html.scrolled .current-lang {
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.2);
  color: var(--nero33);
  font-family: 'Julius', sans-serif;
}

.sidebar.scrolled .current-lang:hover,
body.scrolled .current-lang:hover,
html.scrolled .current-lang:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.3);
}

.sidebar.scrolled .arrow-icon path,
body.scrolled .arrow-icon path,
html.scrolled .arrow-icon path {
  stroke: var(--nero33);
}

.sidebar.scrolled .language-menu,
body.scrolled .language-menu,
html.scrolled .language-menu {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.sidebar.scrolled .lang-option,
body.scrolled .lang-option,
html.scrolled .lang-option {
  color: rgba(0, 0, 0, 0.7);
}

.sidebar.scrolled .lang-option:hover,
body.scrolled .lang-option:hover,
html.scrolled .lang-option:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--nero);
}

.sidebar.scrolled .lang-option.active,
body.scrolled .lang-option.active,
html.scrolled .lang-option.active {
  color: var(--nero);
  background: rgba(0, 0, 0, 0.12);
  font-weight: 600;
}

/* ========================================
   SOCIAL ICONS
   ======================================== */
.sidebar-social {
  margin-bottom: 80px;
}

.social-bar {
  display: flex;
  gap: 5px;
  justify-content: center;
  padding: 8px 0;
}

.social-bar a {
  color: currentColor;
  font-size: 16px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: opacity var(--transition-speed) ease;
}

.social-bar a:hover {
  opacity: 0.7;
}

.social-bar .icon {
  width: 16px;
  height: 16px;
}

/* Social icons quando scrollato */
.sidebar.scrolled .social-bar .social svg,
body.scrolled .sidebar .social-bar .social svg,
html.scrolled .sidebar .social-bar .social svg {
  color: var(--nero33);
}

.sidebar.scrolled .social-bar .social:hover svg,
body.scrolled .sidebar .social-bar .social:hover svg,
html.scrolled .sidebar .social-bar .social:hover svg {
  color: var(--nero);
}

/* ========================================
   CONTROLLI DESKTOP
   ======================================== */
.controls {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 999;
  font-family: 'Julius', sans-serif;
}

.controls .book-link {
  padding: 12px 20px;
  text-decoration: none;
  color: var(--bianco);
  font-size: 14px;
  transition: all var(--transition-speed) ease;
  font-family: 'Julius', sans-serif;
}

.controls .book-link:hover {
  opacity: 0.9;
}

.controls .book-primary {
  background-color: rgba(255, 255, 255, 0.65);
  color: var(--nero);
  border-radius: 4px;
}

.controls .volume-toggle {
  background: transparent;
  border: none;
  color: var(--bianco);
  cursor: pointer;
  padding: 8px;
  transition: opacity var(--transition-speed) ease;
}

.controls .volume-toggle:hover {
  opacity: 0.8;
}

/* ========================================
   SCROLLBAR PERSONALIZZATA
   ======================================== */
.language-menu::-webkit-scrollbar {
  height: 3px;
}

.language-menu::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.language-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 10px;
}

/* ========================================
   RESPONSIVE MOBILE
   ======================================== */
@media (max-width: 768px) {
  .sidebar {
    flex-direction: row;
    width: 100%;
    height: 90px;
    padding: 0;
    align-items: center;
    justify-content: space-between;
    background-color: transparent;
    color: var(--bianco);
  }
  
  .sidebar.scrolled {
    background-color: var(--bianco);
    color: var(--nero);
  }
  
  /* Sezioni hamburger e lang */
  .sidebar-section.sidebar-hamburger,
  .sidebar-section.sidebar-lang {
    flex: 0 0 100px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
  }
  
  /* Rimuovi bordo dal pulsante su mobile */
  .current-lang {
    font-family: 'Julius', sans-serif;
    border: none !important;
    background: transparent !important;
    padding: 8px !important;
    -webkit-tap-highlight-color: transparent !important;
    touch-action: manipulation !important;
  }
  
  .current-lang:hover {
    background: transparent !important;
    border: none !important;
  }
  
  /* Nascondi freccia su mobile */
  .current-lang .arrow-icon {
    display: none;
  }
  
  /* Wrapper centrale */
  .sidebar-center-wrapper {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 10px;
  }
  
  /* Logo più piccolo mobile */
  .logo-img {
    max-width: 75px;
    margin: 0 auto;
  }
  
  /* ========================================
     MENU LINGUA MOBILE - VERTICALE E CENTRATO
     ======================================== */
  .sidebar-lang {
    position: static;
  }
  
  .language-menu {
    position: fixed !important;
    left: auto !important;
    right: 25px !important;
    top: 65px !important;
    transform: none !important;
    margin: 0 !important;
    flex-direction: column !important;
    align-items: center !important; /* CENTRA GLI ELEMENTI */
    width: 45px !important;
    padding: 0px !important;
    gap: 0px !important;
    background: rgba(0, 0, 0, 0.2) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 0px !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4) !important;
    overflow: hidden;
  }
  
  /* Opzioni lingua CENTRATE su mobile */
  .lang-option {
    display: flex !important; /* Assicura che sia flex */
    width: 100% !important;
    padding: 12px 0 !important; /* Padding solo verticale */
    justify-content: center !important; /* CENTRA IL TESTO */
    align-items: center !important; /* CENTRA VERTICALMENTE */
    text-align: center !important; /* CENTRA IL TESTO */
    border-radius: 0px !important; /* Mantieni il tuo border-radius */
    font-size: 14px !important;
    color: rgba(255, 255, 255, 0.9) !important;
    transition: all 0.2s ease !important;
    box-sizing: border-box !important;
  }
  
  .lang-option:hover,
  .lang-option:active {
    background: rgba(255, 255, 255, 0.12) !important;
    color: white !important;
    transform: none !important; /* Rimuovi translateX */
  }
  
  .lang-option.active {
    background: rgba(255, 255, 255, 0.18) !important;
    color: white !important;
    font-weight: 600 !important;
  }
  
  /* Menu bianco quando scrollato su mobile */
  .sidebar.scrolled .language-menu,
  body.scrolled .language-menu {
    background: rgba(255, 255, 255, 0.96) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12) !important;
  }
  
  .sidebar.scrolled .lang-option,
  body.scrolled .lang-option {
    color: rgba(0, 0, 0, 0.8) !important;
  }
  
  .sidebar.scrolled .lang-option:hover,
  .sidebar.scrolled .lang-option:active,
  body.scrolled .lang-option:hover,
  body.scrolled .lang-option:active {
    background: rgba(0, 0, 0, 0.06) !important;
    color: black !important;
  }
  
  .sidebar.scrolled .lang-option.active,
  body.scrolled .lang-option.active {
    background: rgba(0, 0, 0, 0.1) !important;
    color: black !important;
  }
  
  /* Nascondi elementi desktop su mobile */
  .social-bar {
    display: none;
  }
  
  .controls.no-mobile {
    display: none;
  }
  
  /* Hamburger ridotto */
  .hamburger .line {
    width: 26px;
    height: 1px;
  }
  
  .hamburger .line-short {
    width: 14px;
  }
  
  .hamburger:hover .line-short {
    width: 26px;
  }
}

/* ========================================
   ANIMAZIONI MENU LINGUA
   ======================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.language-selector.open .language-menu {
  animation: fadeIn 0.3s ease forwards;
}

/* Animazione staggered per ogni lingua */
.language-selector.open .lang-option:nth-child(1) { animation: fadeIn 0.3s ease 0.05s both; }
.language-selector.open .lang-option:nth-child(2) { animation: fadeIn 0.3s ease 0.1s both; }
.language-selector.open .lang-option:nth-child(3) { animation: fadeIn 0.3s ease 0.15s both; }
.language-selector.open .lang-option:nth-child(4) { animation: fadeIn 0.3s ease 0.2s both; }
.language-selector.open .lang-option:nth-child(5) { animation: fadeIn 0.3s ease 0.25s both; }
.language-selector.open .lang-option:nth-child(6) { animation: fadeIn 0.3s ease 0.3s both; }
.language-selector.open .lang-option:nth-child(7) { animation: fadeIn 0.3s ease 0.35s both; }

/* FIX IMPORTANTE: Assicura che il menu sia visibile quando open */
.language-selector.open .language-menu {
  opacity: 1 !important;
  visibility: visible !important;
}