/* ═══════════════════════════════════════════════════════════════
   Pokédex View - Vue collection par Pokémon
   ═══════════════════════════════════════════════════════════════ */

/* ───────────────────────────────────────────────────────────────
   HEADER & STATS
   ─────────────────────────────────────────────────────────────── */
.pokedex-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.pokedex-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.pokedex-title h4 {
    color: var(--primary);
    margin: 0;
    font-weight: 600;
}

.pokedex-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.pokedex-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border-radius: var(--border-radius-lg);
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.pokedex-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.pokedex-stat-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Progress bar global */
.pokedex-stat-progress {
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
}

.pokedex-progress {
    width: 120px;
    height: 8px;
    background: var(--gray-600);
    border-radius: var(--border-radius-full);
    overflow: hidden;
}

.pokedex-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: var(--border-radius-full);
    transition: width 0.5s ease;
}

.pokedex-percent {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-300);
}

/* ───────────────────────────────────────────────────────────────
   FILTRES GÉNÉRATION
   ─────────────────────────────────────────────────────────────── */
.pokedex-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0;
    background: transparent;
}

.pokedex-gen-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--gray-600);
    border-radius: var(--border-radius-full);
    background: var(--gray-700);
    color: var(--gray-300);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pokedex-gen-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.pokedex-gen-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    padding: calc(0.5rem + 2px) calc(1rem + 2px);
    color: white;
    box-shadow: var(--shadow-md);
}

.pokedex-gen-btn .gen-count {
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--border-radius-full);
}

.pokedex-gen-btn.active .gen-count {
    background: rgba(255, 255, 255, 0.25);
}

/* Filtre type */
.pokedex-type-filters {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.pokedex-type-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--gray-200);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.pokedex-type-btn:hover {
    transform: scale(1.15);
}

.pokedex-type-btn.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* ───────────────────────────────────────────────────────────────
   GRILLE POKÉDEX
   ─────────────────────────────────────────────────────────────── */
.pokedex-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
    padding: 0.5rem;
}

@media (min-width: 768px) {
    .pokedex-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 1rem;
    }
}

@media (min-width: 1200px) {
    .pokedex-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

/* ───────────────────────────────────────────────────────────────
   CARTE POKÉMON
   ─────────────────────────────────────────────────────────────── */
.pokedex-card {
    position: relative;
    aspect-ratio: 1;
    background: white;
    border-radius: var(--border-radius-lg);
    border: 2px solid var(--gray-200);
    cursor: pointer;
    transition: all var(--transition-fast);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
}

.pokedex-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

/* État : possédé */
.pokedex-card.owned {
    border-color: var(--success);
    background: linear-gradient(180deg, rgba(40, 167, 69, 0.05), rgba(40, 167, 69, 0.1));
}

.pokedex-card.owned::after {
    content: '✓';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    background: var(--success);
    color: white;
    border-radius: 50%;
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* État : non possédé */
.pokedex-card.not-owned {
    opacity: 0.5;
    filter: grayscale(70%);
}

.pokedex-card.not-owned:hover {
    opacity: 0.8;
    filter: grayscale(30%);
}

/* Sprite */
.pokedex-sprite {
    width: 64px;
    height: 64px;
    object-fit: contain;
    image-rendering: pixelated;
    transition: transform var(--transition-fast);
}

@media (min-width: 768px) {
    .pokedex-sprite {
        width: 72px;
        height: 72px;
    }
}

.pokedex-card:hover .pokedex-sprite {
    transform: scale(1.1);
}

/* Numéro dex */
.pokedex-dex {
    position: absolute;
    top: 4px;
    left: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--gray-400);
    background: rgba(255, 255, 255, 0.9);
    padding: 0.1rem 0.3rem;
    border-radius: var(--border-radius-sm);
}

/* Nom */
.pokedex-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    font-size: 0.65rem;
    font-weight: 600;
    color: white;
    text-align: center;
    padding: 0.35rem 0.25rem 0.25rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.6) 70%, transparent);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* Badge nombre de cartes */
.pokedex-card-count {
    position: absolute;
    bottom: 22px;
    right: 4px;
    font-size: 0.55rem;
    font-weight: 600;
    color: white;
    background: var(--primary);
    padding: 0.1rem 0.3rem;
    border-radius: var(--border-radius-sm);
    min-width: 16px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ───────────────────────────────────────────────────────────────
   MODAL DÉTAIL POKÉMON
   ─────────────────────────────────────────────────────────────── */
.pokemon-detail-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.4), rgba(118, 75, 162, 0.5));
    border-radius: var(--border-radius-lg);
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.pokemon-detail-sprite {
    width: 120px;
    height: 120px;
    object-fit: contain;
}

