/* RESET GLOBALE */
body {
  background-color: #f2f2f7; 
  margin: 0;
}

/* NAVBAR */
.navbar {
  background-color: rgba(255, 255, 255, 0.85) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(60, 60, 67, 0.1) !important;
  position: sticky !important; 
  top: 0;
  z-index: 100;
}

.navbar .navContainer {
  display: flex;
  align-items: center;
  position: relative;
  height: 60px;
}

.navbar .langSwitch {
  display: flex !important;
  position: absolute !important;
  right: 20px;
  background: #e5e5ea !important;
  padding: 4px !important;
  border-radius: 20px !important;
  border: 1px solid #d1d1d6 !important;
  gap: 0 !important;
}

.navbar .langBtn {
  background: transparent !important;
  border: none !important;
  padding: 6px 14px !important;
  border-radius: 16px !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  color: #8e8e93 !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.navbar .langBtn.active {
  background: #5856d6 !important;
  color: #ffffff !important; 
  box-shadow: 0 4px 10px rgba(88, 86, 214, 0.25) !important; 
}

.navbar .navLinks {
  margin: 0 !important;
  padding: 0 !important;
  display: flex;
  list-style: none;
  position: absolute !important;
  left: 20px;
  border: none !important;
  width: auto !important;
}

.navbar .navLinks a {
  color: #1d1d1f;
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s ease;
  padding: 0 !important;
}

.navbar .navLinks a:hover {
  opacity: 0.6;
  color: #5856d6;
}

.navLinks a::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: #5856d6;
    transform: scaleX(0);
    transform-origin: bottom right;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.navbar .logo {
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%) !important;
  font-weight: 700;
  font-size: 1.2rem;
  color: #1c1c1e !important;
  margin: 0 !important;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
  order: unset !important;
}

.navbar .logo-accent {
  color: #5856d6 !important;
  transition: all 0.3s ease;
}

.navbar .logo:hover {
  color: #1c1c1e !important;
  transform: translate(-50%, calc(-50% - 2px)) scale(1.02) !important;
  box-shadow: none !important;
  text-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
}

.navbar .logo:hover .logo-accent {
  color: #5856d6 !important;
  text-shadow: 0 4px 12px color-mix(in srgb, #5856d6 50%, transparent);
}

/* LAYOUT WEBAPP */
.poloContainer {
  color: #1c1c1e;
  max-width: 600px;
  margin: 0 auto;
  padding: 32px 20px 80px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.headerSection h1 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 0;
  color: #000;
}

.headerSection {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 32px;
}

/* CONTROLLI E TABS */
.datePickerMock {
  display: flex;
  gap: 10px;
  flex-wrap: wrap; 
}

#dateSelector {
  flex: 2;
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  background-color: #e5e5ea;
  font-family: inherit;
  font-size: 15px;
  color: #1c1c1e;
  outline: none;
}

.datePickerMock button {
  flex: 1;
  background-color: #5856d6;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 12px 16px; 
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.datePickerMock button:active { 
  transform: scale(0.96); 
}

.datePickerMock button:hover { 
  background-color: #4644b8; 
}

.tabs {
  display: flex;
  background: #e5e5ea;
  border-radius: 9px;
  padding: 3px;
}

.tabBtn {
  flex: 1;
  padding: 6px 8px;
  border: none;
  background: transparent;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  color: #1c1c1e;
  transition: all 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.tabBtn.active {
  background: white;
  box-shadow: 0 3px 8px rgba(0,0,0,0.12), 0 1px 1px rgba(0,0,0,0.04);
}

#searchInput {
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  background-color: #e5e5ea;
  font-size: 16px;
  color: #1c1c1e;
  outline: none;
  transition: background-color 0.2s;
}

#searchInput:focus { background-color: #d1d1d6; }
#searchInput::placeholder { color: #8e8e93; }

/* LISTA E CARDS */
.listContainer {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: #ffffff; 
  border-radius: 16px;
  padding: 20px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03); 
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.hidden { display: none !important; }

.sectionHeader {
  font-weight: bold;
  font-size: 1.1rem;
  color: #666;
  margin-top: 10px;
  margin-bottom: -4px;
  padding-left: 4px;
}

/* --- ANIMAZIONE ESPANSIONE CARDS --- */
.expandableContent {
  display: grid;
  grid-template-rows: 0fr; 
  transition: grid-template-rows 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

.expandableContent.expanded {
  grid-template-rows: 1fr; 
}

.expandableInner {
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

.expandableContent.expanded .expandableInner {
  opacity: 1;
  transform: translateY(0); 
  padding-top: 4px; 
}

/* MAPPA MODALE */
.map-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.map-modal-content {
  background: #fff;
  width: 90%;
  max-width: 600px;
  height: 80vh;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  position: relative;
}

.map-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: #f8f8f8;
  border-bottom: 1px solid #eee;
}

.close-btn {
  background: #e5e5ea;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-weight: bold;
  cursor: pointer;
  color: #333;
}

#mapIframe {
  flex: 1;
  width: 100%;
}

.modalMiniMap {
  position: absolute !important;
  bottom: 16px;
  left: 16px;
  z-index: 10;
  background: rgba(44, 44, 46, 0.75) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 8px !important;
  border-radius: 16px !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  width: 85px;
  height: auto;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.modalMiniMap img {
  width: 100%;
  height: auto;
  display: block;
  max-height: none !important;
}

.modalMiniMap:hover {
  transform: scale(1.04);
  background: rgba(44, 44, 46, 0.85) !important;
}

.modalMiniMap.expanded {
  width: 160px;
  padding: 12px !important;
  background: rgba(44, 44, 46, 0.95) !important;
}

#mapTitle {
  color: #000000;
}


/* EXTRA E CREDITI */
.ndoExtras {
  text-align: center;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid rgba(60, 60, 67, 0.15);
}

.installBtn {
  background: #1c1c1e;
  color: white;
  border: none;
  padding: 14px 28px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  margin-bottom: 16px;
  transition: transform 0.2s ease, background 0.2s ease;
}

.installBtn:active {
  transform: scale(0.95);
  background: #333;
}

.creditsText {
  font-size: 13px;
  color: #8e8e93;
  line-height: 1.4;
}

.creditsText a {
  color: #5856d6;
  text-decoration: none;
  font-weight: 600;
}

/* NOTIFICHE TOAST */
.ndo-toast {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 30, 30, 0.85) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #ffffff !important;
  padding: 14px 20px;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 2000;
  width: 90%;
  max-width: 400px;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
  transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.25);
  pointer-events: none;
}

