/* ===================================
   COLLECTION PAGE - STUNNING DESIGN
   =================================== */

/* Variables de couleurs pour les raretés */
:root {
    --rarity-commune: linear-gradient(135deg, #606c88 0%, #3f4c6b 100%);
    --rarity-commune-glow: rgba(96, 108, 136, 0.3);
    --rarity-peu_commune: linear-gradient(135deg, #56CCF2 0%, #2F80ED 100%);
    --rarity-peu_commune-glow: rgba(86, 204, 242, 0.4);
    --rarity-rare: linear-gradient(135deg, #A8E6CF 0%, #3AB795 100%);
    --rarity-rare-glow: rgba(168, 230, 207, 0.4);
    --rarity-epique: linear-gradient(135deg, #C471F5 0%, #8E2DE2 100%);
    --rarity-epique-glow: rgba(196, 113, 245, 0.5);
    --rarity-legendaire: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    --rarity-legendaire-glow: rgba(255, 215, 0, 0.6);
}

/* ===================================
   STATS DE COLLECTION
   =================================== */

.collection-stats-card {
    background: linear-gradient(135deg, rgba(26, 31, 51, 0.95) 0%, rgba(20, 25, 41, 0.95) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* Cercle de progression */
.collection-progress-circle {
    width: 200px;
    height: 200px;
    margin: 0 auto;
}

.collection-progress-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.collection-progress-circle circle {
    fill: none;
    stroke-width: 8;
}

.collection-progress-circle .progress-bg {
    stroke: rgba(255, 255, 255, 0.1);
}

.collection-progress-circle .progress-bar {
    stroke: url(#progressGradient);
    stroke-dasharray: 534; /* 2 * PI * 85 */
    stroke-dashoffset: calc(534 - (534 * var(--percentage)) / 100);
    stroke-linecap: round;
    transition: stroke-dashoffset 2s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 0 10px rgba(86, 204, 242, 0.5));
}

.collection-progress-circle .progress-percentage {
    font-size: 32px;
    font-weight: bold;
    fill: #56CCF2;
    text-anchor: middle;
    dominant-baseline: middle;
    transform: rotate(90deg);
    transform-origin: center;
}

.collection-progress-circle .progress-label {
    font-size: 14px;
    fill: rgba(255, 255, 255, 0.7);
    text-anchor: middle;
    dominant-baseline: middle;
    transform: rotate(90deg);
    transform-origin: center;
}

/* Progression par rareté */
.rarity-progress-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

.rarity-progress-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(5px);
}

.rarity-progress-item.rarity-legendaire {
    border-left-color: #FFD700;
}

.rarity-progress-item.rarity-epique {
    border-left-color: #C471F5;
}

.rarity-progress-item.rarity-rare {
    border-left-color: #3AB795;
}

.rarity-progress-item.rarity-peu_commune {
    border-left-color: #56CCF2;
}

.rarity-progress-item.rarity-commune {
    border-left-color: #606c88;
}

.rarity-label {
    font-weight: 600;
    color: #fff;
    font-size: 1rem;
}

.rarity-count {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.rarity-progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.rarity-progress-bar .progress-bar {
    background: linear-gradient(90deg, #56CCF2 0%, #2F80ED 100%);
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.75rem;
    line-height: 8px;
}

.rarity-legendaire .rarity-progress-bar .progress-bar {
    background: linear-gradient(90deg, #FFD700 0%, #FFA500 100%);
}

.rarity-epique .rarity-progress-bar .progress-bar {
    background: linear-gradient(90deg, #C471F5 0%, #8E2DE2 100%);
}

.rarity-rare .rarity-progress-bar .progress-bar {
    background: linear-gradient(90deg, #A8E6CF 0%, #3AB795 100%);
}

.rarity-peu_commune .rarity-progress-bar .progress-bar {
    background: linear-gradient(90deg, #56CCF2 0%, #2F80ED 100%);
}

.rarity-commune .rarity-progress-bar .progress-bar {
    background: linear-gradient(90deg, #606c88 0%, #3f4c6b 100%);
}

/* ===================================
   FILTRES
   =================================== */

.collection-filters {
    background: rgba(26, 31, 51, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 1.5rem;
}

.form-select-dark {
    background-color: rgba(20, 25, 41, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.form-select-dark:focus {
    background-color: rgba(20, 25, 41, 1);
    border-color: #56CCF2;
    box-shadow: 0 0 0 0.2rem rgba(86, 204, 242, 0.25);
    color: #fff;
}

.form-select-dark option {
    background-color: #1a1f33;
    color: #fff;
}

/* ===================================
   GRILLE DE CARTES
   =================================== */

.car-collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .car-collection-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.5rem;
    }
}

/* ===================================
   CARTES DE VOITURES (EFFET FLIP)
   =================================== */

.car-card {
    perspective: 1000px;
    height: 400px;
    cursor: pointer;
    animation: fadeInUp 0.6s ease-out backwards;
}

.car-card:nth-child(1) { animation-delay: 0.05s; }
.car-card:nth-child(2) { animation-delay: 0.1s; }
.car-card:nth-child(3) { animation-delay: 0.15s; }
.car-card:nth-child(4) { animation-delay: 0.2s; }
.car-card:nth-child(5) { animation-delay: 0.25s; }
.car-card:nth-child(6) { animation-delay: 0.3s; }

.car-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.car-card:hover .car-card-inner {
    transform: rotateY(180deg);
}

.car-card-front,
.car-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* FACE AVANT */
.car-card-front {
    background: linear-gradient(135deg, rgba(26, 31, 51, 0.95) 0%, rgba(20, 25, 41, 0.95) 100%);
    border: 2px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.car-card:hover .car-card-front {
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.7);
}

/* Voiture possédée - bordure en gradient selon la rareté */
.car-card.car-owned .car-card-front {
    border: 2px solid transparent;
    background-origin: border-box;
    background-clip: padding-box, border-box;
}

.car-card.car-owned.rarity-legendaire .car-card-front {
    background-image:
        linear-gradient(135deg, rgba(26, 31, 51, 0.95) 0%, rgba(20, 25, 41, 0.95) 100%),
        linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
}

.car-card.car-owned.rarity-epique .car-card-front {
    background-image:
        linear-gradient(135deg, rgba(26, 31, 51, 0.95) 0%, rgba(20, 25, 41, 0.95) 100%),
        linear-gradient(135deg, #C471F5 0%, #8E2DE2 100%);
}

.car-card.car-owned.rarity-rare .car-card-front {
    background-image:
        linear-gradient(135deg, rgba(26, 31, 51, 0.95) 0%, rgba(20, 25, 41, 0.95) 100%),
        linear-gradient(135deg, #A8E6CF 0%, #3AB795 100%);
}

.car-card.car-owned.rarity-peu_commune .car-card-front {
    background-image:
        linear-gradient(135deg, rgba(26, 31, 51, 0.95) 0%, rgba(20, 25, 41, 0.95) 100%),
        linear-gradient(135deg, #56CCF2 0%, #2F80ED 100%);
}

.car-card.car-owned.rarity-commune .car-card-front {
    background-image:
        linear-gradient(135deg, rgba(26, 31, 51, 0.95) 0%, rgba(20, 25, 41, 0.95) 100%),
        linear-gradient(135deg, #606c88 0%, #3f4c6b 100%);
}

/* Badge de rareté */
.car-rarity-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 1.2rem;
    font-weight: bold;
    z-index: 10;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.car-rarity-badge.rarity-legendaire {
    background: var(--rarity-legendaire);
    box-shadow: 0 5px 20px var(--rarity-legendaire-glow);
}

.car-rarity-badge.rarity-epique {
    background: var(--rarity-epique);
    box-shadow: 0 5px 20px var(--rarity-epique-glow);
}

.car-rarity-badge.rarity-rare {
    background: var(--rarity-rare);
    box-shadow: 0 5px 20px var(--rarity-rare-glow);
}

.car-rarity-badge.rarity-peu_commune {
    background: var(--rarity-peu_commune);
    box-shadow: 0 5px 20px var(--rarity-peu_commune-glow);
}

.car-rarity-badge.rarity-commune {
    background: var(--rarity-commune);
    box-shadow: 0 5px 20px var(--rarity-commune-glow);
}

/* Badge de possession */
.car-owned-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: linear-gradient(135deg, #00FF87 0%, #00B369 100%);
    color: white;
    padding: 0.5rem;
    border-radius: 50%;
    font-size: 1.2rem;
    z-index: 10;
    box-shadow: 0 5px 15px rgba(0, 255, 135, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 5px 15px rgba(0, 255, 135, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 5px 25px rgba(0, 255, 135, 0.6);
    }
}

/* Overlay pour les voitures verrouillées */
.car-locked-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: rgba(255, 255, 255, 0.5);
    padding: 1rem;
    border-radius: 50%;
    font-size: 2rem;
    z-index: 10;
}

/* Image de la voiture */
.car-image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    overflow: hidden;
    position: relative;
}

.car-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 15px;
    transition: transform 0.3s ease;
}

.car-card:hover .car-image {
    transform: scale(1.05);
}

.car-image-locked {
    filter: grayscale(100%) blur(8px) brightness(0.4);
}

/* Logo de la marque */
.car-brand-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.5));
}

/* Informations de la voiture */
.car-info {
    padding: 1.5rem;
    text-align: center;
    background: rgba(0, 0, 0, 0.3);
}

.car-brand {
    font-size: 1.2rem;
    font-weight: 700;
    color: #56CCF2;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.car-model {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.5rem;
}

.car-year {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0;
}

/* FACE ARRIÈRE */
.car-card-back {
    background: linear-gradient(135deg, rgba(20, 25, 41, 0.98) 0%, rgba(26, 31, 51, 0.98) 100%);
    border: 2px solid rgba(86, 204, 242, 0.3);
    transform: rotateY(180deg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.car-stats {
    width: 100%;
}

.car-stats h3 {
    color: #56CCF2;
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(5px);
}

.stat-icon {
    font-size: 1.5rem;
    margin-right: 1rem;
}

.stat-label {
    flex: 1;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    font-weight: 500;
}

.stat-value {
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
}

.stat-highlight {
    background: linear-gradient(135deg, rgba(86, 204, 242, 0.2) 0%, rgba(47, 128, 237, 0.2) 100%);
    border: 1px solid rgba(86, 204, 242, 0.3);
}

.stat-highlight .stat-value {
    color: #56CCF2;
}

/* Message de verrouillage */
.locked-message {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
}

.locked-message i {
    color: rgba(255, 255, 255, 0.3);
}

.locked-message h3 {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.locked-message p {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
}

/* ===================================
   ANIMATIONS
   =================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out backwards;
}

/* ===================================
   RESPONSIVE
   =================================== */

@media (max-width: 992px) {
    .collection-stats-card {
        padding: 1.5rem;
    }

    .collection-progress-circle {
        width: 160px;
        height: 160px;
    }

    .car-card {
        height: 380px;
    }
}

@media (max-width: 768px) {
    .car-collection-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .car-card {
        height: 420px;
    }

    .collection-filters .col-md-4 {
        margin-bottom: 1rem;
    }
}
