/* ========================================
   CATAMON - Holographic Cat Cards Gallery
   Vanilla CSS with 3D Transform Effects
   ======================================== */

/* CSS Variables for customization - Inspired by Catamon Logo */
:root {
    --bg-color: #2d1b69;
    --bg-gradient-start: #2d1b69;
    --bg-gradient-end: #1a0f3d;
    --text-color: #eee;
    --accent-color: #ffd700;
    --card-bg: #3d2584;
    --card-border: #5a3ba8;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #393c41;
    background-attachment: fixed;
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Loading Screen */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #393c41;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 215, 0, 0.2);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading p {
    font-size: 1.2rem;
    margin: 0.5rem 0;
}

.loading-count {
    color: var(--accent-color);
    font-weight: bold;
}


/* Header */
header {
    text-align: center;
    padding: 2rem 1rem;
    background: #fff2bd;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.site-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.header-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

header h1 {
    font-size: 3rem;
    margin: 0;
    color: #2d1b69;
    text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.3);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.8;
    margin: 0;
    color: #5a3ba8;
}

/* Filters Container */
.filters-container {
    background: rgba(255, 242, 189, 0.95);
    border-bottom: 3px solid rgba(45, 27, 105, 0.2);
    padding: 1rem 2rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.filters {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    max-width: 1400px;
    margin: 0 auto;
}

.filter-btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 20px;
    background: white;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.filter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.filter-btn.active {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Couleurs spécifiques par rareté */
.filter-btn[data-rarity="all"] {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.filter-btn[data-rarity="all"]:hover,
.filter-btn[data-rarity="all"].active {
    border-color: #764ba2;
}

.filter-btn[data-rarity="1"] {
    background: #f0f0f0;
    color: #333;
}

.filter-btn[data-rarity="1"].active {
    border-color: #999;
    background: #ffffff;
}

.filter-btn[data-rarity="2"] {
    background: #ffffff;
    color: #333;
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.3);
}

.filter-btn[data-rarity="2"].active {
    border-color: #ddd;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.5);
}

.filter-btn[data-rarity="3"] {
    background: linear-gradient(135deg, #d4d4d4 0%, #ffffff 50%, #c0c0c0 100%);
    color: #333;
}

.filter-btn[data-rarity="3"].active {
    border-color: #999;
    box-shadow: 0 4px 12px rgba(192, 192, 192, 0.6);
}

.filter-btn[data-rarity="4"] {
    background: linear-gradient(135deg, #ff0000 0%, #ffff00 25%, #00ff00 50%, #0000ff 75%, #8b00ff 100%);
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.filter-btn[data-rarity="4"].active {
    border-color: #ffd700;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.6);
}

.filter-btn[data-rarity="5"] {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 50%, #daa520 100%);
    color: #333;
}

.filter-btn[data-rarity="5"].active {
    border-color: #b8860b;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.8);
}

/* Gallery Grid */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    padding: 3rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Card Container */
.card {
    perspective: 1000px;
    position: relative;
    height: auto;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.card.hidden {
    display: none;
}

/* Card Inner - This rotates in 3D */
.card-inner {
    position: relative;
    width: 300px;
    height: 420px;
    transform-style: preserve-3d;
    transform: translateZ(0); /* Hardware acceleration */
    transition: transform 0.1s ease-out;
    will-change: transform;
    border-radius: 15px;
    overflow: hidden;
    background: var(--card-bg);
    border: 8px solid var(--card-border); /* Bordure épaisse style Pokémon */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    margin: 0 auto; /* Centre la carte si le conteneur est plus large */
}

/* Bordures selon la rareté - Style Pokémon */

/* Common (1 étoile) - Bordure blanche */
.card[data-rarity="1"] .card-inner {
    border-color: #f0f0f0;
    border-width: 8px;
}

/* Rare (2 étoiles) - Bordure blanche */
.card[data-rarity="2"] .card-inner {
    border-color: #ffffff;
    border-width: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5),
                0 0 20px rgba(255, 255, 255, 0.3);
}

/* Epic (3 étoiles) - Bordure argentée métallique avec relief et texture */
.card[data-rarity="3"] .card-inner {
    border: 8px solid transparent;
    background: linear-gradient(var(--card-bg), var(--card-bg)) padding-box,
                linear-gradient(
                    145deg,
                    #6b6b6b 0%,
                    #9e9e9e 8%,
                    #d4d4d4 16%,
                    #f8f8f8 24%,
                    #ffffff 32%,
                    #f0f0f0 40%,
                    #b8b8b8 48%,
                    #e8e8e8 56%,
                    #ffffff 64%,
                    #d0d0d0 72%,
                    #a8a8a8 80%,
                    #8a8a8a 88%,
                    #6b6b6b 100%
                ) border-box;
    box-shadow:
                /* Ombre externe profonde */
                0 12px 35px rgba(0, 0, 0, 0.6),
                /* Aura argentée proche */
                0 0 15px rgba(160, 160, 160, 0.8),
                /* Aura argentée lointaine */
                0 0 35px rgba(200, 200, 200, 0.5),
                /* Relief intérieur - highlight haut */
                inset 0 3px 8px rgba(255, 255, 255, 0.7),
                /* Relief intérieur - ombre bas */
                inset 0 -3px 8px rgba(0, 0, 0, 0.4),
                /* Relief intérieur - côté gauche */
                inset 3px 0 6px rgba(255, 255, 255, 0.3),
                /* Relief intérieur - côté droit */
                inset -3px 0 6px rgba(0, 0, 0, 0.2);
    position: relative;
}

/* Reflet métallique animé pour Epic */
.card[data-rarity="3"] .card-inner::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    background: linear-gradient(
        125deg,
        transparent 0%,
        transparent 30%,
        rgba(255, 255, 255, 0.2) 40%,
        rgba(255, 255, 255, 0.9) 48%,
        rgba(255, 255, 255, 1) 50%,
        rgba(255, 255, 255, 0.9) 52%,
        rgba(255, 255, 255, 0.2) 60%,
        transparent 70%,
        transparent 100%
    );
    background-size: 250% 250%;
    animation: silverShine 4.5s ease-in-out infinite;
    pointer-events: none;
    border-radius: 15px;
    z-index: -1;
    mix-blend-mode: screen;
}

/* Texture métallique subtile */
.card[data-rarity="3"] .card-inner::after {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    background:
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(255, 255, 255, 0.03) 2px,
            rgba(255, 255, 255, 0.03) 4px
        ),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.02) 2px,
            rgba(0, 0, 0, 0.02) 4px
        );
    border-radius: 15px;
    pointer-events: none;
    z-index: -1;
    opacity: 0.6;
}

@keyframes silverShine {
    0% {
        background-position: -150% -150%;
        opacity: 0.7;
    }
    50% {
        background-position: 150% 150%;
        opacity: 1;
    }
    100% {
        background-position: -150% -150%;
        opacity: 0.7;
    }
}

/* Legendary (4 étoiles) - Bordure arc-en-ciel brillante avec coins arrondis */
.card[data-rarity="4"] .card-inner {
    border: 8px solid transparent;
    background: linear-gradient(var(--card-bg), var(--card-bg)) padding-box,
                linear-gradient(
                    135deg,
                    #ff0000 0%,
                    #ff7f00 16%,
                    #ffff00 33%,
                    #00ff00 50%,
                    #0000ff 66%,
                    #8b00ff 83%,
                    #ff0000 100%
                ) border-box;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5),
                0 0 30px rgba(255, 215, 0, 0.6),
                inset 0 0 20px rgba(255, 255, 255, 0.4);
    position: relative;
}

