@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #D1184F;
    --primary-dark: #B3103F;
    --primary-light: #E13869;
    --area-personale: #C91653;
    --area-personale-hover: #A81243;
    --dark: #333333;
    --gray: #6C757D;
    --light: #F8F9FA;
    --gray-light: #E9ECEF;
    --icon-color: #0D5C6C;
}

body {
    font-family: 'Montserrat', sans-serif;
    color: var(--dark);
    line-height: 1.5;
    font-size: 0.95rem;
    font-weight: 400;
    overflow-x: hidden;
}

.navbar {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 0.75rem 0;
    background-color: white;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1030;
}
.navbar-brand {
    font-weight: 600;
    font-size: 1.4rem;
    color: var(--dark);
}
.nav-link {
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem 1rem !important;
    margin: 0 0.25rem;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.nav-link:hover {
    color: var(--primary) !important;
}

.btn-primary,
.btn-outline-primary,
.btn-light {
    padding: 0.5rem 1.25rem;
    font-weight: 500;
    border-radius: 4px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
}
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}
.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
}
.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline-primary:hover {
    background-color: var(--primary);
    border-color: var(--primary);
    transform: translateY(-2px);
    color: white;
}
.btn-light {
    background-color: white;
    color: var(--primary);
}
.btn-light:hover {
    background-color: var(--light);
    transform: translateY(-2px);
}

.hero,
.page-header,
.cta-section {
    position: relative;
    overflow: hidden;
    background-color: var(--primary);
    color: white;
}
.hero {
    padding: 7rem 0 5rem;
}
.hero h1,
.hero p,
.hero-buttons,
.hero-image {
    position: relative;
    z-index: 2;
}
.hero h1 {
    font-size: clamp(1.8rem, 4vw, 2.2rem);
    font-weight: 600;
    margin-bottom: 1.25rem;
    line-height: 1.2;
}
.hero p {
    font-size: clamp(1rem, 2vw, 1.1rem);
    margin-bottom: 2rem;
    opacity: 0.9;
}
.hero-image img {
    border-radius: 0;
    transition: transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.hero-image img:hover {
    transform: scale(1.02);
}

.diagonal-stripes,
.cta-diagonal-stripes {
    background: repeating-linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.1),
        rgba(255, 255, 255, 0.1) 20px,
        transparent 20px,
        transparent 40px
    );
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 50%;
    z-index: 1;
}

.section {
    padding: 4rem 0;
}
.feature-card .feature-icon,
.feature-card .feature-title,
.feature-card .feature-text,
.feature-card .btn {
    padding: 0 2rem;
}
.feature-card .feature-icon {
    padding-top: 2rem;
}
.feature-card .btn {
    margin-bottom: 2rem;
}
.stat-card .stat-number,
.stat-card .stat-text {
    padding: 1rem;
}
.stat-card .stat-number {
    padding-top: 2rem;
}
.stat-card .stat-text {
    padding-bottom: 2rem;
}
.section-header {
    text-align: center;
    margin-bottom: 3rem;
}
.section-title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--dark);
}
.section-subtitle {
    font-size: clamp(1rem, 1.5vw, 1.1rem);
    color: var(--gray);
    max-width: 700px;
    margin: 0 auto;
}
.feature-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    padding: 0;
    height: 100%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}
.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}
.feature-icon {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
}
.feature-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}
.feature-text {
    color: var(--gray);
    margin-bottom: 1.5rem;
    flex-grow: 1;
}
.feature-card .btn {
    align-self: flex-start;
}

/* === CAROUSEL PERCORSI DI FORMAZIONE - VERSIONE OTTIMIZZATA === */
.carousel {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    background-color: #fff;
    padding: 20px;
}

.carousel-inner {
    padding-bottom: 2rem;
}

.carousel-item {
    padding: 5px;
}

/* ✅ CARD PROMO - LAYOUT OTTIMIZZATO */
.promo-card {
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: #fff;
    height: 100%;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.promo-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
    text-decoration: none;
    border-color: rgba(var(--primary), 0.1);
}

/* ✅ CONTENITORE IMMAGINE - DIMENSIONI FISSE E RESPONSIVO */
.promo-image {
    position: relative;
    width: 100%;
    height: 220px; /* Altezza fissa per uniformità */
    overflow: hidden;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0; /* Non si comprime */
}

