/* Styles for Allies Section */
.allies-section {
    background-color: rgba(248, 0, 0, 0.05);
    padding: 80px 0;
    position: relative;
    z-index: 1;
    background-image: radial-gradient(circle at 20% 80%, rgba(248, 0, 0, 0.1) 0%, transparent 25%), 
                      radial-gradient(circle at 80% 20%, rgba(173, 253, 0, 0.1) 0%, transparent 25%);
}

.allies-section .container {
    max-width: 1200px; /* Zwiększona szerokość kontenera dla lepszego dopasowania kart w linii */
    margin: 0 auto;
    padding: 0 20px;
}

.allies-section .section-title {
    margin-bottom: 20px;
}

.allies-intro {
    max-width: 800px;
    margin: 0 auto 40px;
    text-align: center;
    font-size: 1.1rem;
    color: white;
    font-weight: 400;
}

.allies-grid {
    display: flex;
    flex-wrap: nowrap; /* Uniemożliwia zawijanie */
    justify-content: flex-start; /* Karty zaczynają się od lewej */
    gap: 25px; /* Większy odstęp dla lepszego wyglądu */
    overflow-x: auto; /* Dodaje przewijanie w poziomie jeśli karty nie mieszczą się */
    padding: 20px 10px; /* Większy padding dla lepszego wyglądu przy przewijaniu */
    scroll-snap-type: x mandatory; /* Lepsze doświadczenie przewijania */
    -webkit-overflow-scrolling: touch; /* Płynniejsze przewijanie na urządzeniach mobilnych */
    margin: 0 -10px; /* Negative margin to counter container padding */
    position: relative;
}

.allies-grid::before, .allies-grid::after {
    content: '';
    position: absolute;
    top: 0;
    width: 80px;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}


.ally-card {
    background: var(--background-dark);
    border-radius: 20px;
    overflow: hidden;
    width: 280px; /* Zwiększona szerokość dla lepszej prezentacji */
    flex: 0 0 auto; /* Zapobiega rozciąganiu się kart */
    scroll-snap-align: start; /* Lepsze dopasowanie przy przewijaniu */
    box-shadow: 0 15px 25px rgba(0, 0, 0, 0.3), 0 0 0 2px rgba(248, 0, 0, 0.2);
    transition: all 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
    transform-style: preserve-3d;
    perspective: 1000px;
}

.ally-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(to right, var(--ladybug-red), var(--cat-noir-green));
    z-index: 3;
}

.ally-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 0 2px var(--ladybug-red);
}

.ally-avatar {
    position: relative;
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background: linear-gradient(145deg, rgba(15, 15, 26, 0.8) 0%, rgba(30, 30, 50, 0.9) 100%);
}

.ally-avatar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(248, 0, 0, 0.1), transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(173, 253, 0, 0.1), transparent 40%);
    z-index: 1;
    opacity: 0.3;
    transition: opacity 0.5s ease;
}

.ally-card:hover .ally-avatar::before {
    opacity: 1;
}

.ally-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.165, 0.84, 0.44, 1);
    z-index: 2;
    position: relative;
    filter: brightness(1.05) contrast(1.05);
}

.ally-card:hover .ally-avatar img {
    transform: scale(1.08) translateY(-5px);
}

/* Avatar placeholders */
.avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 6rem;
    font-family: 'Permanent Marker', cursive;
    color: rgba(255, 255, 255, 0.9);
    position: relative;
    text-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.8s cubic-bezier(0.33, 1, 0.68, 1);
    overflow: hidden;
    position: relative;
}

.avatar-placeholder::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    opacity: 0.4;
    z-index: 1;
    transition: all 0.5s ease;
}

.miraculous-logo-overlay {
    position: absolute;
    width: 50%;
    height: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><path fill="rgba(255,255,255,0.25)" d="M50,5 C60,20 80,20 95,25 C80,40 80,60 95,75 C80,80 60,80 50,95 C40,80 20,80 5,75 C20,60 20,40 5,25 C20,20 40,20 50,5 Z"/></svg>');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.6;
    z-index: 2;
}

.avatar-placeholder::before {
    content: attr(data-initial);
    position: absolute;
    font-size: 12rem;
    opacity: 0.1;
    z-index: 1;
}

.avatar-placeholder::after {
    content: attr(data-initial);
    position: relative;
    z-index: 2;
}

.ally-card:hover .avatar-placeholder {
    transform: scale(1.08) translateY(-5px);
}

.ally-miraculous {
    position: absolute;
    bottom: -25px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--ladybug-red);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3), 0 0 0 4px var(--background-dark);
    z-index: 999; /* Zwiększony z-index, aby być na samym wierzchu */
    transition: all 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    transform: translateZ(30px);
}

.ally-miraculous::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: inherit;
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.5s ease;
    filter: blur(10px);
    transform: scale(1.2);
}

