/**
 * Univerbar - Global UX Improvements
 * Stili aggiuntivi per migliorare usabilità mobile e desktop
 */

/* ===== DESIGN TOKENS ===== */
:root {
  --container-max: 1120px;
  --gutter: 24px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --primary: #E30613;
  --text-light: #1A171B;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  --border: 1px solid #e5e7eb;
  --media-ratio: 4 / 5;
  --home-sprint-scale: 0.68;
  --header-height: 72px;
  --header-offset: calc(var(--header-height) + var(--space-4));
}

/* ===== CONTAINER ===== */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  width: 100%;
}

/* ===== GLOBAL LAYOUT ===== */
main {
  padding-top: var(--header-offset, 88px);
}

.section {
  padding: var(--space-12, 48px) 0;
}

main > .mx-auto.max-w-6xl {
  padding-left: var(--gutter);
  padding-right: var(--gutter);
  padding-top: var(--space-6, 24px);
  padding-bottom: var(--space-6, 24px);
}

main > .mx-auto.max-w-6xl:first-child {
  padding-top: 0;
}


/* ===== PRODUCT CARD ===== */
.product-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #f3f4f6;
  border-radius: var(--radius, 12px);
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dark .product-card {
  background: #1a2833;
}

.product-card:hover {
  box-shadow: var(--shadow, 0 10px 30px rgba(0, 0, 0, 0.12));
  transform: translateY(-2px);
}

/* ===== MEDIA BOX ===== */
.media-box {
  aspect-ratio: var(--media-ratio);
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4, 16px);
  overflow: hidden;
  border-radius: var(--radius, 12px);
}

.dark .media-box {
  background: #0f172a;
}

.media-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-hero__media {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.product-card .product-media {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}

.product-card .product-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.is-hidden {
  display: none !important;
}

.product-card__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-3, 12px);
  padding: var(--space-4, 16px);
}

.product-card__text {
  min-height: 110px;
  display: flex;
  flex-direction: column;
  gap: var(--space-2, 8px);
}

.product-card__cta {
  min-height: var(--space-6, 24px);
  display: flex;
  align-items: center;
}

.product-card__cta-placeholder {
  height: var(--space-4, 16px);
  width: 100%;
}

/* ===== LINE TEMPLATE ===== */
.line-hero {
  position: relative;
  min-height: 480px;
  height: 60vh;
  width: 100%;
  overflow: hidden;
  background: #0f172a;
  color: #ffffff;
}

.line-hero--solid {
  background: var(--card-light, #f3f4f6);
  color: var(--text-light, #1A171B);
}

.dark .line-hero--solid {
  background: var(--card-dark, #1a2833);
  color: var(--text-dark, #f5f7f8);
}

.line-hero__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.line-hero__content {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-6, 24px);
  padding: 0 var(--gutter, 24px);
  text-align: center;
}

.line-hero__title {
  font-size: 2.25rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

@media (min-width: 640px) {
  .line-hero__title {
    font-size: 3rem;
  }
}

.line-hero__accent {
  color: var(--primary, #E30613);
}

/* Riga keyword (piano SEO) dentro l'H1, sopra il titolo grafico: usata nelle
   pagine linea e nella hero della home. */
.line-hero__kicker {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.9);
}

@media (min-width: 640px) {
  .line-hero__kicker {
    font-size: 1rem;
  }
}

.line-hero__subtitle {
  max-width: 56rem;
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.9);
}

@media (min-width: 640px) {
  .line-hero__subtitle {
    font-size: 1.125rem;
  }
}

.line-hero--solid .line-hero__subtitle {
  color: rgba(31, 41, 55, 0.7);
}

.dark .line-hero--solid .line-hero__subtitle {
  color: rgba(245, 247, 248, 0.7);
}

.line-section {
  padding: var(--space-12, 48px) 0;
}

.product-grid {
  display: grid;
  gap: var(--space-6, 24px);
  grid-template-columns: repeat(1, minmax(0, 1fr));
  margin-top: var(--space-8, 32px);
}

@media (min-width: 640px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .product-grid--home {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.product-grid--home .media-box {
  padding: var(--space-2, 8px);
  background: #ffffff;
}

.dark .product-grid--home .media-box {
  background: #0f172a;
}

.product-grid--home .product-card--sprint .media-box img {
  transform: scale(var(--home-sprint-scale, 0.68));
  transform-origin: center;
}

.product-grid__filters,
.product-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3, 12px);
  justify-content: center;
}
/* ===== ACCESSORIES GRID ===== */
.accessories-grid {
  display: grid;
  gap: var(--space-8, 32px);
  grid-template-columns: repeat(1, minmax(0, 1fr));
  justify-items: stretch;
}

@media (min-width: 640px) {
  .accessories-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .accessories-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.product-card__placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2, 8px);
  color: #94a3b8;
  text-align: center;
  font-weight: 600;
}

.product-card__placeholder .material-symbols-outlined {
  font-size: 42px;
}
/* ===== TOUCH TARGET IMPROVEMENTS ===== */
/* Assicura che tutti i bottoni e link abbiano touch target adeguati (min 44x44px) */
.touch-target {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ===== MOBILE MENU IMPROVEMENTS ===== */
/* Smooth animation per menu mobile */
#mobile-menu {
  transition: all 0.3s ease-in-out;
  max-height: 0;
  overflow: hidden;
}

#mobile-menu:not(.hidden) {
  max-height: 100vh;
}

/* ===== SCROLL INDICATORS ===== */
/* Indicatore visivo per elementi scrollabili orizzontalmente */
.scroll-indicator {
  position: relative;
}

.scroll-indicator::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 40px;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.9));
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s;
}