/* Animation arc-en-ciel pour Legendary */
.card[data-rarity="4"] .card-inner::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    background: linear-gradient(
        90deg,
        rgba(255, 0, 0, 0.5),
        rgba(255, 127, 0, 0.5),
        rgba(255, 255, 0, 0.5),
        rgba(0, 255, 0, 0.5),
        rgba(0, 0, 255, 0.5),
        rgba(139, 0, 255, 0.5),
        rgba(255, 0, 0, 0.5)
    );
    background-size: 200% 100%;
    animation: rainbowShine 4s linear infinite;
    pointer-events: none;
    border-radius: 15px;
    z-index: -1;
    opacity: 0.8;
}

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

/* Mythic (5 étoiles) - Bordure dorée métallique avec relief sculpté (GIFs uniquement) */
.card[data-rarity="5"] .card-inner {
    border: 8px solid transparent;
    background: linear-gradient(var(--card-bg), var(--card-bg)) padding-box,
                linear-gradient(
                    155deg,
                    #5d4a1f 0%,
                    #8b6914 7%,
                    #b8860b 14%,
                    #cd9b1d 21%,
                    #daa520 28%,
                    #f0c420 35%,
                    #ffd700 42%,
                    #ffed4e 49%,
                    #fff8dc 56%,
                    #ffed4e 63%,
                    #ffd700 70%,
                    #daa520 77%,
                    #b8860b 84%,
                    #8b6914 91%,
                    #5d4a1f 100%
                ) border-box;
    box-shadow:
                /* Ombre externe profonde */
                0 14px 40px rgba(0, 0, 0, 0.7),
                /* Aura dorée intense proche */
                0 0 20px rgba(255, 215, 0, 1),
                /* Aura dorée moyenne */
                0 0 40px rgba(218, 165, 32, 0.8),
                /* Aura dorée lointaine */
                0 0 60px rgba(255, 237, 78, 0.6),
                /* Relief intérieur - highlight haut doré */
                inset 0 4px 12px rgba(255, 248, 220, 0.9),
                /* Relief intérieur - ombre bas bronze */
                inset 0 -4px 12px rgba(93, 74, 31, 0.6),
                /* Relief intérieur - côté gauche brillant */
                inset 4px 0 10px rgba(255, 237, 78, 0.5),
                /* Relief intérieur - côté droit ombré */
                inset -4px 0 10px rgba(139, 105, 20, 0.4);
    position: relative;
}

