/**
 * Custom CSS per Mauxa
 * Stili aggiuntivi, fix browser e ottimizzazioni
 */

/* ========================================
   CSS RESET E NORMALIZZAZIONE
======================================== */

/* Fix per line-clamp cross-browser */
.line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

/* Fix per focus outline accessibile */
*:focus {
    outline: 2px solid #E1B537;
    outline-offset: 2px;
}

*:focus:not(:focus-visible) {
    outline: none;
}

/* ========================================
   SCROLLBAR PERSONALIZZATE
======================================== */

/* Scrollbar per carousel orizzontali */
.overflow-x-auto::-webkit-scrollbar {
    height: 4px;
}

.overflow-x-auto::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 2px;
}

.overflow-x-auto::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.overflow-x-auto::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Scrollbar verticali */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f8fafc;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

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

/* ========================================
   ANIMAZIONI E TRANSIZIONI
======================================== */

/* Fade in per lazy loading */
img.lazy {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

img.loaded {
    opacity: 1;
}

/* Hover effects migliorati */
.hover-lift {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Smooth transitions per carousel */
.carousel-transition {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Pulse animation per loading states */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ========================================
   LAYOUT FIXES
======================================== */

/* Fix per aspect ratio cross-browser */
.aspect-video {
    aspect-ratio: 16 / 9;
}

@supports not (aspect-ratio: 16 / 9) {
    .aspect-video {
        position: relative;
        padding-bottom: 56.25%; /* 16:9 */
        height: 0;
    }
    
    .aspect-video > * {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

/* Container max-width personalizzato */
.max-w-content {
    max-width: 1100px;
}

/* ========================================
   MOBILE OPTIMIZATIONS
======================================== */

/* Safe area per iPhone */
.pb-safe {
    padding-bottom: env(safe-area-inset-bottom, 0);
}

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

/* Touch targets migliorati */
@media (max-width: 768px) {
    button, 
    a[role="button"],
    .touch-target {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Fix per overflow orizzontale */
    .mobile-scroll {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Prevent zoom on input focus */
    input[type="search"],
    input[type="email"],
    input[type="text"] {
        font-size: 16px;
    }
}

/* ========================================
   CAROUSEL SPECIFICI
======================================== */

/* Fix per carousel mobile */
@media (max-width: 768px) {
    .carousel-container .flex > div {
        min-width: 100% !important;
        flex: 0 0 100%;
    }
    
    .carousel-mobile-single {
        scroll-snap-type: x mandatory;
    }
    
    .carousel-mobile-single > * {
        scroll-snap-align: start;
    }
}

/* Smooth scroll per carousel */
.carousel-smooth {
    scroll-behavior: smooth;
}

/* ========================================
   BACKDROP BLUR FALLBACK
======================================== */

/* Fallback per backdrop-blur non supportato */
@supports not (backdrop-filter: blur(4px)) {
    .backdrop-blur-sm {
        background-color: rgba(255, 255, 255, 0.9);
    }
    
    .backdrop-blur-md {
        background-color: rgba(255, 255, 255, 0.95);
    }
}

/* ========================================
   PRINT STYLES
======================================== */

@media print {
    /* Nascondi elementi non necessari per la stampa */
    header,
    footer,
    nav,
    .no-print,
    .carousel-navigation,
    .mobile-menu,
    .ad-banner {
        display: none !important;
    }
    
    /* Ottimizza per stampa */
    body {
        font-size: 12pt;
        line-height: 1.4;
        color: black;
        background: white;
    }
    
    h1, h2, h3 {
        page-break-after: avoid;
    }
    
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Forza link a mostrare URL */
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 10pt;
        color: #666;
    }
}

/* ========================================
   ACCESSIBILITY IMPROVEMENTS
======================================== */

/* Skip link per screen reader */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    z-index: 1000;
}

.skip-link:focus {
    top: 6px;
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .bg-gray-100 {
        background-color: #f0f0f0;
    }
    
    .text-gray-600 {
        color: #333;
    }
    
    .border-gray-200 {
        border-color: #666;
    }
}

/* ========================================
   LOADING STATES
======================================== */

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

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

/* ========================================
   UTILITY CLASSES
======================================== */

/* Spacing utilities */
.space-y-2\.5 > * + * {
    margin-top: 0.625rem;
}

/* Custom shadows */
.shadow-card {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.shadow-card-hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Text utilities */
.text-balance {
    text-wrap: balance;
}

/* Image utilities */
.object-cover-center {
    object-fit: cover;
    object-position: center;
}

/* ========================================
   DARK MODE SUPPORT (FUTURO)
======================================== */

/* Preparazione per dark mode */
@media (prefers-color-scheme: dark) {
    .dark-mode-ready {
        /* Variabili CSS per dark mode */
        --bg-primary: #1a1a1a;
        --bg-secondary: #2d2d2d;
        --text-primary: #ffffff;
        --text-secondary: #a0a0a0;
    }
}

/* ========================================
   FESTIVAL GOLD THEME
======================================== */

/* Estensioni per il colore festival gold */
.bg-festival-gold-light {
    background-color: #f4e5a1;
}

.border-festival-gold {
    border-color: #E1B537;
}

.text-festival-gold {
    color: #E1B537;
}

/* Gradient con festival gold */
.bg-gradient-festival {
    background: linear-gradient(135deg, #E1B537 0%, #FBBF24 100%);
}

/* ========================================
   PERFORMANCE OPTIMIZATIONS
======================================== */

/* GPU acceleration per animazioni */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

/* Contenimento layout */
.layout-contained {
    contain: layout style paint;
}

/* ========================================
   BROWSER SPECIFIC FIXES
======================================== */

/* Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    .safari-fix {
        -webkit-appearance: none;
    }
}

/* Firefox specific fixes */
@-moz-document url-prefix() {
    .firefox-fix {
        /* Firefox specific styles */
    }
}

/* Edge specific fixes */
@supports (-ms-ime-align: auto) {
    .edge-fix {
        /* Edge specific styles */
    }
} 