/* =====================================
   IMPORT GOOGLE FONTS
   ===================================== */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Crimson+Text:ital,wght@0,400;0,600;1,400&display=swap');

/* =====================================
   VARIABLES ET BASE
   ===================================== */
:root {
    --vert-principal: #2E4B2E;
    --or-dore: #D4AF37;
    --blanc-casse: #F8F8F0;
    --gris-texte: #333333;
    --vert-clair: #4A6B4A;
    --vert-hover: #3D5A3D;
    --shadow-soft: 0 2px 8px rgba(46, 75, 46, 0.15);
    --shadow-medium: 0 4px 16px rgba(46, 75, 46, 0.2);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
}

/* =====================================
   SECTION HÉRO
   ===================================== */
.glossaire-hero {
    background: linear-gradient(135deg, var(--vert-principal) 0%, var(--vert-clair) 100%);
    padding: 80px 20px;
    text-align: center;
    margin-bottom: 40px;
    border-radius: 0 0 30px 30px;
    box-shadow: var(--shadow-medium);
    position: relative;
    overflow: hidden;
}

.glossaire-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

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

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-family: 'Cinzel', sans-serif !important;
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: #D4AF37 !important;  /* OR DORÉ */
    margin: 0 0 15px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);  /* Ombre plus forte pour plus de contraste */
    letter-spacing: 2px;
}

.hero-subtitle {
    font-family: 'Crimson Text', Georgia, serif;
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    color: var(--blanc-casse);
    margin: 0 0 20px 0;
    font-style: italic;
}

.hero-decoration {
    font-size: 2rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* =====================================
   CONTRÔLES (RECHERCHE + FILTRES)
   ===================================== */
.glossaire-controls {
    max-width: 1200px;
    margin: 0 auto 40px;
    padding: 0 20px;
}

.search-container {
    position: relative;
    margin-bottom: 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

#glossaire-search {
    width: 100%;
    padding: 18px 50px 18px 20px;
    font-size: 1.1rem;
    font-family: 'Crimson Text', Georgia, serif;
    border: 3px solid var(--vert-principal);
    border-radius: 50px;
    background: white;
    transition: var(--transition);
    box-shadow: var(--shadow-soft);
}

#glossaire-search:focus {
    outline: none;
    border-color: var(--or-dore);
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.3);
    transform: translateY(-2px);
}

.search-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    pointer-events: none;
}

/* FILTRES */
.filters-container {
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    justify-content: center;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 200px;
}

