/* ===== TM PERFORMANCE - LAYOUT.CSS ИСПРАВЛЕННАЯ ВЕРСИЯ ===== */

/* ===== FEATURE ITEMS ДЛЯ БЛОКОВ ТЕКСТА ===== */
#cataloghi .feature-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1.25rem;
    background: rgba(17, 17, 17, 0.92);
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    transition: border-color 0.3s ease;
}

#cataloghi .feature-item:hover {
    border-color: rgba(216, 43, 43, 0.35);
}

#cataloghi .feature-item i {
    color: var(--primary-red);
    font-size: 1.2rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

#cataloghi .feature-item span {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1.4;
}

/* ===== SECTION SEPARATORS - ОТКЛЮЧЕНЫ НА МОБИЛЬНЫХ ===== */
.section-separator {
    position: relative;
    margin: 3rem 0;
}

.section-separator::before {
    content: '';
    position: absolute;
    top: 0;
    left: 25%;
    width: 50%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--primary-red), #ff6600, var(--primary-red), transparent);
    border-radius: 2px;
}

/* УБРАНО НА МОБИЛЬНЫХ - см. media query ниже */
section:not(:last-child)::after {
    content: '';
    position: absolute;
    bottom: -1.5rem;
    left: 25%;
    width: 50%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-red), #ff6600, var(--primary-red), transparent);
    border-radius: 1px;
}

section {
    position: relative;
    max-width: 100vw;
    overflow-x: hidden;
}

/* ===== NAVIGATION ===== */
.navbar-custom {
    background: rgba(0, 0, 0, 0.95) !important;
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.75rem 0;
    transition: var(--transition);
    min-height: 80px;
}

.navbar-scrolled {
    background: rgba(0, 0, 0, 0.98) !important;
    box-shadow: var(--shadow-lg);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--white) !important;
    text-decoration: none;
}

.logo-icon {
    position: relative;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-red), var(--primary-red-light));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(216, 43, 43, 0.4);
}

.logo-text {
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--white);
    z-index: 1;
}

.navbar-nav .nav-link {
    color: var(--white) !important;
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    position: relative;
    transition: var(--transition);
    padding: 0.75rem 1rem !important;
}

.navbar-nav .nav-link:hover {
    color: var(--primary-red) !important;
}

/* ===== HERO SLIDER ===== */
.hero-slider {
    height: 100vh;
    min-height: 700px;
    position: relative;
    overflow: hidden;
    max-width: 100vw;
    width: 100%;
}

.carousel-item {
    height: 100vh;
    min-height: 700px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    max-width: 100vw;
    width: 100%;
}

.carousel-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.9) 0%,
        rgba(0, 0, 0, 0.5) 50%,
        rgba(0, 0, 0, 0.1) 100%
    );
    z-index: 1;
}

.carousel-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 100px 1rem 60px;
    max-width: 100vw;
}

.carousel-content-improved {
    padding: 100px 1rem 60px !important;
}

.carousel-content > .container {
    margin: auto;
    max-width: 100%;
}

.slide-title {
    font-family: var(--font-heading);
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 700;
    line-height: 1.1;
    margin: 0 0 1.5rem 0;
    text-transform: uppercase;
    letter-spacing: 0.01em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.slide-description {
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    line-height: 1.6;
    margin-bottom: 2rem;
    opacity: 0.95;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.slide-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ===== CAROUSEL CONTROLS ===== */
.carousel-control-prev,
.carousel-control-next {
    width: 50px;
    height: 50px;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    backdrop-filter: blur(10px);
    transition: var(--transition);
    z-index: 10;
}

.carousel-control-prev {
    left: 30px;
}

.carousel-control-next {
    right: 30px;
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
    background: var(--primary-red);
    border-color: var(--primary-red);
    transform: translateY(-50%) scale(1.1);
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    width: 20px;
    height: 20px;
}

.carousel-indicators {
    bottom: 30px;
    margin-bottom: 0;
    z-index: 10;
}

.carousel-indicators [data-bs-target] {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.3);
    border: none;
    margin: 0 5px;
    transition: var(--transition);
}

.carousel-indicators .active {
    background-color: var(--primary-red);
    transform: scale(1.2);
}

/* ===== SECTIONS ===== */
.section-padding {
    padding: var(--section-padding);
}

.bg-dark-custom {
    background: var(--dark-gray) !important;
}

.bg-darker {
    background: var(--black) !important;
}

#cataloghi.bg-darker {
    background: none !important;
}

.section-title {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.section-description {
    font-size: 1.1rem;
    opacity: 0.8;
    line-height: 1.8;
    margin-bottom: 2rem;
}

/* ===== PARALLAX SEZIONE CATALOGHI ===== */
#cataloghi {
    position: relative;
    overflow: hidden;
    clip-path: inset(0);
    max-width: 100vw;
}

#cataloghi .container {
    position: relative;
    z-index: 1;
}

.parallax-cataloghi-bg {
    transform: translateY(var(--parallax-bg-offset, 0));
}

.parallax-cataloghi-pattern {
    transform: translateY(var(--parallax-pattern-offset, 0)) scale(var(--parallax-scale, 1));
}

/* ===== CHI SIAMO ===== */
#azienda .row {
    align-items: center;
}

#azienda .col-lg-6:first-child {
    margin-bottom: 2rem;
}

#azienda img {
    width: 100%;
    height: auto;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 100%;
}

