/* ============================================
   PAGE LOADING - Splash Screen
   ============================================ */
html, body {
  background: #f5f5f7 !important;
  min-height: 100%;
}

/* Splash screen loader */
.page-loader {
  position: fixed;
  inset: 0;
  background: #f5f5f7;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s ease-out, visibility 0.3s ease-out;
}
.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.page-loader-logo {
  width: 80px;
  height: 80px;
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.2));
  animation: pulse-logo 1.5s ease-in-out infinite;
}
@keyframes pulse-logo {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.9; }
}
.page-loader-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(201, 33, 39, 0.2);
  border-top-color: #c92127;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.page-loader-text {
  color: #86868b;
  font-family: 'Montserrat', Arial, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 1rem;
  letter-spacing: 0.02em;
}

/* Contenuto nascosto finché non pronto */
body:not(.page-ready) > *:not(.page-loader) {
  opacity: 0;
}
body.page-ready {
  background: #f5f5f7;
}
body.page-ready > *:not(.page-loader) {
  opacity: 1;
}

/* ============================================
   HEADER & NAV STYLES
   ============================================ */
header {
  background: linear-gradient(135deg, #ed213a 0%, #93291e 100%);
  color: white;
  padding: 0.9rem 0 0.85rem 0;
  text-align: center;
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.12);
  position: relative;
}
.hero-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.4rem;
  padding-bottom: 0.1rem;
}
.hero-wrap img {
  height: clamp(52px, 10vw, 92px);
  width: auto;
  vertical-align: middle;
  display: inline-block;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.18));
  transition: transform 0.3s ease, filter 0.3s ease;
}
.hero-wrap a:hover img {
  transform: scale(1.05);
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.25));
}
.brand-title {
  margin: 0;
  font-size: clamp(1rem, 2.8vw, 1.8rem);
  font-weight: 900;
  letter-spacing: 0.015em;
  line-height: 1.1;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.08);
}
.brand-subtitle {
  margin: 0.22rem 0 0 0;
  font-size: clamp(0.8rem, 1.6vw, 0.95rem);
  font-weight: 600;
  opacity: 0.97;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.mobile-break {
  display: none;
}
@media (max-width: 600px) {
  header { padding: 0.5rem 0 0.35rem 0; }
  .hero-wrap { gap: 0.6rem; padding-bottom: 0; }
  .hero-wrap img { 
    height: 48px;
    filter: drop-shadow(0 3px 8px rgba(0,0,0,0.16)); 
  }
  .hero-wrap a:hover img { transform: none; filter: drop-shadow(0 3px 8px rgba(0,0,0,0.16)); }
  .brand-title { font-size: clamp(0.85rem, 4vw, 1.3rem); }
  .brand-subtitle { font-size: clamp(0.65rem, 2.5vw, 0.85rem); }
  .mobile-break { display: inline; }
}

nav.primary {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(236, 238, 243, 0.8);
  box-shadow: 0 2px 12px rgba(31,38,135,0.08);
}
.nav-bar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  gap: 1rem;
}
.menu { display: flex; gap: 0.4rem; align-items: center; }
.menu > li { list-style: none; position: relative; }
.menu > li > a {
  display: block;
  padding: 0.52rem 0.85rem;
  border-radius: 10px;
  color: #0f1726;
  text-decoration: none;
  font-weight: 700;
  position: relative;
  overflow: hidden;
}
.menu > li > a::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #f4f6fb, #e8ebf3);
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: -1;
}
.menu > li > a:hover::before { opacity: 1; }
.menu > li > a:hover { transform: translateY(-1px); }
.menu > li > a.active { 
  background: linear-gradient(135deg, #93291e, #b43429); 
  color: #fff !important; 
  pointer-events: none; 
  box-shadow: 0 4px 12px rgba(147, 41, 30, 0.3);
}

/* Bottom nav */
.bottom-nav { display: none; }
@media (max-width: 600px) {
  nav.primary { display: none; }
  .bottom-nav {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 2px solid rgba(237, 33, 58, 0.15);
    box-shadow: 0 -4px 16px rgba(31,38,135,0.08);
    z-index: 100;
    height: 56px;
    justify-content: space-around;
    align-items: stretch;
    font-family: 'Montserrat', Arial, sans-serif;
  }
  .bottom-nav a {
    flex: 1 1 33%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #93291e;
    font-size: clamp(0.78rem, 3.5vw, 0.95rem);
    font-weight: 700;
    padding: 2px 0 0 0;
    transition: all 0.2s ease;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  .bottom-nav a::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #93291e, #b43429);
    opacity: 0;
    transition: opacity 0.25s ease;
    border-top-left-radius: 13px;
    border-top-right-radius: 13px;
  }
  .bottom-nav a.active::before {
    opacity: 1;
  }
  .bottom-nav a.active {
    color: #fff !important;
  }
  .bottom-nav a.active i {
    transform: scale(1.1);
  }
  .bottom-nav i {
    font-size: clamp(1.05em, 4.8vw, 1.3em);
    margin-bottom: 1px;
    display: block;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
  }
  .bottom-nav span {
    position: relative;
    z-index: 1;
  }
  body { 
    padding-bottom: 0;
  }
}

@media (min-width: 769px) {
  body {
    padding-bottom: 0 !important;
  }
}

/* Footer disclaimer */
footer.disclaimer {
  text-align: center;
  padding: 0.5rem 1rem;
  margin-top: 0.8rem;
  border-top: 1px solid rgba(147, 41, 30, 0.1);
  background: rgba(248, 249, 251, 0.5);
  color: #666;
}

footer.disclaimer .disclaimer-title {
  font-size: clamp(0.85rem, 2vw, 1rem);
  margin-bottom: 0.3rem;
}

footer.disclaimer strong {
  color: #93291e;
  font-weight: 700;
}

footer.disclaimer .disclaimer-line {
  font-size: clamp(0.55rem, 1.8vw, 0.85rem);
  white-space: nowrap;
  padding: 0 0.3rem;
  margin: 0.12rem 0;
  overflow: visible;
}

@media (max-width: 768px) {
  footer.disclaimer {
    margin-bottom: 60px; /* Spazio per bottom-nav */
    margin-top: 1rem;
    padding: 0.5rem;
  }
}

/* Solo su schermi molto piccoli permetti a capo */
@media (max-width: 374px) {
  footer.disclaimer .disclaimer-line {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    font-size: 0.58rem;
    line-height: 1.35;
  }
}