.dark .scroll-indicator::after {
  background: linear-gradient(to right, transparent, rgba(16, 27, 34, 0.9));
}

.scroll-indicator.scrolled-end::after {
  opacity: 0;
}

/* ===== FORM IMPROVEMENTS ===== */
/* Stati di validazione form */
.form-input {
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--ub-red, #E30613);
  box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.12);
}

.form-input.error {
  border-color: #ef4444;
}

.form-input.error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-input.success {
  border-color: #10b981;
}

.form-error-message {
  color: #ef4444;
  font-size: 0.875rem;
  margin-top: 0.25rem;
  display: none;
}

.form-input.error ~ .form-error-message {
  display: block;
}

/* Required field indicator */
.required::after {
  content: ' *';
  color: #ef4444;
}

/* ===== LOADING STATES ===== */
/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

.dark .skeleton {
  background: linear-gradient(90deg, #1a2833 25%, #344049 50%, #1a2833 75%);
  background-size: 200% 100%;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Spinner */
.spinner {
  border: 3px solid #f3f4f6;
  border-top-color: var(--ub-red, #E30613);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== LIGHTBOX IMPROVEMENTS ===== */
/* Smooth transitions per lightbox */
#image-lightbox {
  transition: opacity 0.3s ease-in-out;
  backdrop-filter: blur(8px);
}

#image-lightbox.hidden {
  opacity: 0;
  pointer-events: none;
}

#image-lightbox:not(.hidden) {
  opacity: 1;
}

#lightbox-image {
  transition: transform 0.3s ease-in-out;
}

/* ===== IMPROVED SCROLLBAR ===== */
/* Scrollbar più sottile e stilizzata */
.custom-scrollbar::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 3px;
}

.dark .custom-scrollbar::-webkit-scrollbar-track {
  background: #1a2833;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

.dark .custom-scrollbar::-webkit-scrollbar-thumb {
  background: #344049;
}

.dark .custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: #4b5563;
}

@media (max-width: 768px) {
  :root {
    --header-height: 64px;
    --header-offset: calc(var(--header-height) + var(--space-3));
  }
}

/* ===== MOBILE OPTIMIZATIONS ===== */
@media (max-width: 768px) {
  /* Aumenta line-height per leggibilità mobile */
  p {
    line-height: 1.7;
  }

  /* Riduce sticky header height su mobile */
  header.sticky {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }
}

/* Il popup «Contattaci» sta in contact-modal.css, caricato da header.js. */