/* ===== SCROLL PROGRESS BAR ===== */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-red), var(--primary-red-light));
    z-index: 9999;
    transition: width 0.1s ease;
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    text-align: center;
    color: var(--white);
}

.loading-spinner p {
    margin-top: 1rem;
    opacity: 0.8;
}

/* ===== SCROLL TO TOP ===== */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-red), var(--primary-red-light));
    color: var(--white);
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0;
    transform: scale(0);
    transition: var(--transition);
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(216, 43, 43, 0.3);
}

.scroll-to-top.show {
    opacity: 1;
    transform: scale(1);
}

.scroll-to-top:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(216, 43, 43, 0.4);
}

/* ===== TABLET ===== */
@media (max-width: 991.98px) {
    .hero-slider {
        min-height: 600px;
        max-height: 100vh;
    }
    
    .carousel-item {
        min-height: 600px;
        max-height: 100vh;
        background-attachment: scroll !important;
    }
    
    .carousel-content {
        padding: 80px 1rem 50px;
    }
    
    #cataloghi {
        background-attachment: scroll;
    }
    
    .parallax-cataloghi-bg,
    .parallax-cataloghi-pattern {
        transform: none !important;
    }
}

/* ===== МОБИЛЬНЫЕ УСТРОЙСТВА - КРИТИЧЕСКИЕ ИСПРАВЛЕНИЯ ===== */
@media (max-width: 768px) {
    /* УБИРАЕМ ВСЕ ПСЕВДОЭЛЕМЕНТЫ - ГЛАВНАЯ ПРИЧИНА OVERFLOW */
    section::after,
    section::before,
    .section-separator::before {
        display: none !important;
    }
    
    /* Hero Slider */
    .hero-slider {
        height: 100vh;
        height: calc(var(--vh, 1vh) * 100);
        min-height: 100vh;
        min-height: calc(var(--vh, 1vh) * 100);
        max-width: 100vw !important;
        overflow-x: hidden !important;
        width: 100%;
    }
    
    .carousel-item {
        height: 100vh;
        height: calc(var(--vh, 1vh) * 100);
        min-height: 100vh;
        min-height: calc(var(--vh, 1vh) * 100);
        background-attachment: scroll !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        width: 100%;
    }
    
    body {
        overscroll-behavior-y: none;
        -webkit-overflow-scrolling: touch;
    }
    
    .carousel-content {
        padding: 60px 10px 90px;
        max-width: 100vw;
        width: 100%;
    }
    
    .carousel-content > .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    /* Carousel Controls */
    .carousel-control-prev,
    .carousel-control-next {
        width: 40px;
        height: 40px;
        top: auto;
        bottom: 20px;
        transform: none;
    }
    
    .carousel-control-prev {
        left: 15px;
    }
    
    .carousel-control-next {
        right: 15px;
    }
    
    .carousel-control-prev:hover,
    .carousel-control-next:hover {
        transform: scale(1.1);
    }
    
    .carousel-indicators {
        bottom: 75px;
    }
    
    /* CATALOGHI - Полное отключение parallax */
    #cataloghi {
        overflow-x: hidden !important;
        clip-path: none !important;
        max-width: 100vw !important;
    }
    
    #cataloghi::before {
        position: absolute !important;
        background-attachment: scroll !important;
        transform: none !important;
        will-change: auto !important;
    }
    
    .parallax-cataloghi-bg,
    .parallax-cataloghi-pattern {
        transform: none !important;
    }
    
    /* Все секции */
    section {
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }
    
    .container {
        max-width: 100vw !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
    
    /* Карточки */
    .settore-card,
    .prodotto-card,
    .news-card {
        max-width: 100%;
    }
}

/* ===== МАЛЕНЬКИЕ УСТРОЙСТВА ===== */
@media (max-width: 576px) {
    .hero-slider {
        height: calc(var(--vh, 1vh) * 100);
        min-height: calc(var(--vh, 1vh) * 100);
    }
    
    .carousel-item {
        height: calc(var(--vh, 1vh) * 100);
        min-height: calc(var(--vh, 1vh) * 100);
        background-attachment: scroll !important;
    }
    
    .carousel-content {
        padding: 50px 5px 85px;
    }
    
    .slide-title {
        font-size: clamp(2rem, 8vw, 3rem);
        margin-bottom: 1rem;
        line-height: 1.1;
    }
    
    .slide-description {
        font-size: clamp(1rem, 4.5vw, 1.3rem);
        margin-bottom: 1.5rem;
        padding: 0 0.5rem;
        line-height: 1.5;
    }
    
    .carousel-control-prev,
    .carousel-control-next {
        width: 35px;
        height: 35px;
        bottom: 15px;
    }
    
    .carousel-control-prev {
        left: 10px;
    }
    
    .carousel-control-next {
        right: 10px;
    }
    
    .carousel-indicators {
        bottom: 70px;
    }
    
    .carousel-indicators [data-bs-target] {
        width: 8px;
        height: 8px;
    }
}

/* ===== ОПТИМИЗАЦИЯ ===== */
@media (prefers-reduced-motion: reduce) {
    #cataloghi::before,
    .parallax-cataloghi-bg,
    .parallax-cataloghi-pattern {
        transform: none !important;
        will-change: auto;
        transition: none;
    }
    
    .carousel-item {
        background-attachment: scroll !important;
    }
}