/* ===================================
   MONSTRES DAGGERHEART - CSS MUTUALISÉ
   ================================== */

/* Variables CSS pour cohérence */
:root {
    --monster-tier-1: #27AE60;
    --monster-tier-1-dark: #229954;
    --monster-tier-2: #3498DB;
    --monster-tier-2-dark: #2980B9;
    --monster-tier-3: #F39C12;
    --monster-tier-3-dark: #E67E22;
    --monster-tier-4: #E74C3C;
    --monster-tier-4-dark: #C0392B;
    --monster-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    --monster-shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.3);
    --monster-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===================================
   SKIP LINKS - ACCESSIBILITÉ
   ================================== */

.skip-links {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.skip-links:focus {
    position: fixed;
    left: 50%;
    top: 10px;
    transform: translateX(-50%);
    width: auto;
    height: auto;
    background: #2c3e50;
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    text-decoration: none;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* ===================================
   LAYOUT PRINCIPAL
   ================================== */

main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: justify;
}

/* ===================================
   CARTES MONSTRES - SYSTÈME FLIP
   ================================== */

.monster-card {
    position: relative;
    width: 100%;
    min-height: 520px; /* Utilise min-height pour s'adapter au contenu */
    max-height: 800px; /* Hauteur maximale raisonnable pour éviter des cartes trop grandes */
    perspective: 1000px;
    cursor: pointer;
    z-index: 1;
    transition: var(--monster-transition);
    border-radius: 12px;
    overflow: hidden; /* Garde overflow hidden pour les effets 3D */
}

/* Hover avec z-index pour éviter les chevauchements */
.monster-card:hover,
.monster-card.locked {
    z-index: 10;
    overflow: visible;
}

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

/* Flip au survol sur desktop (sauf si verrouillé) */
@media (hover: hover) and (pointer: fine) {
    .monster-card:not(.locked):hover .card-inner {
        transform: rotateY(180deg);
    }
}

/* Carte verrouillée reste retournée */
.monster-card.locked .card-inner {
    transform: rotateY(180deg);
}

/* Sur mobile/tablette, flip au clic */
@media (hover: none) or (pointer: coarse) {
    .monster-card.flipped .card-inner {
        transform: rotateY(180deg);
    }
}

/* Indicateur de verrouillage sur desktop */
@media (hover: hover) and (pointer: fine) {
    .monster-card.locked::after {
        content: "🔒 Cliquer pour déverrouiller";
        position: absolute;
        bottom: 8px;
        right: 8px;
        font-size: 0.7rem;
        background: rgba(52, 152, 219, 0.9);
        color: white;
        padding: 4px 8px;
        border-radius: 4px;
        opacity: 0.9;
        pointer-events: none;
        z-index: 10;
    }
}

/* Mobile : indicateur de clic */
@media (hover: none) or (pointer: coarse) {
    .monster-card::after {
        content: "👆 Toucher pour les détails";
        position: absolute;
        bottom: 8px;
        right: 8px;
        font-size: 0.6rem;
        background: rgba(0, 0, 0, 0.7);
        color: white;
        padding: 4px 8px;
        border-radius: 4px;
        opacity: 0.8;
        pointer-events: none;
    }
    
    .monster-card.flipped::after {
        content: "↩️ Toucher pour retourner";
    }
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    box-sizing: border-box;
}

.card-front {
    background: #2a2650;
    color: #e8e0d0;
}

.card-back {
    background: #221f3a;
    color: #e8e0d0;
    transform: rotateY(180deg);
    padding: 0.4rem;
    font-size: 0.8rem;
    border: 1px solid #2a2650;
    display: flex; /* Utiliser flexbox pour le contenu */
    flex-direction: column;
    justify-content: flex-start; /* Aligner le contenu en haut */
    align-items: stretch; /* Étirer le contenu horizontalement */
    overflow-y: auto; /* Permettre le défilement si le contenu dépasse */
    -webkit-overflow-scrolling: touch; /* Améliore le défilement sur iOS */
}

/* Titre sur la carte arrière - TAILLE AUGMENTÉE */
.card-back .tile-title {
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
    font-weight: bold;
}

/* ===================================
   ÉLÉMENTS VISUELS DES CARTES
   ================================== */

/* Indicateur de retour (flèche) sur les cartes flippées */
.flip-indicator {
    position: absolute;
    top: 0.2rem;
    right: 0.2rem;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    color: #c8a84e;
    background: rgba(26, 24, 51, 0.8);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* Indicateur de verrouillage */
.lock-indicator {
    position: absolute;
    top: 0.2rem;
    left: 0.2rem;
    font-size: 1.2rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    color: #c8a84e;
    background: rgba(26, 24, 51, 0.9);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.monster-card.locked .lock-indicator {
    opacity: 1;
}

.tile-icon {
    font-size: 2.2rem;
    margin-bottom: 0.3rem;
    width: 250px; /* Taille ajustée pour les illustrations sur desktop */
    height: 250px; /* Taille ajustée pour les illustrations sur desktop */
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.3rem auto;
}

.tile-icon img {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    object-fit: contain; /* Assure que l'image est entièrement visible */
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
}

.monster-card:hover .tile-icon img {
    transform: scale(1.05);
}

.tile-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 0.3rem;
    color: #ffffff;
    line-height: 1.2;
}

.tile-desc {
    font-size: 0.85rem;
    text-align: center;
    line-height: 1.2;
    color: #9e96b0;
    padding: 0 0.4rem;
}

/* ===================================
   STATISTIQUES MONSTRES - TAILLES AUGMENTÉES
   ================================== */

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.2rem;
    width: 100%;
    margin-bottom: 0.3rem;
}

.stat-item {
    background: #1a1833;
    padding: 0.25rem;
    border-radius: 3px;
    text-align: center;
    border: 1px solid #2a2650;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.stat-label {
    font-size: 0.7rem;
    color: #9e96b0;
    display: block;
    font-weight: 500;
    text-transform: uppercase;
    line-height: 1.2;
}

.stat-value {
    font-size: 0.95rem;
    font-weight: bold;
    color: #c8a84e;
    display: block;
    margin-top: 2px;
    line-height: 1.2;
}

.arme-info {
    background: rgba(39,174,96,0.1);
    padding: 0.3rem 0.4rem;
    border-radius: 3px;
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
    border-left: 3px solid #27ae60;
    font-weight: 500;
    color: #e8e0d0;
    line-height: 1.3;
}

.capacites {
    background: rgba(200,168,78,0.1);
    padding: 0.3rem;
    border-radius: 3px;
    border-left: 3px solid #c8a84e;
    text-align: left;
}

.capacites-title {
    font-size: 0.8rem;
    font-weight: bold;
    color: #c8a84e;
    margin-bottom: 0.2rem;
    text-transform: uppercase;
}

.capacite {
    font-size: 0.75rem;
    color: #e8e0d0;
    margin-bottom: 0.15rem;
    padding: 0.1rem 0.2rem;
    background: rgba(42,38,80,0.6);
    border-radius: 3px;
    display: inline-block;
    margin-right: 0.15rem;
    line-height: 1.3;
}

/* ===================================
   CADRES TIER COLORÉS
   ================================== */

/* Tier 1 - Vert (Débutant) */
.monster-card.tier-1 {
    border: 2px solid var(--monster-tier-1);
    box-shadow: var(--monster-shadow);
}

.monster-card.tier-1:hover {
    box-shadow: 0 8px 25px rgba(39, 174, 96, 0.3);
    transform: translateY(-5px);
    border-color: var(--monster-tier-1-dark);
}

/* Tier 2 - Bleu (Intermédiaire) */
.monster-card.tier-2 {
    border: 2px solid var(--monster-tier-2);
    box-shadow: var(--monster-shadow);
}

.monster-card.tier-2:hover {
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.3);
    transform: translateY(-5px);
    border-color: var(--monster-tier-2-dark);
}

