/*
 * NAVBAR STYLES
 * Gestione navigazione, stati scroll, switch logo e menu mobile
 */

/* --- 1. Navbar Container & Base --- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;

  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;

  padding: 1.25rem 0rem 1.25rem 0rem;
  background-color: transparent;
  border-bottom: 1px solid transparent;

  /* Stato iniziale (nascosto) */
  transform: translateY(-100%);
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), padding 0.5s ease, background-color 0.5s ease;
}

@media (min-width: 375px) {
  .navbar {
    padding: 1.25rem 1.5rem 1.25rem 0rem;
  }
}

/* Stato Visibile (Trigger JS) */
.navbar.navbar-visible {
  transform: translateY(0);
}

/* --- 2. Scrolled State (Effetto Vetro) --- */
.navbar.scrolled {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: none;
}

/* Background sfocato su pseudo-elemento */
.navbar.scrolled::before {
  content: "";
  position: absolute;
  inset: 0; /* top/left/right/bottom: 0 */
  z-index: -1;

  background-color: rgba(230, 222, 209, 0.4);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

@media (min-width: 768px) {
  .navbar.scrolled::before {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(62, 52, 43, 0.05);
  }
}

/* --- 3. Logo Management --- */
.nav-logo-container {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  min-width: 135px;
  height: 60px;
}

.nav-logo-container:hover {
  opacity: 0.8;
}

/* Transizione tra Square e Wide Logo */
.logo-wrapper {
  position: absolute;
  transition: all 0.4s ease-in-out;
  opacity: 0;
  transform: scale(0.9);
  filter: blur(8px);
  pointer-events: none;
}

.logo-wrapper.active {
  opacity: 1;
  transform: scale(1);
  filter: blur(0px);
  pointer-events: auto;
}

/* --- 4. Desktop Navigation ( > 768px) --- */
.nav-links,
.nav-cta-wrapper {
  display: none; /* Default hidden on mobile */
}

@media (min-width: 768px) {
  .nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-left: auto;
    margin-right: 1rem;
  }

  .nav-cta-wrapper {
    display: flex;
    width: fit-content;
    /* margin-left: 40px; */
    justify-content: flex-end;
    
  }

  /* Nascondi elementi mobile */
  .mobile-menu-dropdown,
  .mobile-menu-icon {
    display: none !important;
  }
}

@media (min-width: 1024px) {
  .nav-links {
    gap: 2rem;
    margin-right: 2rem;
  }
  .nav-cta-wrapper {
    margin-left: 40px;
  }
}

/* Link Styles */
.nav-link {
  font-family: var(--font-secondary);
  color: var(--color-brand-brown);
  font-size: 1.125rem;
  font-weight: 500;
  text-decoration: none;
  position: relative;
}

/* Underline Hover Effect */
.nav-link::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: #7a9939;
  transition: width 0.3s ease;
}

.nav-link.active::after {
  width: 100%;
}

.nav-link:hover::after {
  width: 100%;
}

/* CTA Button (Prenota Ora) */
.cta-button {
  /* Stato iniziale */
  opacity: 0;
  transform: scale(0.9);
  filter: blur(8px);
  pointer-events: none;

  /* Layout */
  padding: 0.5rem 1rem 0.6rem 1rem;
  background-color: #7a9939;
  color: var(--color-bg-beige);
  font-family: var(--font-primary);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: -0.15em;
  border-radius: 9999px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  text-decoration: none;
  white-space: nowrap;

  transition: all 0.4s ease-in-out;
}

.cta-button:hover {
  background-color: var(--color-brand-brown);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.cta-button.visible {
  opacity: 1;
  transform: scale(1);
  filter: blur(0px);
  pointer-events: auto;
}

/* --- 5. Mobile Menu (Burger & Dropdown) --- */
.mobile-menu-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-brand-brown);
  /* margin-left: 1rem; */
  cursor: pointer;
  z-index: 101;
}

/* From Uiverse.io by JulanDeAlb */
.hamburger {
  cursor: pointer;
}

.hamburger input {
  display: none;
}

