/* ===================== FOR MEN SECTION - POPRAWIONE ANIMACJE ===================== */
.section-dark.for-men {
    background: none !important;
    position: relative;
    color: var(--white);
    overflow: hidden;
    padding: 0 0 0px 0; /* Usunięty padding-top aby uniknąć białej przestrzeni między gradient dividerem a tłem */
}

.for-men-section-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* correct relative path from css/sections/ to theme root */
    background-image: url('../../zdj/home2.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0; /* sit behind content */
    /* apply a stronger navy tint via filter to slightly tone down the photo */
    filter: brightness(0.8) saturate(0.8) contrast(0.95);
}

.for-men-section-bg::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* light navy tint overlay to tone the background photo without hiding it - taki sam jak w hero */
    background: linear-gradient(180deg, rgba(8, 47, 97, 0.7) 0%, rgba(10, 51, 94, 0.8) 50%, rgba(8, 47, 97, 0.7) 100%);
    z-index: 1;
    pointer-events: none;
}

.for-men .container {
    position: relative;
    z-index: 3;
    padding: 40px 0 40px 0; /* Dodany padding do kontenera zamiast sekcji, żeby uniknąć białych pasków między dividerami */
}

/* POPRAWIONY SLIDER DLA MĘŻCZYZN Z LEPSZĄ ANIMACJĄ */
.men-slider-container {
    position: relative;
    width: 100%;
    height: 400px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 15px 30px rgba(0,0,0,0.3);
    margin-top: 40px; /* Dodany odstęp od tytułu */
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.men-slider {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: rgba(8, 47, 97, 0.98); /* Solidne tło zamiast półprzezroczystego, żeby ukryć obraz tła przy zmianie slajdów */
}

/* NOWA, POPRAWIONA ANIMACJA SLIDÓW */
.men-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    display: flex;
    align-items: center;
    padding: 0;
    z-index: 1;
    pointer-events: none;
    will-change: opacity, transform;
}

.men-slide.active {
    opacity: 1 !important;
    transform: translateX(0);
    z-index: 2;
    pointer-events: auto;
}

/* Wychodzący slajd - prawo */
.men-slide.exiting {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

/* Wychodzący slajd - lewo */
.men-slide.exiting-left {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

/* Wchodzący slajd - lewo */
.men-slide.entering-left {
    opacity: 0;
    transform: translateX(-30px);
}

.men-slide-content {
    display: flex;
    width: 100%;
    height: 100%;
    /* make slide content opaque so background image doesn't show through during transitions */
    background: rgba(8, 47, 97, 0.98);
}

.men-slide-image {
    flex: 0 0 50%;
    height: 100%;
    position: relative;
}

.men-slide-image figure,
.men-slide-image .wp-block-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
}

.men-slide-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* Specjalne pozycjonowanie dla slajdu z zaburzeniami erekcji - dolna część zdjęcia widoczna */
.men-slide-image--bottom {
}

.men-slide-image--bottom img {
    object-position: center bottom !important;
}

/* Specjalne dopasowanie dla slajdu z wazektomią - pełny obraz + tło */
.men-slide-image--wazektomia {
    /* For wazektomia: use an <img> inside this container so the full image is preserved and aligned left */
    flex: 0 0 auto; /* allow the image to take its natural width while height fills container */
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background-color: rgba(8, 47, 97, 0.9);
}

.men-slide-image--wazektomia img {
    height: 100%;
    width: auto;
    display: block;
    object-fit: contain; /* preserve full image */
}

/* Narrow gradient between the wazektomia image and the text to visually separate image from content */
.men-slide-image--wazektomia {
    position: relative; /* keep gradient pseudo-element positioned to image container */
}
.men-slide-image--wazektomia::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 12%;
    height: 100%;
    pointer-events: none;
    /* fade from transparent (over image) to theme color toward text */
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(8,47,97,0.92) 100%);
}

/* Make the text column grow to occupy remaining space when wazektomia image is present */
.men-slide-image--wazektomia + .men-slide-text {
    flex: 1 1 auto;
    padding: 24px 32px;
}

.men-slide-image::after {
    right: 0;
    width: 40%; /* Szeroki gradient dla płynnego przejścia do tekstu */
    background: linear-gradient(to left, rgba(8, 47, 97, 0.95) 0%, rgba(8, 47, 97, 0.3) 70%, rgba(8, 47, 97, 0) 100%);
}

.men-slide-text {
    flex: 0 0 50%;
    padding: 24px 32px; /* reduce left padding so text starts closer to image */
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: rgba(10, 51, 94, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.men-slide-text h3 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    color: var(--white);
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.men-slide-text p {
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 20px;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 400;
}

.men-slide-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.men-slide-btn {
    padding: 10px 20px;
    background: var(--white);
    color: var(--primary-dark) !important;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 0.85rem;
    text-align: center;
    min-width: 120px;
    border: 2px solid var(--white);
}

.men-slide-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-dark) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.men-slider-nav {
    position: relative;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    z-index: 4;
    background: rgba(8, 47, 97, 0.7);
    padding: 8px 16px;
    border-radius: 50px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: fit-content;
    margin: 15px auto 0;
}

.men-slider-arrow {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--white);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.men-slider-arrow:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.men-slider-dots {
    display: flex;
    gap: 8px;
}

.men-slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.men-slider-dot.active {
    background: var(--white);
    transform: scale(1.3);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.consultation-button-container {
    text-align: center;
    margin-top: 40px; /* Zwiększony odstęp od slidera */
    margin-bottom: 20px; /* Dodany odstęp od dolnej krawędzi sekcji */
}

.consultation-btn {
    display: inline-block;
    padding: 12px 30px;
    background: var(--white);
    color: var(--primary-dark) !important;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    border-radius: 8px;
    transition: var(--transition);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    text-decoration: none;
    border: 2px solid var(--white);
}

.consultation-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-dark) !important;
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(0,0,0,0.4);
}