.ally-card:hover .ally-miraculous {
    transform: translateZ(50px) scale(1.2); /* Większa skala dla lepszego efektu "na wierzchu" */
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), 0 0 0 4px var(--background-dark); /* Mocniejszy cień */
}

.ally-card:hover .ally-miraculous::after {
    opacity: 0.6; /* Mocniejszy efekt poświaty */
}

.ally-miraculous i {
    font-size: 26px;
    transition: transform 0.5s ease;
}

.ally-card:hover .ally-miraculous i {
    transform: rotateY(360deg);
}

.ally-info {
    padding: 30px 20px 20px;
    background-color: rgba(20, 20, 35, 0.95);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    border-top: 2px solid rgba(248, 0, 0, 0.3);
    position: relative;
    z-index: 3;
    box-shadow: 0 -10px 20px rgba(0, 0, 0, 0.1);
}

.ally-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40"><circle cx="20" cy="20" r="3" fill="rgba(248,0,0,0.1)"/></svg>');
    opacity: 0.3;
    z-index: -1;
    pointer-events: none;
}

.ally-info h3 {
    margin: 0 0 8px;
    font-family: 'Permanent Marker', cursive;
    color: white;
    font-size: 1.6rem;
    position: relative;
    display: inline-block;
    text-shadow: 0 2px 10px rgba(248, 0, 0, 0.3);
}

.ally-info h3::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(to right, var(--ladybug-red), transparent);
}

.ally-role {
    color: var(--cat-noir-green);
    font-weight: 700;
    margin-bottom: 15px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    display: inline-block;
    padding: 3px 10px;
    background-color: rgba(173, 253, 0, 0.15);
    border-radius: 4px;
    position: relative;
    z-index: 10;
}

.ally-desc {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 20px;
    flex-grow: 1;
    /* Maksymalnie 3 linijki tekstu dla lepszego dopasowania */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
    padding-left: 15px;
    border-left: 3px solid rgba(248, 0, 0, 0.3);
}

.ally-desc::before {
    content: '\201C';
    position: absolute;
    top: 0;
    left: 6px;
    color: var(--ladybug-red);
    font-size: 1.2em;
    opacity: 0.5;
}

.ally-desc::after {
    content: '\201D';
    color: var(--ladybug-red);
    font-size: 1.2em;
    opacity: 0.5;
}

.ally-socials {
    display: flex;
    gap: 15px;
    position: relative;
    z-index: 1000; /* Jeszcze wyższy z-index dla kontenera */
    padding: 10px 0;
    margin-top: 5px;
}

.ally-social-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--background-dark), rgba(30, 30, 50, 1));
    color: var(--cat-noir-green);
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    border: 1px solid rgba(173, 253, 0, 0.3);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 999; /* Wysoki z-index dla ikon społecznościowych */
}

.ally-social-icon::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    box-shadow: 0 0 0 2px var(--cat-noir-green);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.ally-social-icon:hover {
    transform: translateY(-5px) scale(1.15);
    color: white;
    background: var(--ladybug-red);
    border-color: transparent;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), 0 0 15px rgba(248, 0, 0, 0.4);
}