.hamburger svg {
  /* The size of the SVG defines the overall size */
  height: 3em;
  /* Define the transition for transforming the SVG */
  transition: transform 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

.line {
  fill: none;
  stroke: var(--color-brand-brown);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
  /* Define the transition for transforming the Stroke */
  transition: stroke-dasharray 600ms cubic-bezier(0.4, 0, 0.2, 1), stroke-dashoffset 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

.line-top-bottom {
  stroke-dasharray: 12 63;
}

.hamburger input:checked + svg {
  transform: rotate(-45deg);
}

.hamburger input:checked + svg .line-top-bottom {
  stroke-dasharray: 20 300;
  stroke-dashoffset: -32.42;
}

/* Container Dropdown con Grid Animation */
.mobile-menu-dropdown {
  display: grid;
  grid-template-rows: 0fr; /* Chiuso */
  width: 100%;
  flex-basis: 100%;
  z-index: 90;
  border-bottom: 0px solid transparent;

  transition: grid-template-rows 0.6s cubic-bezier(0.16, 1, 0.3, 1), border-bottom 0.3s ease;
}

.mobile-menu-dropdown.open {
  grid-template-rows: 1fr; /* Aperto */
  /* Opzionale: aggiungere border-bottom qui se desiderato */
}

/* Wrapper Interno per contenuto Grid */
.mobile-links-wrapper {
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Il padding verticale va gestito qui per non essere tagliato */
  /* padding-bottom: 1rem; */
  gap: 1rem;
}

/* Link Mobile */
.mobile-link {
  font-family: var(--font-secondary);
  color: var(--color-brand-brown);
  font-size: 1.25rem;
  text-decoration: none;
  font-weight: 500;

  /* Stato iniziale animazione */
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.mobile-link.highlight {
  color: #7a9939;
  font-weight: 700;
}

/* Animazione Cascata all'apertura */
.mobile-menu-dropdown.open .mobile-link {
  opacity: 1;
  transform: translateY(0);
}

.mobile-menu-dropdown.open .mobile-link:nth-child(1) {
  transition-delay: 0.2s;
}
.mobile-menu-dropdown.open .mobile-link:nth-child(2) {
  transition-delay: 0.3s;
}
.mobile-menu-dropdown.open .mobile-link:nth-child(3) {
  transition-delay: 0.4s;
}
.mobile-menu-dropdown.open .mobile-link:nth-child(4) {
  transition-delay: 0.5s;
}
.mobile-menu-dropdown.open .mobile-link:nth-child(5) {
  transition-delay: 0.6s;
}

/* --- 6. COUNTDOWN STYLES (Nuovo) --- */

/* Base Container */
.nav-countdown {
  display: flex;
  align-items: center;
  line-height: 1;
  cursor: default;
  user-select: none;
}

/* LIVE DOT (Pallino verde che pulsa) */
.live-dot-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.5rem;
}

.live-dot {
  background-color: var(--color-brand-green);
  border-radius: 50%;
  animation: dotPulse 2s infinite;
}

@keyframes dotPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

/* TIME UNITS & LABELS */
.time-unit {
  display: flex;
}

.val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--color-brand-brown);
}

.label {
  font-family: sans-serif;
  text-transform: uppercase;
  color: rgba(62, 52, 43, 0.4); /* Brand brown con opacity */
  letter-spacing: 0.05em;
}

/* SEPARATOR (I due punti che lampeggiano) */
.sep {
  font-family: var(--font-mono);
  font-weight: 700;
  color: rgba(122, 153, 57, 0.6); /* Brand green con opacity */
  margin: 0 2px;
  animation: sepBlink 1s infinite;
}

@keyframes sepBlink {
  0%,
  100% {
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
}

/* --- MOBILE STYLING (Box Vetroso al centro) --- */
.nav-countdown.mobile {
  position: absolute;
  left: 50%;
  top: 28px;
  transform: translate(-50%, 0px);
  z-index: 40;

  /* Effetto Glassmorphism */
  background-color: rgba(230, 222, 209, 0.8); /* Beige semi-trasparente */
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 0.25rem 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(62, 52, 43, 0.1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  gap: 2px;
}

@media (min-width: 768px) {
  .nav-countdown.mobile {
    position: static;
    transform: translate(0, 0);
  }
}

.nav-countdown.mobile .live-dot {
  width: 4px;
  height: 4px;
}

.nav-countdown.mobile .time-unit {
  flex-direction: column; /* Numeri sopra, label sotto */
  align-items: center;
  justify-content: center;
  margin: 0 1px;
}

.nav-countdown.mobile .val {
  font-size: 0.75rem; /* Molto compatto */
  width: 1.25rem;
  text-align: center;
}

.nav-countdown.mobile .label {
  font-size: 0.4rem; /* Micro label */
  margin-top: 1px;
}

.nav-countdown.mobile .sep {
  font-size: 0.6rem;
  margin-top: -0.5rem; /* Allineamento ottico col numero */
}

/* Nascondi Mobile su schermi grandi */
@media (min-width: 1024px) {
  .nav-countdown.mobile {
    display: none;
  }
}

/* --- DESKTOP STYLING (Integrato nella Nav) --- */
.nav-countdown.desktop {
  display: none; /* Nascondi su mobile */
  margin-right: 1.5rem;
  margin-left: 1.5rem;
  gap: 0;
}

@media (min-width: 1024px) {
  .nav-countdown.desktop {
    display: flex;
  }
}

.nav-countdown.desktop .live-dot {
  width: 8px;
  height: 8px;
}

.nav-countdown.desktop .time-unit {
  flex-direction: row; /* Affiancati */
  align-items: baseline;
  gap: 2px;
  margin: 0 4px;
}

.nav-countdown.desktop .val {
  font-size: 1.125rem; /* Più grande e leggibile */
}

.nav-countdown.desktop .label {
  font-size: 0.625rem;
  font-weight: 700;
}

.nav-countdown.desktop .sep {
  font-size: 0.875rem;
  padding-bottom: 2px;
}
