/* =============================================================
   CHARACTER GALLERY - STYLES
   ============================================================= */

.character-gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.character-gallery-content {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.95), rgba(20, 20, 30, 0.98));
    border-radius: 20px;
    backdrop-filter: blur(15px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(100, 150, 255, 0.3);
    color: white;
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 30px;
}

.character-gallery-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.character-gallery-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.character-gallery-content h3 {
    text-align: center;
    margin: 0 0 25px 0;
    font-size: 24px;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Upload Section */
.gallery-upload-section {
    background: rgba(100, 150, 255, 0.1);
    border: 2px dashed rgba(100, 150, 255, 0.3);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin-bottom: 25px;
}

.gallery-upload-section .btn {
    margin-bottom: 10px;
}

.upload-hint {
    margin: 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.gallery-grid.empty {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

.gallery-empty {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
}

.gallery-empty p {
    margin: 10px 0;
    font-size: 16px;
}

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(100, 150, 255, 0.2);
    transition: all 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(100, 150, 255, 0.3);
    border-color: rgba(100, 150, 255, 0.5);
}

.gallery-item a {
    display: block;
    width: 100%;
    height: 100%;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(239, 68, 68, 0.8);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
}

.gallery-item:hover .gallery-delete-btn {
    opacity: 1;
    transform: scale(1);
}

.gallery-delete-btn:hover {
    background: rgba(239, 68, 68, 1);
    transform: scale(1.1);
}

/* Responsive */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .character-gallery-content {
        padding: 20px;
    }

    .character-gallery-content h3 {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }

    .gallery-upload-section {
        padding: 15px;
    }
}

/* Icône photo dans la biographie bulle */
.biography-photo-icon {
    position: absolute;
    top: 6px;
    right: 15px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
    z-index: 100;
}

.biography-photo-icon:hover {
    background: linear-gradient(135deg, #2980b9, #1f6aa5);
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.5);
}

.biography-photo-icon.has-photos {
    animation: pulsePhoto 2s infinite;
}

@keyframes pulsePhoto {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
    }
    50% {
        box-shadow: 0 2px 8px rgba(52, 152, 219, 0.6),
                    0 0 0 8px rgba(52, 152, 219, 0.15);
    }
}

/* Icône arbre généalogique dans la bulle biographie */
.biography-tree-icon {
    position: absolute;
    top: 6px;
    right: 15px;
    background: linear-gradient(135deg, #27ae60, #229954);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
    z-index: 100;
}

/* Si l'icône photo existe, décaler l'arbre à gauche */
.biography-photo-icon + .biography-tree-icon {
    right: 55px;
}

.biography-tree-icon:hover {
    background: linear-gradient(135deg, #229954, #1e8449);
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.5);
}