/* Reflet doré éclatant animé pour Mythic */
.card[data-rarity="5"] .card-inner::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    background: linear-gradient(
        135deg,
        transparent 0%,
        transparent 28%,
        rgba(255, 237, 78, 0.3) 38%,
        rgba(255, 248, 220, 0.8) 46%,
        rgba(255, 255, 255, 1) 50%,
        rgba(255, 248, 220, 0.8) 54%,
        rgba(255, 237, 78, 0.3) 62%,
        transparent 72%,
        transparent 100%
    );
    background-size: 300% 300%;
    animation: goldShine 5.5s ease-in-out infinite;
    pointer-events: none;
    border-radius: 15px;
    z-index: -1;
    mix-blend-mode: screen;
}

/* Texture d'or gravée */
.card[data-rarity="5"] .card-inner::after {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    background:
        repeating-linear-gradient(
            95deg,
            transparent,
            transparent 1.5px,
            rgba(255, 215, 0, 0.05) 1.5px,
            rgba(255, 215, 0, 0.05) 3px
        ),
        repeating-linear-gradient(
            5deg,
            transparent,
            transparent 1.5px,
            rgba(139, 105, 20, 0.03) 1.5px,
            rgba(139, 105, 20, 0.03) 3px
        );
    border-radius: 15px;
    pointer-events: none;
    z-index: -1;
    opacity: 0.7;
}

@keyframes goldShine {
    0% {
        background-position: -200% -200%;
        opacity: 0.75;
    }
    50% {
        background-position: 200% 200%;
        opacity: 1;
    }
    100% {
        background-position: -200% -200%;
        opacity: 0.75;
    }
}

/* Holographic Layer - This creates the rainbow effect */
.card-holographic {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        125deg,
        rgba(255, 0, 0, 0) 0%,
        rgba(255, 0, 0, 0.3) 20%,
        rgba(255, 255, 0, 0.3) 40%,
        rgba(0, 255, 0, 0.3) 60%,
        rgba(0, 255, 255, 0.3) 80%,
        rgba(0, 0, 255, 0) 100%
    );
    opacity: 0;
    mix-blend-mode: color-dodge;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 2;
}

/* Show holographic effect on hover ONLY for Legendary cards (rarity 4) */
.card[data-rarity="4"]:hover .card-holographic {
    opacity: 0.7;
}

/* HP Display - Top Right */
.card-hp {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 68, 68, 0.9);
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.3rem 0.6rem;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    z-index: 3;
    backdrop-filter: blur(4px);
}

/* Card Image */
.card-image {
    position: relative;
    width: 100%;
    height: 280px;
    flex-shrink: 0;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Card Info Section */
.card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0.5rem 1rem 1rem 1rem;
    background: linear-gradient(to bottom, var(--card-bg), #0a0e27);
    position: relative;
    z-index: 1;
}

.card-info h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--accent-color);
    text-align: center;
}

/* Attacks Section */
.attacks {
    width: 100%;
    margin-top: 0rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.attack {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 0.4rem;
    backdrop-filter: blur(4px);
}

.attack-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.2rem;
}

.attack-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: #ffd700;
    text-transform: uppercase;
}