/* Tier 3 - Orange (Difficile) */
.monster-card.tier-3 {
    border: 2px solid var(--monster-tier-3);
    box-shadow: var(--monster-shadow);
}

.monster-card.tier-3:hover {
    box-shadow: 0 8px 25px rgba(243, 156, 18, 0.3);
    transform: translateY(-5px);
    border-color: var(--monster-tier-3-dark);
}

/* Tier 4 - Rouge (Légendaire) */
.monster-card.tier-4 {
    border: 2px solid var(--monster-tier-4);
    box-shadow: var(--monster-shadow);
}

.monster-card.tier-4:hover {
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.3);
    transform: translateY(-5px);
    border-color: var(--monster-tier-4-dark);
}

/* ===================================
   GRILLES ET SECTIONS
   ================================== */

.tiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
    padding: 0;
}

.content-section {
    margin: 3rem 0;
}

.content-section h3 {
    font-size: 1.8rem;
    color: #e8e0d0;
    margin-bottom: 1rem;
    border-bottom: 2px solid #c8a84e;
    padding-bottom: 0.5rem;
}

.content-section p {
    margin-bottom: 1rem;
    font-style: italic;
}

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

@media (max-width: 768px) {
    .tiles-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin: 1.5rem 0;
    }
    
    .monster-card {
        min-height: 480px; /* Utilise min-height pour s'adapter au contenu */
        max-height: 700px; /* Limite la hauteur maximale sur mobile */
    }
    
    .tile-icon {
        width: 180px; /* Taille ajustée pour les tablettes */
        height: 180px; /* Taille ajustée pour les tablettes */
    }
    
    .tile-icon img {
        width: 100%;
        height: 100%;
    }
    
    .tile-title {
        font-size: 1.1rem;
    }
    
    .tile-desc {
        font-size: 0.85rem;
    }
    
    main {
        padding: 0 1rem;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    main {
        padding: 0 1rem;
    }
    
    .monster-card {
        min-height: 460px; /* Utilise min-height même sur petit écran */
        max-height: 650px; /* Limite la hauteur maximale sur très petits écrans */
        margin: 0 -0.5rem;
        border-radius: 8px;
    }
    
    .tile-icon {
        width: 120px; /* Taille ajustée pour les mobiles */
        height: 120px; /* Taille ajustée pour les mobiles */
    }
    
    .tile-icon img {
        width: 100%;
        height: 100%;
    }
    
    .content-section h3 {
        font-size: 1.5rem;
    }
}

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

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

.monster-card {
    animation: fadeInUp 0.6s ease-out;
}

.monster-card:nth-child(1) { animation-delay: 0.1s; }
.monster-card:nth-child(2) { animation-delay: 0.2s; }
.monster-card:nth-child(3) { animation-delay: 0.3s; }
.monster-card:nth-child(4) { animation-delay: 0.4s; }
.monster-card:nth-child(5) { animation-delay: 0.5s; }
.monster-card:nth-child(6) { animation-delay: 0.6s; }

/* ===================================
   ACCESSIBILITÉ
   ================================== */

@media (prefers-reduced-motion: reduce) {
    .monster-card,
    .tile-icon img,
    .card-inner {
        animation: none;
        transition: none;
    }
    
    .monster-card:hover {
        transform: none;
    }
    
    .monster-card:hover .tile-icon img {
        transform: none;
    }
}

.monster-card:focus-visible {
    outline: 2px solid #3498db;
    outline-offset: 2px;
} 