.ndo-toast.show {
  bottom: 32px;
}

/* MEDIA QUERIES */
@media (max-width: 767px) {
  .navbar .navLinks {
    left: 15px !important;
  }
  
  .navbar .navLinks a {
    font-size: 0 !important; 
  }
  
  .navbar .navLinks a::before {
    content: "← Home";
    font-size: 1rem;
    color: #5856d6;
  }

  .navbar .logo {
    font-size: 1.1rem !important;
  }

  .poloContainer {
    padding: 20px 15px 80px;
  }

  .headerSection h1 {
    font-size: 1.8rem;
  }

  #dateSelector {
    flex: 1 1 100% !important;
  }

  .datePickerMock button {
    flex: 1 !important;
  }

  .navbar .langSwitch {
    right: 10px !important;
    transform: scale(0.85);
    transform-origin: right center;
  }
}

/* DARK MODE */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #000000;
  }

  .navbar {
    background-color: rgba(28, 28, 30, 0.85) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
  }

  .navbar .logo {
    color: #ffffff !important;
  }

  .navbar .logo:hover {
    color: #ffffff !important;
  }

  .navbar .navLinks a {
    color: #e5e5ea !important;
  }

  .navbar .navLinks a:hover {
    color: #5856d6 !important;
  }

  .navbar .langSwitch {
    background: #2c2c2e !important;
    border: 1px solid #3a3a3c !important;
  }

  .navbar .langBtn {
    color: #8e8e93 !important;
  }

  .navbar .langBtn.active {
    background: #5856d6 !important;
    color: #ffffff !important;
  }

  .poloContainer {
    color: #f2f2f7;
  }

  .headerSection h1,
  #mapTitle {
    color: #ffffff;
  }

  #dateSelector,
  #searchInput,
  .tabs {
    background-color: #1c1c1e;
    color: #ffffff;
  }

  #searchInput:focus { 
    background-color: #2c2c2e; 
  }

  .tabBtn {
    color: #a1a1a6;
  }

  .tabBtn.active {
    background: #3a3a3c;
    color: #ffffff;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
  }

  #lezioniFilters {
    background: #1c1c1e !important;
    color: #ffffff;
  }

  .card {
    background: #1c1c1e;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  }

  .card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  }

  .card h3 {
    color: #ffffff !important;
  }

  .card .room-title span {
    color: #e5e5ea !important; 
  }

  .card div[style*="color: gray"], 
  .card div[style*="color: #333"] {
    color: #8e8e93 !important;
  }

  .map-modal-content {
    background: #1c1c1e;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  }

  .map-header {
    background: #2c2c2e;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .close-btn {
    background: #3a3a3c;
    color: #ffffff;
  }

  .ndoExtras {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .installBtn {
    background: #f2f2f7;
    color: #000000;
  }

  .installBtn:active {
    background: #c7c7cc;
  }

  .creditsText {
    color: #636366;
  }

  .card span[style*="background: rgba(0, 128, 0, 0.15)"] {
    background: rgba(48, 209, 88, 0.2) !important;
    color: #32d74b !important;
  }
}

/* PWA STANDALONE MODE */
@media (display-mode: standalone) {
  .navbar .navLinks {
    display: none !important;
  }
  
  @media (max-width: 767px) {
    .navbar .logo {
      left: 50% !important;
      transform: translate(-50%, -50%) !important;
    }
  }

  #installAppBtn {
    display: none !important;
  }
}