/**
 * ╔══════════════════════════════════════════════════════════════════════════════╗
 * ║                     RENAPA - STILE GLOBALE UNIFICATO                         ║
 * ║  Registro Nazionale Assistenti Personali Automotive - Personal Car Shopper   ║
 * ╚══════════════════════════════════════════════════════════════════════════════╝
 * 
 * Design System:
 * - Colori: slate (50/100/200/300/600/700/900), sky-600, emerald-500
 * - Typography: font-medium/semibold, tracking-wide, caratteri sottili
 * - Bordi: rounded-2xl/3xl/full, border-slate-200
 * - Ombre: soft, morbide, depth moderato
 * - Animazioni: fade-up, transitions smooth
 * - Stile: istituzionale, professionale, moderno, sobrio
 */

/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 15px;
    line-height: 1.6;
}

/* ==================== SOFT SHADOWS (CHIAVE STILE RENAPA) ==================== */
.soft-card {
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

.soft-shadow-sm {
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.soft-shadow-lg {
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.12);
}

/* ==================== ANIMAZIONI FADE-UP ==================== */
.fade-up {
    opacity: 0;
    transform: translateY(10px);
    animation: fadeUp 0.6s ease-out forwards;
}

.fade-up-delay {
    opacity: 0;
    transform: translateY(10px);
    animation: fadeUp 0.6s ease-out 0.15s forwards;
}

.fade-up-delay-2 {
    opacity: 0;
    transform: translateY(10px);
    animation: fadeUp 0.6s ease-out 0.3s forwards;
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== SCROLLBAR PERSONALIZZATA ==================== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9; /* slate-100 */
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1; /* slate-300 */
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8; /* slate-400 */
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

/* ==================== FORM INPUTS LEGGIBILI ==================== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="url"],
input[type="date"],
select,
textarea {
    font-size: 15px !important;
    line-height: 1.5;
}

/* iOS: previeni zoom automatico su input < 16px */
@supports (-webkit-touch-callout: none) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"],
    input[type="url"],
    input[type="date"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* ==================== FOCUS RINGS ELEGANTI ==================== */
*:focus-visible {
    outline: 2px solid #0284c7; /* sky-600 */
    outline-offset: 2px;
    border-radius: 4px;
}

/* ==================== ACCORDION & DETAILS ==================== */
details[open] summary svg {
    transform: rotate(180deg);
}

summary {
    list-style: none;
}

summary::-webkit-details-marker {
    display: none;
}

/* ==================== BADGES & PILLS ==================== */
.badge-renapa {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.badge-approved {
    background-color: #d1fae5; /* emerald-100 */
    color: #065f46; /* emerald-800 */
    border: 1px solid #a7f3d0; /* emerald-200 */
}

.badge-pending {
    background-color: #fef3c7; /* amber-100 */
    color: #92400e; /* amber-800 */
    border: 1px solid #fde68a; /* amber-200 */
}

.badge-rejected {
    background-color: #fee2e2; /* red-100 */
    color: #991b1b; /* red-800 */
    border: 1px solid #fecaca; /* red-200 */
}

/* ==================== BUTTONS RENAPA STYLE ==================== */
.btn-renapa {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.5rem;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    border: none;
    text-decoration: none;
}

.btn-renapa-primary {
    background-color: #0284c7; /* sky-600 */
    color: white;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

.btn-renapa-primary:hover {
    background-color: #0369a1; /* sky-700 */
    box-shadow: 0 6px 20px rgba(2, 132, 199, 0.35);
}

.btn-renapa-secondary {
    background-color: #10b981; /* emerald-500 */
    color: #0f172a; /* slate-900 */
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-renapa-secondary:hover {
    background-color: #059669; /* emerald-600 */
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}

.btn-renapa-outline {
    background-color: transparent;
    color: #475569; /* slate-600 */
    border: 1px solid #cbd5e1; /* slate-300 */
}

.btn-renapa-outline:hover {
    background-color: #f8fafc; /* slate-50 */
    border-color: #94a3b8; /* slate-400 */
}

/* ==================== CARDS RENAPA ==================== */
.card-renapa {
    background-color: white;
    border: 1px solid #e2e8f0; /* slate-200 */
    border-radius: 1rem; /* 16px */
    padding: 1.5rem;
    transition: all 0.2s ease-in-out;
}

.card-renapa:hover {
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

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

.gradient-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom right, rgba(15, 23, 42, 0.4), rgba(15, 23, 42, 0.25));
}

/* ==================== RESPONSIVE IMAGES ==================== */
img {
    max-width: 100%;
    height: auto;
}

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

/* ==================== ACCESSIBILITY ==================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ==================== TRANSITIONS GLOBALI ==================== */
a, button, input, select, textarea {
    transition: all 0.15s ease-in-out;
}

/* ==================== LOADING SPINNER RENAPA ==================== */
.spinner-renapa {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: #0284c7;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ==================== TOAST NOTIFICATIONS ==================== */
.toast-renapa {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
    z-index: 9999;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ==================== SIDEBAR LAYOUT FIX - EQUILIBRATO ==================== */
/* Footer visibile accanto alla sidebar, non sopra né sotto */

main[class*="ml-0"][class*="md:ml-16"][class*="lg:ml-64"],
main[class*="ml-16"][class*="md:ml-64"] {
    /* Mobile: padding-bottom per bottom navigation */
    padding-bottom: 6rem !important; /* 96px per bottom nav mobile */
}

@media (min-width: 768px) {
    main[class*="ml-0"][class*="md:ml-16"][class*="lg:ml-64"],
    main[class*="ml-16"][class*="md:ml-64"] {
        /* Desktop: spazio minimo, footer sta nel margine sinistro della sidebar */
        padding-bottom: 1.5rem !important; /* 24px - minimo per separare contenuto */
    }
}

/* Footer normale, non fixed - resta nel flusso del documento */
footer {
    position: relative;
    z-index: 1;
    margin-left: 0;
}

/* Su desktop il footer non deve invadere lo spazio della sidebar */
@media (min-width: 768px) {
    footer {
        /* Il footer ha già il margin-left dall'app, non serve altro */
        z-index: 1;
    }
}

/* Sidebar laterale fixed - resta sempre visibile */
aside[class*="fixed"],
nav[class*="fixed"][class*="left"] {
    z-index: 30 !important;
}

/* Mobile bottom nav: resta sempre fissa */
.renapa-mobile-nav {
    position: fixed !important;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    transform: translateZ(0);
}

/* Bottom navigation mobile - sopra tutto su mobile */
nav[class*="fixed"][class*="bottom-0"] {
    z-index: 50 !important;
}

/* ==================== DARK MODE SUPPORT (FUTURE) ==================== */
@media (prefers-color-scheme: dark) {
    /* Placeholder per futura implementazione dark mode */
}

/* ==================== ⚡ PERFORMANCE: ELIMINA FOUC E SHIFT LAYOUT ==================== */

/* 1. Previeni layout shift per immagini con dimensioni esplicite */
img[width][height] {
    aspect-ratio: attr(width) / attr(height);
}

/* 2. Placeholder per immagini in caricamento */
img {
    background-color: #f1f5f9;
    background-image: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

img[src] {
    background: none;
    animation: none;
}

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

/* 3. Smooth transitions per navigazione */
body {
    transition: opacity 0.15s ease-out;
}

body.page-transitioning {
    opacity: 0.7;
}

/* 4. Background images ottimizzate */
.hero-bg,
.section-image {
    background-color: #0f172a; /* Fallback color */
    background-size: cover;
    background-position: center;
    will-change: transform; /* Ottimizza animazioni */
}

/* 5. Lazy load placeholder */
img[data-src] {
    filter: blur(5px);
    transition: filter 0.3s ease-in-out;
}

img[data-src].loaded,
img:not([data-src]) {
    filter: none;
}

/* 6. Previeni flash durante caricamento Tailwind */
.fade-in {
    opacity: 0;
    animation: fadeIn 0.4s ease-out forwards;
    animation-delay: 0.05s;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* 7. Skeleton loader per contenuti in caricamento */
.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 0.5rem;
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: 1rem;
}

/* 8. Ottimizzazione font loading (FOUT prevention) */
body {
    font-display: swap;
}

/* 9. Reduce motion per accessibilità */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 10. Hardware acceleration per animazioni smooth */
.float-subtle,
.fade-in,
.card-lift {
    transform: translateZ(0);
    will-change: transform, opacity;
}