.ally-social-icon.twitter-icon {
    background: linear-gradient(145deg, #1c9cea, #0c7abf);
    color: white;
    border-color: transparent;
}

.ally-social-icon.artstation-icon {
    background: linear-gradient(145deg, #13aff0, #0890cf);
    color: white;
    border-color: transparent;
}

.ally-social-icon.globe-icon {
    background: linear-gradient(145deg, #4caf50, #388e3c);
    color: white;
    border-color: transparent;
}

/* Style dla wszystkich ikon społecznościowych */
.ally-social-icon .fab.fa-youtube {
    color: white;
    background: linear-gradient(145deg, #ff0000, #cc0000);
    border-radius: 50%;
    padding: 0.15em;
}

.ally-social-icon .fab.fa-instagram {
    color: white;
    background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%);
    border-radius: 50%;
    padding: 0.15em;
}

.ally-social-icon .fab.fa-twitch {
    color: white;
    background: linear-gradient(145deg, #9146ff, #7a32e6);
    border-radius: 50%;
    padding: 0.15em;
}

.ally-social-icon .fab.fa-discord {
    color: white;
    background: linear-gradient(145deg, #5865f2, #4752c4);
    border-radius: 50%;
    padding: 0.15em;
}

.ally-social-icon .fab.fa-spotify {
    color: white;
    background: linear-gradient(145deg, #1db954, #1aa64b);
    border-radius: 50%;
    padding: 0.15em;
}

.ally-social-icon .fab.fa-soundcloud {
    color: white;
    background: linear-gradient(145deg, #ff7700, #cc5f00);
    border-radius: 50%;
    padding: 0.15em;
}

.ally-social-icon:hover::after {
    opacity: 1;
    transform: scale(1.15);
}

/* Add miraculous necklace animation on hover */
.ally-card:hover .ally-miraculous {
    animation: miraculous-pulse 2s infinite;
}

/* Dodatkowa animacja dla ikon Miraculum */
.ally-miraculous i {
    transform-origin: center;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ally-card:hover .ally-miraculous i {
    transform: scale(1.2) rotateY(360deg);
    animation: icon-pulse 1.5s ease-in-out infinite alternate;
}

@keyframes icon-pulse {
    from { text-shadow: 0 0 5px rgba(255, 255, 255, 0.6); }
    to { text-shadow: 0 0 12px rgba(255, 255, 255, 0.9), 0 0 20px currentColor; }
}

/* Dodatkowa animacja dla ikon Miraculum */
.ally-miraculous i {
    transform-origin: center;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ally-card:hover .ally-miraculous i {
    transform: scale(1.2) rotateY(360deg);
    animation: icon-pulse 1.5s ease-in-out infinite alternate;
}

@keyframes icon-pulse {
    from { text-shadow: 0 0 5px rgba(255, 255, 255, 0.6); }
    to { text-shadow: 0 0 12px rgba(255, 255, 255, 0.9), 0 0 20px currentColor; }
}

@keyframes miraculous-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(229, 30, 37, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(229, 30, 37, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(229, 30, 37, 0);
    }
}

/* Animacja pojawiania się kart */
@keyframes card-appear {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ally-card {
    animation: card-appear 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.ally-card:nth-child(1) {
    animation-delay: 0.1s;
}

.ally-card:nth-child(2) {
    animation-delay: 0.2s;
}

.ally-card:nth-child(3) {
    animation-delay: 0.3s;
}

.ally-card:nth-child(4) {
    animation-delay: 0.4s;
}

/* Different miraculous icon colors */
.ally-card:nth-child(1) .ally-miraculous {
    background-color: #ff7b00; /* Fox miraculous color */
}

.ally-card:nth-child(2) .ally-miraculous {
    background-color: #00a7e1; /* Dragon miraculous color */
}

.ally-card:nth-child(3) .ally-miraculous {
    background-color: #ffd700; /* Bee miraculous color */
}

.ally-card:nth-child(4) .ally-miraculous {
    background-color: #97c93d; /* Turtle miraculous color */
}

/* Scroll Indicator */
.scroll-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px auto 20px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    max-width: 300px;
    background: rgba(248, 0, 0, 0.1);
    padding: 8px 15px;
    border-radius: 30px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    position: relative;
}

.scroll-indicator::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--ladybug-red), var(--cat-noir-green));
    opacity: 0.1;
    z-index: -1;
}

.scroll-arrow {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: white;
    background: var(--ladybug-red);
    margin: 0 10px;
    font-size: 0.8rem;
    animation: pulse-arrow 2s infinite;
}

.scroll-arrow.right {
    background: var(--cat-noir-green);
    animation-delay: 0.5s;
}

@keyframes pulse-arrow {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.15);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0.8;
    }
}

.scroll-hint {
    margin: 0;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Style dla wskaźnika przewijania */
.scroll-indicator {
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.scroll-indicator:hover {
    opacity: 1;
    transform: scale(1.05);
}

.scroll-indicator.show-indicator {
    opacity: 1;
}

.scroll-arrow {
    cursor: pointer;
    transition: transform 0.3s ease;
}

.scroll-arrow:hover {
    transform: scale(1.2);
}

/* Animacja dla kart - pojawienie się przy scrollowaniu */
.ally-card {
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.ally-card.visible {
    opacity: 1;
}

/* Media queries */
@media (max-width: 1200px) {
    .allies-grid {
        justify-content: flex-start; /* Lepsze ustawienie na mniejszych ekranach */
        padding-bottom: 20px; /* Dodatkowy padding na dole dla scrollbara */
    }
    
    .ally-card {
        width: 230px; /* Nieco mniejsza szerokość dla lepszego dopasowania */
    }
}

@media (max-width: 768px) {
    .allies-grid {
        /* Zachowujemy poziomy układ, ale zmniejszamy szerokość kart */
        gap: 10px;
        padding-bottom: 70px; /* Dodatkowy padding na dole dla nawigacji mobilnej */
    }
    
    .ally-card {
        width: 200px;
    }
    
    .ally-info h3 {
        font-size: 1.3rem;
    }
    
    .ally-role {
        font-size: 0.8rem;
    }
    
    .ally-desc {
        font-size: 0.85rem;
    }
    
    /* Dodatkowe style dla sekcji na urządzeniach mobilnych */
    .allies-section {
        padding-bottom: 100px; /* Większy padding na dole dla nawigacji mobilnej */
    }
}

/* Dodajemy scrollbar styles dla lepszego wyglądu */
.allies-grid::-webkit-scrollbar {
    height: 8px;
}

.allies-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.allies-grid::-webkit-scrollbar-thumb {
    background: var(--ladybug-red);
    border-radius: 10px;
}

.allies-grid::-webkit-scrollbar-thumb:hover {
    background: var(--cat-noir-green);
}