/* ===== PRODUCT ACTION BUTTONS (share / favorite) ===== */
.product-share-btn,
.product-fav-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 24px;
  line-height: 1;
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  transition: color 0.18s;
}

.product-fav-btn.is-favorite {
  color: var(--ub-red, #E30613);
}

@keyframes fav-pulse {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.45); }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}

.product-fav-btn.fav-pulse {
  animation: fav-pulse 0.35s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

/* ===== TOAST ===== */
#univerbar-toast {
  position: fixed;
  bottom: 1.75rem;
  left: 50%;
  transform: translateX(-50%) translateY(0.75rem);
  background: #1A171B;
  color: #ffffff;
  padding: 0.55rem 1.25rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 9999;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}

#univerbar-toast.toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.dark #univerbar-toast {
  background: #f5f7f8;
  color: #1A171B;
}

/* Migliora spacing footer mobile */
  footer a {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  /* Nasconde scroll indicator su mobile molto piccoli */
  @media (max-width: 375px) {
    .scroll-indicator::after {
      display: none;
    }
  }
}

/* ===== FOCUS VISIBLE (Accessibility) ===== */
/* Migliora visibilità focus per navigazione keyboard */
*:focus-visible {
  outline: 2px solid var(--ub-red, #E30613);
  outline-offset: 2px;
  border-radius: 4px;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--ub-red, #E30613);
  outline-offset: 2px;
}

/* ===== SMOOTH SCROLL ===== */
html {
  scroll-behavior: smooth;
}

/* Font del testo (body, .font-display): definito in assets/fonts/fonts.css,
   caricato da tutte le pagine (anche cesti/accessori, che non caricano questo file). */

/* Disabilita smooth scroll se utente preferisce reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  header,
  footer,
  .no-print {
    display: none !important;
  }
  
  body {
    background: white;
    color: black;
  }
}

/* ===== UTILITY CLASSES ===== */
.text-balance {
  text-wrap: balance;
}

.safe-area-inset-bottom {
  padding-bottom: env(safe-area-inset-bottom);
}

.safe-area-inset-top {
  padding-top: env(safe-area-inset-top);
}

/* Previene zoom su input focus (iOS) */
@media (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  textarea,
  select {
    font-size: 16px !important;
  }
}
/* ===== CESTI/ACCESSORI CONSIGLIATI — card compatta (elemento secondario) ===== */
.accessory-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 640px) {
  .accessory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.accessory-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color .2s ease, background .2s ease, transform .2s ease, box-shadow .2s ease;
}
.accessory-card:hover {
  border-color: var(--primary, #E30613);
  background: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
.dark .accessory-card { background: #16232e; border-color: #344049; }
.dark .accessory-card:hover { background: #1a2833; }
.accessory-card__thumb {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--ub-red-tint, #FDECEE);
  color: var(--primary, #E30613);
  overflow: hidden;
}
.accessory-card__thumb .material-symbols-outlined { font-size: 22px; }
.accessory-card__thumb img { width: 100%; height: 100%; object-fit: contain; }
.accessory-card__text { flex: 1 1 auto; min-width: 0; }
.accessory-card__title {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
  color: #1a171b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dark .accessory-card__title { color: #f5f7f8; }
.accessory-card__sub {
  display: block;
  font-size: 0.75rem;
  line-height: 1.25;
  margin-top: 2px;
  color: #1a171b99;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dark .accessory-card__sub { color: #ffffff99; }
.accessory-card__qty {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary, #E30613);
  background: var(--ub-red-tint, #FDECEE);
  border-radius: 999px;
  padding: 2px 8px;
}
.accessory-card__arrow {
  flex: 0 0 auto;
  font-size: 20px;
  color: #1a171b40;
}
.dark .accessory-card__arrow { color: #ffffff40; }

/* ===== SEO TEXT SECTION UNIFORM SPACING ===== */
.seo-text-section {
  padding-top: 16px !important;
  padding-bottom: 56px !important;
  text-align: center;
  width: 100%;
  clear: both;
}

@media (min-width: 640px) {
  .seo-text-section {
    padding-top: 20px !important;
    padding-bottom: 64px !important;
  }
}