/* ✅ IMMAGINE - RIEMPIE COMPLETAMENTE IL CONTENITORE */
.promo-image img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* CHIAVE: Riempie tutto lo spazio mantenendo proporzioni */
    object-position: center; /* Centra l'immagine nel crop */
    display: block;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
}

/* Effetto zoom al hover */
.promo-card:hover .promo-image img {
    transform: scale(1.05);
}

/* ✅ CONTENITORE TITOLO - ALTEZZA MINIMA FISSA */
.promo-title {
    padding: 18px 16px;
    background-color: #fff;
    flex-grow: 1; /* Si espande per riempire lo spazio rimanente */
    min-height: 80px; /* Altezza minima per uniformità */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-top: 1px solid #f1f3f4;
}

.promo-title h5 {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0;
    color: var(--dark);
    transition: color 0.3s ease;
}

.promo-card:hover .promo-title h5 {
    color: var(--primary);
}

/* ✅ CONTROLLI CAROUSEL - MIGLIORATI */
.carousel-control-prev, 
.carousel-control-next {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.8;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.carousel-control-prev:hover, 
.carousel-control-next:hover {
    opacity: 1;
    background: white;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    transform: translateY(-52px);
}

.carousel-control-prev {
    left: -25px;
}

.carousel-control-next {
    right: -25px;
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    width: 20px;
    height: 20px;
    background-size: 16px;
    filter: invert(0.5); /* Icone più scure */
}

.carousel-control-prev:hover .carousel-control-prev-icon,
.carousel-control-next:hover .carousel-control-next-icon {
    filter: invert(0.2); /* Icone ancora più scure al hover */
}

/* ✅ INDICATORI CAROUSEL - MIGLIORATI */
.carousel-indicators {
    bottom: 15px;
    margin-bottom: 0;
}

.carousel-indicators [data-bs-target] {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.8);
    margin: 0 8px;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.carousel-indicators [data-bs-target].active {
    opacity: 1;
    background-color: var(--primary);
    border-color: white;
    transform: scale(1.1);
}

.carousel-indicators [data-bs-target]:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

.stats-section {
    padding: 4rem 0;
    position: relative;
    overflow: hidden;
    background-color: #f8f9fa;
}
.stats-section::before {
    content: "";
    background: repeating-linear-gradient(
        -45deg,
        rgba(209, 24, 79, 0.05),
        rgba(209, 24, 79, 0.05) 20px,
        transparent 20px,
        transparent 40px
    );
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}
.stat-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    padding: 0;
    text-align: center;
    height: 100%;
    position: relative;
    z-index: 2;
    transition: transform 0.3s ease;
}
.stat-card:hover {
    transform: translateY(-5px);
}
.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}
.stat-text {
    font-size: 0.9rem;
    letter-spacing: 1px;
    font-weight: 500;
    color: var(--gray);
}

.cta-section {
    padding: 5rem 0;
    text-align: center;
    position: relative;
}
.cta-diagonal-stripes {
    background: repeating-linear-gradient(
        -45deg,
        rgba(255, 255, 255, 0.1),
        rgba(255, 255, 255, 0.1) 20px,
        transparent 20px,
        transparent 40px
    );
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}
.cta-content {
    position: relative;
    z-index: 2;
}
.cta-title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 600;
    margin-bottom: 1rem;
}
.cta-text {
    font-size: clamp(1rem, 1.5vw, 1.1rem);
    margin-bottom: 2rem;
    opacity: 0.9;
}
.cta-section .btn {
    padding: 0.7rem 2rem;
    font-size: 0.9rem;
    font-weight: 600;
}

/* === RESPONSIVE DESIGN === */

@media (max-width: 992px) {
    .section, .stats-section, .cta-section {
        padding: 3.5rem 0;
    }
    .hero {
        padding: 6rem 0 4rem;
    }
    .feature-card, .stat-card {
        margin-bottom: 1rem;
    }
    
    /* ✅ TABLET - CARD OTTIMIZZATE */
    .promo-card {
        margin-bottom: 1.5rem;
    }
    
    .promo-image {
        height: 200px; /* Ridotta per tablet */
    }
    
    .promo-title {
        padding: 16px 14px;
        min-height: 75px;
    }
    
    .promo-title h5 {
        font-size: 0.95rem;
    }
    
    .carousel {
        padding: 15px;
    }
    
    .carousel-control-prev {
        left: -20px;
    }
    
    .carousel-control-next {
        right: -20px;
    }
}

