/*
Theme Name: Stowarzyszenie PPB
Theme URI: http://sppb.com.pl
Author: Stowarzyszenie Polska Potęga Bezpieczeństwa
Description: Motyw dedykowany v1.9 (Fix: Layout Shift + Overflow)
Version: 1.9
License: GNU General Public License v2 or later
*/

/* === STYLE PODSTAWOWE === */
/* Wymuszenie pionowego paska przewijania, aby strona nie skakała na boki */
html {
    overflow-y: scroll;
}

body {
    background-color: #f8fafc;
    color: #1f2937;
    overflow-x: hidden;
    /* Ukrywa poziomy pasek, ale overflow-hidden w sekcjach jest nadal potrzebne */
    scroll-behavior: smooth;
}

/* === KARUZELA 3D === */
:root {
    --card-width: 300px;
    --card-height: 420px;
    --carousel-radius: 450px;
}

.carousel-section {
    perspective: 2000px;
    height: 700px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.carousel {
    position: relative;
    width: var(--card-width);
    height: var(--card-height);
    transform-style: preserve-3d;
    transition: transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.memory-card {
    position: absolute;
    width: var(--card-width);
    height: var(--card-height);
    left: 0;
    top: 0;
    transform-origin: center center;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: filter 0.6s, opacity 0.6s, transform 0.6s;
}

/* Nieaktywne karty: Przyciemnione */
.memory-card:not(.active) {
    filter: brightness(0.2) blur(3px);
    opacity: 0.4;
    z-index: 1;
}

/* Aktywna karta: Na wierzchu */
.memory-card.active {
    filter: brightness(1) blur(0);
    opacity: 1;
    z-index: 100 !important;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
    border-radius: 20px;
}

/* === POPRAWKA: INTENSYWNA CZERWONA POŚWIATA (GLOW) === */
.memory-card.active .card-inner {
    /* Mieszanka cienia zewnętrznego i wewnętrznego dla efektu "neonowego" świecenia */
    box-shadow: 0 0 25px rgba(255, 0, 0, 0.9), inset 0 0 15px rgba(255, 0, 0, 0.4);
    border: 1px solid rgba(255, 0, 0, 0.6);
    /* Delikatna czerwona ramka dla wzmocnienia */
}

.memory-card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    inset: 0;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 20px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Glassmorphism */
.card-front {
    z-index: 2;
    background: rgba(15, 23, 42, 0.85) !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transform: rotateY(0deg);
}

/* Wymuszenie białego koloru dla tekstów wewnątrz karty */
.card-front h1,
.card-front h2,
.card-front h3,
.card-front p {
    color: #ffffff !important;
}

/* Styl dla napisu "obróć kartę" */
.card-front .rotate-hint {
    color: rgba(255, 255, 255, 0.6) !important;
}

.card-back {
    transform: rotateY(180deg);
    background: #0f172a;
    color: white;
    border: 2px solid #dc2626;
    /* Czerwone obramowanie rewersu */
    z-index: 1;
}

.card-icon {
    width: 80px;
    height: 80px;
    background: rgba(220, 38, 38, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: #ef4444;
    margin-bottom: 1.5rem;
}

/* Przyciski nawigacji */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 200;
    transition: 0.3s;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.carousel-btn:hover {
    background: #dc2626;
    color: white;
    border-color: #dc2626;
    transform: translateY(-50%) scale(1.1);
}

.prev-btn {
    left: 5%;
}

.next-btn {
    right: 5%;
}

/* === NEWS SLIDER - POPRAWKA WYMIARÓW === */
.news-slider-container {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 30px;
    /* Zwiększyłem nieco odstęp między kartami */
    padding-bottom: 40px;
    /* Więcej miejsca na dole na cień */
    width: 100%;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;

    /* Ważne: wyrównanie do góry, bo wysokość kart ustalamy niżej na sztywno */
    align-items: flex-start;
}

.news-slider-container::-webkit-scrollbar {
    display: none;
}

.news-slide {
    /* === SZTYWNE WYMIARY (DESKTOP) === */
    /* !important nadpisuje klasy Tailwind z HTMLa */
    flex: 0 0 380px !important;
    width: 380px !important;
    max-width: 380px !important;

    /* Ustawiamy jedną wysokość dla wszystkich */
    height: 550px !important;
    min-height: 550px !important;

    scroll-snap-align: center;

    /* Układ wewnętrzny karty */
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    /* To rozciągnie treść i dociśnie guzik do dołu */
    overflow: hidden;
    position: relative;
    background: #f8fafc;
    /* Jasne tło jako fallback */
}

/* Wewnętrzny kontener z tekstem (żeby wypełniał pustą przestrzeń) */
.news-slide>div:last-child {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    height: 100%;
    justify-content: space-between;
    /* Rozkłada tekst i przycisk */
}

/* === RWD / MOBILE === */
@media (max-width: 1024px) {

    /* Na tabletach trochę mniejsze */
    .news-slide {
        flex: 0 0 320px !important;
        width: 320px !important;
        height: 520px !important;
        min-height: 520px !important;
    }
}

@media (max-width: 768px) {
    .mobile-instruction-hide {
        display: none !important;
    }

    /* Na telefonach szerokość prawie całego ekranu */
    .news-slide {
        flex: 0 0 85vw !important;
        width: 85vw !important;
        max-width: 85vw !important;

        /* Wysokość na telefonie */
        height: 500px !important;
        min-height: 500px !important;
        margin-right: 15px;
        /* Margines po prawej żeby widzieć kolejną kartę */
    }

    .news-slider-container {
        padding-left: 20px;
        /* Padding z lewej żeby pierwsza karta nie była przyklejona */
        padding-right: 20px;
    }
}

/* === RWD / MOBILE === */
@media (max-width: 1024px) {
    :root {
        --card-width: 260px;
        --card-height: 380px;
        --carousel-radius: 350px;
    }
}

@media (max-width: 768px) {
    .mobile-instruction-hide {
        display: none !important;
    }

    .news-slide {
        /* Na mobilu szerokość to 85% ekranu */
        flex: 0 0 85vw;
        width: 85vw;
        max-width: 85vw;
    }

    .carousel-section {
        height: auto;
        padding: 60px 0;
        perspective: none;
        overflow: visible;
    }

    .carousel {
        display: flex;
        width: 100%;
        height: auto;
        padding: 20px;
        gap: 15px;
        transform: none !important;
        transform-style: flat;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .carousel::-webkit-scrollbar {
        display: none;
    }

    .memory-card {
        position: relative;
        left: auto !important;
        top: auto !important;
        transform: none !important;
        flex: 0 0 85vw;
        height: 450px;
        margin: 0;
        scroll-snap-align: center;
        filter: none !important;
        opacity: 1 !important;
        perspective: 1000px;
        z-index: 10;
    }

    .carousel-btn {
        display: none;
    }

    .card-back {
        overflow-y: auto;
    }

    /* Poprawka slidera logotypów na mobile */
    .partners-slider-container {
        padding: 10px 0;
        mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
        -webkit-mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
    }

    .logo-slide {
        width: 130px;
        padding: 0 15px;
        height: 60px;
    }

    .logo-slide img {
        max-height: 35px;
        filter: grayscale(0%);
        opacity: 0.8;
    }

    .logo-track {
        width: calc(130px * 20);
        animation: scrollMobile 20s linear infinite;
    }

    @keyframes scrollMobile {
        0% {
            transform: translateX(0);
        }

        100% {
            transform: translateX(calc(-130px * 5));
        }
    }
}

/* === POPRAWKA ODSTĘPU DLA STRON SPECJALNYCH === */
/* Dodajemy padding dla body tylko tam, gdzie to konieczne */
body.page-id-1261,
body.page-id-1317 {
    padding-top: 80px !important;
}

.admin-bar.page-id-1261,
.admin-bar.page-id-1317 {
    padding-top: 112px !important;
}

@media (max-width: 1024px) {

    body.page-id-1261,
    body.page-id-1317 {
        padding-top: 70px !important;
    }
}

/* === INFINITE LOGO SLIDER === */
.partners-slider-container {
    width: 100%;
    overflow: hidden;
    position: relative;
    padding: 20px 0;
    mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
}

.logo-track {
    display: flex;
    width: calc(250px * 20);
    animation: scroll 25s linear infinite;
}

.logo-slide {
    width: 250px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 40px;
    flex-shrink: 0;
}

.logo-slide img {
    max-height: 60px;
    width: auto;
    filter: grayscale(100%);
    opacity: 0.6;
    transition: all 0.3s ease;
    object-fit: contain;
}

/* Hover tylko na PC */
@media (min-width: 1025px) {
    .logo-slide img:hover {
        filter: grayscale(0%);
        opacity: 1;
        transform: scale(1.1);
    }

    .logo-track:hover {
        animation-play-state: paused;
    }
}

@keyframes scroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(calc(-250px * 5));
    }
}

/* === INNE STYLE (HERO, NAV, DROPDOWN) === */
.hero-bg {
    background-color: #f1f5f9;
    background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
    background-size: 40px 40px;
}

.bg-pattern-cubes {
    background-image: url('https://www.transparenttextures.com/patterns/cubes.png');
}

.flag-wave {
    position: absolute;
    top: 20%;
    left: -5%;
    width: 300px;
    height: 400px;
    opacity: 0.1;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(to right, #ffffff 50%, #dc2626 50%);
    animation: flag-wave 6s ease-in-out infinite;
    transform-origin: center center;
    filter: blur(40px);
    border-radius: 50%;
}

@keyframes flag-wave {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(20px, 20px) scale(1.1);
    }
}

.flag-icon-large {
    display: inline-block;
    width: 60px;
    height: auto;
    vertical-align: middle;
    margin-left: 15px;
    animation: wave-flag 3s ease-in-out infinite;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

@keyframes wave-flag {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(3deg);
    }

    75% {
        transform: rotate(-3deg);
    }
}

.nav-link {
    position: relative;
    color: #4b5563;
    font-weight: 500;
    transition: color 0.3s;
    cursor: pointer;
}

.nav-link:hover {
    color: #dc2626;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: #dc2626;
    transition: width 0.3s;
}

.nav-link:hover::after {
    width: 100%;
}

.group:hover .dropdown-menu {
    display: block;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.dropdown-menu {
    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 200px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 10px 0;
    z-index: 50;
    border: 1px solid #f1f5f9;
    border-top: 3px solid #dc2626;
}

.dropdown-item {
    display: block;
    padding: 10px 20px;
    color: #4b5563;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.dropdown-item:hover {
    background-color: #f8fafc;
    color: #dc2626;
    padding-left: 25px;
    border-left: 3px solid #dc2626;
}