.filter-group label {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 0.95rem;
    color: var(--vert-principal);
    font-weight: 600;
    letter-spacing: 1px;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-btn,
.importance-btn {
    padding: 10px 18px;
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 1rem;
    background: white;
    border: 2px solid var(--vert-principal);
    border-radius: 25px;
    color: var(--vert-principal);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.filter-btn:hover,
.importance-btn:hover {
    background: var(--vert-clair);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.filter-btn.active,
.importance-btn.active {
    background: var(--vert-principal);
    color: var(--or-dore);
    font-weight: 600;
    box-shadow: var(--shadow-medium);
}

#tome-filter {
    padding: 12px 18px;
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 1rem;
    border: 2px solid var(--vert-principal);
    border-radius: 25px;
    background: white;
    color: var(--vert-principal);
    cursor: pointer;
    transition: var(--transition);
}

#tome-filter:focus {
    outline: none;
    border-color: var(--or-dore);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

/* =====================================
   NAVIGATION ALPHABÉTIQUE
   ===================================== */
.alpha-nav {
    position: sticky;
    top: 20px;
    z-index: 100;
    background: rgba(248, 248, 240, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    margin: 0 auto 30px;
    max-width: 1200px;
    border-radius: 50px;
    box-shadow: var(--shadow-medium);
}

.alpha-nav-inner {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.alpha-letter {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cinzel', Georgia, serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--vert-principal);
    background: white;
    border: 2px solid var(--vert-principal);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

.alpha-letter:first-child {
    width: auto;
    padding: 0 15px;
    border-radius: 25px;
}

.alpha-letter:hover {
    background: var(--vert-clair);
    color: var(--or-dore);
    transform: scale(1.1);
}

.alpha-letter.active {
    background: var(--vert-principal);
    color: var(--or-dore);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.5);
}

/* =====================================
   GRILLE D'ENTRÉES
   ===================================== */
.glossaire-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 60px;
}

.glossaire-card {
    background: white;
    border: 3px solid var(--vert-principal);
    border-radius: 20px;
    padding: 25px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
}

.glossaire-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--vert-principal), var(--or-dore));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.glossaire-card:hover::before {
    transform: scaleX(1);
}

.glossaire-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(46, 75, 46, 0.25);
    border-color: var(--or-dore);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.card-title {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 1.4rem;
    color: var(--vert-principal);
    margin: 0;
    flex: 1;
}

.card-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.badge {
    padding: 5px 12px;
    background: var(--vert-principal);
    color: var(--or-dore);
    border-radius: 15px;
    font-size: 0.85rem;
    font-family: 'Crimson Text', Georgia, serif;
    font-weight: 600;
}

.badge.nouveau {
    background: var(--or-dore);
    color: var(--vert-principal);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.card-pronunciation {
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 1rem;
    color: #666;
    font-style: italic;
    margin-bottom: 10px;
}

.card-category {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 1rem;
    color: var(--vert-clair);
    margin-bottom: 12px;
    font-weight: 600;
}

.card-excerpt {
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--gris-texte);
    margin-bottom: 15px;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 2px solid var(--blanc-casse);
}

.card-importance {
    font-size: 1.2rem;
}

.card-link {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 0.9rem;
    color: var(--vert-principal);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: var(--transition);
}

.card-link:hover {
    color: var(--or-dore);
    gap: 10px;
}

/* =====================================
   MODALE
   ===================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(46, 75, 46, 0.9);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--blanc-casse);
    border-radius: 30px;
    max-width: 800px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 40px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

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

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: var(--vert-principal);
    color: var(--or-dore);
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--or-dore);
    color: var(--vert-principal);
    transform: rotate(90deg);
}

#modal-body h2 {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 2.5rem;
    color: var(--vert-principal);
    margin: 0 0 20px 0;
}

#modal-body .modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
}

#modal-body .modal-section {
    margin-bottom: 30px;
}

#modal-body .modal-section h3 {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 1.5rem;
    color: var(--vert-clair);
    margin: 0 0 15px 0;
    border-bottom: 2px solid var(--or-dore);
    padding-bottom: 10px;
}

#modal-body .modal-section p,
#modal-body .modal-section ul {
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--gris-texte);
}

#modal-body .modal-section ul {
    padding-left: 25px;
}

#modal-body .modal-section li {
    margin-bottom: 10px;
}

/* =====================================
   RESPONSIVE
   ===================================== */
@media (max-width: 768px) {
    .glossaire-hero {
        padding: 60px 20px;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .filters-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    .alpha-nav-inner {
        gap: 5px;
    }
    
    .alpha-letter {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
    
    .glossaire-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .modal-content {
        width: 95%;
        padding: 30px 20px;
        max-height: 90vh;
    }
    
    #modal-body h2 {
        font-size: 2rem;
    }
}

/* =====================================
   ÉTAT VIDE
   ===================================== */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
}

.no-results-content {
    max-width: 500px;
    margin: 0 auto;
}

.no-results-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.no-results-title {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 1.8rem;
    color: var(--vert-principal);
    margin: 0 0 15px 0;
}

.no-results-text {
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 1.2rem;
    color: var(--gris-texte);
    line-height: 1.6;
}

/* =====================================
   ANIMATIONS DE CHARGEMENT
   ===================================== */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--blanc-casse);
    border-top-color: var(--or-dore);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Badge correspondance de recherche */
.badge-match {
    display: inline-block;
    padding: 4px 10px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 8px;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

/* =====================================
   FORCER CINZEL SUR LE TITRE - ULTRA PRIORITÉ
   ===================================== */
.glossaire-hero .hero-content h1.hero-title,
div.glossaire-hero div.hero-content h1.hero-title,
body .glossaire-hero .hero-content .hero-title,
.hero-title.hero-title.hero-title {
    font-family: 'Cinzel', sans-serif !important;
    font-weight: 700 !important;
}