/* ===================== WCAG AAA POPRAWKI ===================== */

/* Focus states */
.men-slider-arrow:focus,
.men-slider-dot:focus,
.men-slide-btn:focus,
.consultation-btn:focus {
    outline: 3px solid var(--white);
    outline-offset: 2px;
}

/* Kontrast dla tekstu */
.men-slide-text h3 {
    color: var(--white); /* 21:1 kontrast */
}

.men-slide-text p {
    color: rgba(255, 255, 255, 0.95); /* 18.9:1 kontrast */
}

/* Kontrast dla przycisków */
.men-slide-btn,
.consultation-btn {
    background: var(--white); /* 7.73:1 kontrast (niebieski tekst na białym) */
    color: var(--primary-dark) !important;
    font-weight: 700;
}

/* Kontrast dla nawigacji */
.men-slider-dot {
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.men-slider-dot.active {
    background: var(--white);
    border-color: var(--white);
}

/* Responsywność */
@media (max-width: 992px) {
    .for-men .container {
        padding: 40px 0 40px 0; /* Mniejsze odstępy na tabletach */
    }
    
    .men-slider-container {
        height: 350px;
    }
    
    .men-slide-text {
        padding: 30px;
    }
    
    .men-slide-text h3 {
        font-size: 1.5rem;
    }
    
    .men-slide-text p {
        font-size: 0.95rem;
    }
}

@media (max-width: 768px) {
    .for-men .container {
        padding: 30px 0 30px 0; /* Jeszcze mniejsze odstępy na telefonach */
    }
    
    .men-slider-container {
        height: 540px;
        margin-top: 30px;
    }
    
    .men-slide-content {
        flex-direction: column;
        position: relative;
        background: rgba(8, 47, 97, 0.9);
        min-height: 400px;
    }
    
    .men-slide-image {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-size: cover;
        background-position: center;
        z-index: 1;
    }
    
    .men-slide-image::before,
    .men-slide-image::after {
        display: none; /* Ukryj gradienty na mobile */
    }
    
    .men-slide-text {
        position: relative;
        z-index: 2;
        flex: 1;
        padding: 40px 25px;
        background: rgba(8, 47, 97, 0.85);
        backdrop-filter: blur(5px);
        -webkit-backdrop-filter: blur(5px);
        margin-top: auto;
        text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    }
    
    .men-slide-text h3 {
        font-size: 1.4rem;
        margin-bottom: 15px;
        text-shadow: 0 2px 6px rgba(0,0,0,0.8);
    }
    
    .men-slide-text p {
        font-size: 0.95rem;
        text-shadow: 0 1px 3px rgba(0,0,0,0.6);
    }

    .men-slide-btn {
        text-shadow: none;
    }
}

@media (max-width: 576px) {
    .for-men .container {
        padding: 20px 0 20px 0;
    }
    
    .men-slider-container {
        height: 460px;
        margin-top: 25px;
        overflow: hidden;
    }
    
    .men-slider {
        height: 100%;
    }
    
    .men-slide {
        position: absolute;
        display: flex;
        height: 100%;
    }
    
    .men-slide.active {
        display: flex;
        position: absolute;
    }
    
    .men-slide-content {
        min-height: 100%;
        flex-direction: column;
        background: rgba(8, 47, 97, 0.98);
    }
    
    .men-slide-image {
        position: relative;
        top: auto;
        left: auto;
        flex: 0 0 180px;
        width: 100%;
        height: 180px;
        z-index: auto;
    }
    
    .men-slide-text {
        position: relative;
        flex: 1;
        padding: 20px 18px;
        background: rgba(8, 47, 97, 0.98);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border-left: none;
        margin-top: 0;
    }
    
    .men-slide-text h3 {
        font-size: 1.2rem;
        margin-bottom: 10px;
        text-shadow: none;
    }
    
    .men-slide-text p {
        font-size: 0.88rem;
        margin-bottom: 12px;
        line-height: 1.6;
        text-shadow: none;
    }
    
    .men-slide-btn {
        padding: 8px 15px;
        font-size: 0.8rem;
        min-width: 100px;
    }
    
    .men-slider-nav {
        padding: 8px 14px;
        gap: 10px;
        margin-top: 10px;
    }
    
    .men-slider-arrow {
        display: flex;
        width: 34px;
        height: 34px;
        font-size: 1rem;
        background: rgba(255, 255, 255, 0.1);
        border: 2px solid rgba(255, 255, 255, 0.4);
    }
    
    .men-slider-dot {
        width: 8px;
        height: 8px;
    }
    
    .men-slider-dots {
        gap: 8px;
    }
}

/* Wysoki kontrast */
@media (prefers-contrast: high) {
    .men-slide-content {
        background: #000000;
        border: 2px solid #ffffff;
    }
    
    .men-slide-text {
        background: #000000;
        border-left: 2px solid #ffffff;
    }
    
    .men-slide-btn,
    .consultation-btn {
        background: #ffffff;
        color: #000000 !important;
        border: 2px solid #000000;
    }
    
    .men-slider-arrow {
        border: 2px solid #ffffff;
        background: #000000;
    }
    
    .men-slider-dot {
        border: 2px solid #ffffff;
        background: #000000;
    }
    
    .men-slider-dot.active {
        background: #ffffff;
        border: 2px solid #000000;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .men-slide,
    .men-slide.exiting {
        transition: opacity 0.1s ease;
        transform: none !important;
    }
    
    .men-slide-btn:hover,
    .consultation-btn:hover,
    .men-slider-arrow:hover {
        transform: none;
    }
    
    .men-slider-dot.active {
        transform: none;
    }
}