.pokemon-detail-info h3 {
    margin: 0 0 0.5rem 0;
    color: var(--gray-100);
    font-size: 1.75rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.pokemon-detail-info .dex-number {
    color: var(--gray-300);
    font-size: 1rem;
    font-weight: 500;
}

.pokemon-types {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.pokemon-type-badge {
    padding: 0.25rem 0.75rem;
    border-radius: var(--border-radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    text-transform: capitalize;
}

/* Types colors */
.type-normal { background: #A8A878; }
.type-feu, .type-fire { background: #F08030; }
.type-eau, .type-water { background: #6890F0; }
.type-plante, .type-grass { background: #78C850; }
.type-électrik, .type-electric { background: #F8D030; color: #333; }
.type-glace, .type-ice { background: #98D8D8; color: #333; }
.type-combat, .type-fighting { background: #C03028; }
.type-poison { background: #A040A0; }
.type-sol, .type-ground { background: #E0C068; color: #333; }
.type-vol, .type-flying { background: #A890F0; }
.type-psy, .type-psychic { background: #F85888; }
.type-insecte, .type-bug { background: #A8B820; }
.type-roche, .type-rock { background: #B8A038; }
.type-spectre, .type-ghost { background: #705898; }
.type-dragon { background: #7038F8; }
.type-ténèbres, .type-dark { background: #705848; }
.type-acier, .type-steel { background: #B8B8D0; color: #333; }
.type-fée, .type-fairy { background: #EE99AC; }

/* Cartes du Pokémon */
.pokemon-cards-section h5 {
    color: var(--gray-700);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pokemon-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem;
}

.pokemon-card-thumb {
    aspect-ratio: 0.72;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    border: 2px solid var(--gray-200);
}

.pokemon-card-thumb:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.pokemon-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pokemon-card-thumb.in-collection {
    border-color: var(--success);
}

.pokemon-card-thumb.in-collection::after {
    content: '✓';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    background: var(--success);
    color: white;
    border-radius: 50%;
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Cartes non possédées - effet ombre comme le pokedex */
.pokemon-card-thumb:not(.in-collection) {
    opacity: 0.5;
    filter: grayscale(70%);
}

.pokemon-card-thumb:not(.in-collection):hover {
    opacity: 0.8;
    filter: grayscale(30%);
}

/* Badge carte gradée */
.pokemon-card-graded-badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    right: 4px;
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #1a1a1a;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.2rem 0.35rem;
    border-radius: var(--border-radius-sm);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

.pokemon-card-thumb.has-graded {
    border-color: #ffd700;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

.pokemon-card-thumb.has-graded::after {
    display: none; /* Cacher le checkmark standard, le badge suffit */
}

/* ───────────────────────────────────────────────────────────────
   LOADING & EMPTY STATES
   ─────────────────────────────────────────────────────────────── */
.pokedex-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--gray-500);
}

.pokedex-loading .pokeball-spinner {
    width: 48px;
    height: 48px;
    animation: pokeball-spin 1s linear infinite;
}

@keyframes pokeball-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.pokedex-empty {
    text-align: center;
    padding: 3rem;
    color: var(--gray-500);
}

.pokedex-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ───────────────────────────────────────────────────────────────
   RESPONSIVE
   ─────────────────────────────────────────────────────────────── */
@media (max-width: 576px) {
    .pokedex-header {
        flex-direction: column;
        align-items: stretch;
    }

    .pokedex-stats {
        justify-content: center;
    }

    .pokedex-filters {
        justify-content: center;
    }

    .pokedex-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 0.5rem;
    }

    .pokedex-sprite {
        width: 48px;
        height: 48px;
    }

    .pokedex-name {
        font-size: 0.55rem;
        padding: 0.3rem 0.15rem 0.2rem;
    }

    .pokedex-card-count {
        bottom: 18px;
        font-size: 0.5rem;
    }
}

/* ───────────────────────────────────────────────────────────────
   DARK MODE
   ─────────────────────────────────────────────────────────────── */
[data-theme="dark"] .pokedex-card {
    background: var(--gray-800);
    border-color: var(--gray-700);
}

[data-theme="dark"] .pokedex-card.owned {
    background: linear-gradient(180deg, rgba(40, 167, 69, 0.1), rgba(40, 167, 69, 0.2));
}

[data-theme="dark"] .pokedex-name {
    color: var(--gray-300);
}

[data-theme="dark"] .pokedex-filters {
    background: var(--gray-800);
}

[data-theme="dark"] .pokedex-gen-btn {
    background: var(--gray-700);
    border-color: var(--gray-600);
    color: var(--gray-300);
}

[data-theme="dark"] .pokedex-dex {
    background: rgba(0, 0, 0, 0.5);
    color: var(--gray-400);
}

/* ───────────────────────────────────────────────────────────────
   MODAL CUSTOM POKEMON (sans Bootstrap)
   ─────────────────────────────────────────────────────────────── */
.pokemon-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.pokemon-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.pokemon-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.pokemon-modal-container {
    position: relative;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    background: var(--gray-900, #1a1a2e);
    border-radius: var(--border-radius-lg, 12px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}

.pokemon-modal-overlay.show .pokemon-modal-container {
    transform: scale(1) translateY(0);
}

.pokemon-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-700, #374151);
    background: linear-gradient(135deg, var(--primary, #667eea), var(--secondary, #764ba2));
    border-radius: var(--border-radius-lg, 12px) var(--border-radius-lg, 12px) 0 0;
}

.pokemon-modal-header h5 {
    margin: 0;
    color: white;
    font-weight: 600;
    font-size: 1.25rem;
}

.pokemon-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    line-height: 1;
}

.pokemon-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.pokemon-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

/* Light mode overrides */
[data-theme="light"] .pokemon-modal-container {
    background: white;
}

[data-theme="light"] .pokemon-modal-header {
    border-bottom-color: var(--gray-200);
}

[data-theme="light"] .pokemon-modal-body {
    color: var(--gray-800);
}