.attack-damage {
    font-size: 0.9rem;
    font-weight: 700;
    color: #ff4444;
    background: rgba(255, 68, 68, 0.2);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

.attack-details {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.65rem;
}

.attack-cost {
    font-size: 0.8rem;
    line-height: 1;
}

.attack-desc {
    color: #ccc;
    font-style: italic;
}

.card-stats {
    position: absolute;
    bottom: 8px;
    left: 8px;
    display: flex;
    gap: 0.3rem;
    font-size: 0.65rem;
    color: #aaa;
}

.stat {
    background: rgba(255, 255, 255, 0.15);
    padding: 0.2rem 0.5rem;
    border-radius: 8px;
    backdrop-filter: blur(4px);
}

.card-number {
    position: absolute;
    bottom: 8px;
    right: 8px;
    font-size: 0.65rem;
    color: #888;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.2rem 0.5rem;
    border-radius: 8px;
    backdrop-filter: blur(4px);
    font-weight: 600;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    margin-top: 2rem;
    border-top: 2px solid rgba(102, 126, 234, 0.3);
}

footer p {
    margin: 0.5rem 0;
}

.hint {
    color: var(--accent-color);
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Header mobile */
    header {
        padding: 1.5rem 1rem;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .site-logo {
        width: 60px;
        height: 60px;
    }

    .header-text {
        align-items: center;
        text-align: center;
    }

    header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    /* Filtres mobile */
    .filters-container {
        padding: 0.8rem 0.5rem;
    }

    .filters {
        gap: 0.4rem;
        padding: 0 0.5rem;
    }

    .filter-btn {
        padding: 0.5rem 0.7rem;
        font-size: 0.75rem;
        border-radius: 15px;
    }

    /* Galerie mobile - 1 colonne */
    .gallery {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1.5rem 1rem;
        max-width: 100%;
    }

    /* Cartes mobile - card-inner a déjà ses dimensions fixes */
    .card {
        width: 100%;
        max-width: 100%;
        margin: 0;
    }

    .card-inner {
        /* Dimensions déjà définies : 300px x 420px */
        border-width: 6px;
    }

    .card-image {
        height: 250px;
    }

    .card-info {
        padding: 0.5rem 0.8rem 0.8rem 0.8rem;
    }

    .card-info h3 {
        font-size: 1.1rem;
        margin-bottom: 0.4rem;
    }

    /* HP mobile */
    .card-hp {
        top: 6px;
        right: 6px;
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    /* Attaques mobile */
    .attacks {
        gap: 0.4rem;
    }

    .attack {
        padding: 0.35rem;
    }

    .attack-name {
        font-size: 0.7rem;
    }

    .attack-damage {
        font-size: 0.8rem;
        padding: 0.1rem 0.3rem;
    }

    .attack-cost {
        font-size: 0.75rem;
    }

    .attack-desc {
        font-size: 0.6rem;
    }

    /* Stats et numéro mobile */
    .card-stats {
        bottom: 6px;
        left: 6px;
        font-size: 0.6rem;
    }

    .stat {
        padding: 0.15rem 0.4rem;
    }

    .card-number {
        bottom: 6px;
        right: 6px;
        font-size: 0.6rem;
        padding: 0.15rem 0.4rem;
    }

    /* Footer mobile */
    footer {
        padding: 1.5rem 1rem;
        font-size: 0.9rem;
    }

    /* Loading mobile */
    .loading p {
        font-size: 1rem;
    }

    .loading-spinner {
        width: 50px;
        height: 50px;
    }
}

/* Petits téléphones */
@media (max-width: 400px) {
    header h1 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .site-logo {
        width: 50px;
        height: 50px;
    }

    .filter-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.7rem;
    }


    .card-image {
        height: 220px;
    }

    .card-info h3 {
        font-size: 1rem;
    }
}

/* Désactiver les effets de survol sur tactile */
@media (hover: none) and (pointer: coarse) {
    .filter-btn:hover {
        transform: none;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    }

    .card:hover .card-inner::after {
        display: none;
    }

    /* Augmenter la zone tactile des boutons */
    .filter-btn {
        min-height: 44px;
        padding: 0.6rem 1rem;
    }
}

/* Performance Optimizations */
.card-inner,
.card-holographic {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Add shimmer animation for extra polish */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.card:hover .card-inner::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
    pointer-events: none;
    z-index: 3;
    opacity: 0.3;
}