@media (max-width: 768px) {
    .section, .stats-section, .cta-section {
        padding: 3rem 0;
    }
    .hero {
        padding: 5rem 0 3rem;
    }
    
    /* ✅ MOBILE - CARD COMPATTE */
    .carousel {
        padding: 12px;
        margin: 0 -10px; /* Compensa il padding ridotto */
    }
    
    .carousel-item {
        padding: 3px;
    }
    
    .promo-card {
        margin-bottom: 1rem;
        border-radius: 10px;
    }
    
    .promo-image {
        height: 180px; /* Compatta per mobile */
    }
    
    .promo-title {
        padding: 14px 12px;
        min-height: 70px;
    }
    
    .promo-title h5 {
        font-size: 0.9rem;
        line-height: 1.3;
    }
    
    /* Controlli carousel mobile */
    .carousel-control-prev, 
    .carousel-control-next {
        width: 40px;
        height: 40px;
    }
    
    .carousel-control-prev {
        left: -15px;
    }
    
    .carousel-control-next {
        right: -15px;
    }
    
    .carousel-control-prev-icon,
    .carousel-control-next-icon {
        width: 16px;
        height: 16px;
        background-size: 14px;
    }
    
    .feature-icon {
        font-size: 2rem;
        margin-bottom: 1rem;
    }
}

@media (max-width: 576px) {
    .section, .stats-section, .cta-section {
        padding: 2.5rem 0;
    }
    .hero {
        padding: 4.5rem 0 2.5rem;
    }
    .section-header {
        margin-bottom: 2rem;
    }
    .feature-card, .stat-card {
        padding: 1.5rem;
    }
    
    /* ✅ MOBILE SMALL - CARD EXTRA COMPATTE */
    .carousel {
        padding: 10px;
        margin: 0 -5px;
    }
    
    .carousel-item {
        padding: 2px;
    }
    
    .promo-image {
        height: 160px; /* Più compatta per schermi piccoli */
    }
    
    .promo-title {
        padding: 12px 10px;
        min-height: 65px;
    }
    
    .promo-title h5 {
        font-size: 0.85rem;
        line-height: 1.2;
    }
    
    /* Controlli carousel mobile piccolo */
    .carousel-control-prev, 
    .carousel-control-next {
        width: 35px;
        height: 35px;
    }
    
    .carousel-control-prev {
        left: -12px;
    }
    
    .carousel-control-next {
        right: -12px;
    }
    
    .carousel-indicators [data-bs-target] {
        width: 10px;
        height: 10px;
        margin: 0 5px;
    }
    
    .feature-card .btn, 
    .cta-section .btn {
        width: 100%;
    }
    .hero-buttons {
        flex-direction: column;
        gap: 1rem !important;
    }
    .hero-buttons .btn {
        width: 100%;
    }
}

/* === STATI DI CARICAMENTO E ERRORE === */

/* Placeholder per immagini in caricamento */
.promo-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    z-index: 1;
}

.promo-image img {
    position: relative;
    z-index: 2;
}

.promo-image img[src*="placeholder"] {
    opacity: 0.6;
    filter: grayscale(0.5);
}

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

/* Nasconde il placeholder quando l'immagine è caricata */
.promo-image img:not([src*="placeholder"]) ~ .promo-image::before,
.promo-image img[src]:not([src*="placeholder"]) + .promo-image::before {
    display: none;
}

/* === ACCESSIBILITÀ === */

.promo-card:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.carousel-control-prev:focus,
.carousel-control-next:focus {
    outline: 2px solid var(--primary);
}

/* Miglior contrasto per utenti con esigenze di accessibilità */
@media (prefers-contrast: high) {
    .promo-card {
        border: 2px solid #333;
    }
    
    .promo-title h5 {
        color: #000;
        font-weight: 700;
    }
}