/**
 * PHASE 6A : GLOSSAIRE ÉCONOMIQUE - STYLES CSS
 * Le Bulletin Économique
 * Fichier: assets/css/glossary.css
 * 
 * Styles pour :
 * - Tooltips interactifs dans les articles
 * - Page archive du glossaire
 * - Recherche et filtres
 * - Cartes de termes
 */

/* =============================================================================
   1. TERMES SURLIGNÉS DANS LES ARTICLES (AUTO-LINKING)
   ============================================================================= */

.glossary-term {
    position: relative;
    color: var(--color-accent, #3b82f6);
    border-bottom: 1px dotted currentColor;
    cursor: help;
    transition: all 0.2s ease;
    font-weight: 500;
}

.glossary-term:hover {
    color: var(--color-primary, #0f172a);
    border-bottom-style: solid;
}


/* =============================================================================
   2. TOOLTIP (BULLE D'INFORMATION)
   ============================================================================= */

.glossary-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    max-width: 350px;
    min-width: 250px;
    
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    
    z-index: 9999;
    pointer-events: none;
}

.glossary-term:hover .glossary-tooltip,
.glossary-term:focus .glossary-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Flèche du tooltip */
.glossary-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    
    border: 8px solid transparent;
    border-top-color: #ffffff;
}

.glossary-tooltip::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    
    border: 9px solid transparent;
    border-top-color: #e2e8f0;
    z-index: -1;
}

/* Contenu du tooltip */
.tooltip-term-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--color-primary, #0f172a);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tooltip-term-title .book-icon {
    width: 18px;
    height: 18px;
    opacity: 0.6;
}

.tooltip-definition {
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text-main, #334155);
    margin-bottom: 10px;
}

.tooltip-read-more {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--color-accent, #3b82f6);
    text-decoration: none;
    font-weight: 600;
    transition: gap 0.2s ease;
}

.tooltip-read-more:hover {
    gap: 8px;
}

/* Responsive : Sur mobile, tooltip prend toute la largeur */
@media (max-width: 768px) {
    .glossary-tooltip {
        position: fixed;
        bottom: 20px;
        left: 20px;
        right: 20px;
        top: auto;
        transform: none;
        max-width: none;
        animation: slideUpMobile 0.3s ease;
    }
    
    .glossary-tooltip::after,
    .glossary-tooltip::before {
        display: none;
    }
}

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


/* =============================================================================
   3. PAGE ARCHIVE DU GLOSSAIRE - HEADER
   ============================================================================= */

.glossary-page-header {
    background: linear-gradient(135deg, var(--color-primary, #0f172a) 0%, var(--color-accent, #3b82f6) 100%);
    color: #ffffff;
    padding: 60px 0;
    text-align: center;
    margin-bottom: 40px;
}

.glossary-page-title {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 15px;
    font-family: var(--font-heading, 'Inter', sans-serif);
}

.glossary-page-subtitle {
    font-size: 18px;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}


/* =============================================================================
   4. BARRE DE RECHERCHE
   ============================================================================= */

.glossary-search-bar {
    max-width: 700px;
    margin: 0 auto 40px;
    position: relative;
}

.glossary-search-input {
    width: 100%;
    padding: 16px 50px 16px 20px;
    font-size: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 50px;
    outline: none;
    transition: all 0.3s ease;
    background: #ffffff;
}

.glossary-search-input:focus {
    border-color: var(--color-accent, #3b82f6);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.glossary-search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    
    background: var(--color-accent, #3b82f6);
    color: #ffffff;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    
    display: flex;
    align-items: center;
    justify-content: center;
    
    transition: all 0.2s ease;
}

.glossary-search-btn:hover {
    background: var(--color-primary, #0f172a);
    transform: translateY(-50%) scale(1.05);
}


/* =============================================================================
   5. NAVIGATION ALPHABÉTIQUE
   ============================================================================= */

.glossary-alphabet-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 40px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
}

.alphabet-letter {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    
    font-weight: 600;
    font-size: 16px;
    color: var(--color-text-main, #334155);
    
    cursor: pointer;
    transition: all 0.2s ease;
}

.alphabet-letter:hover {
    border-color: var(--color-accent, #3b82f6);
    color: var(--color-accent, #3b82f6);
    transform: translateY(-2px);
}

.alphabet-letter.active {
    background: var(--color-accent, #3b82f6);
    border-color: var(--color-accent, #3b82f6);
    color: #ffffff;
}

.alphabet-letter.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.alphabet-letter.disabled:hover {
    transform: none;
}


/* =============================================================================
   6. LISTE DES TERMES (GRID)
   ============================================================================= */

.glossary-terms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

@media (max-width: 768px) {
    .glossary-terms-grid {
        grid-template-columns: 1fr;
    }
}


/* =============================================================================
   7. CARTE INDIVIDUELLE DE TERME
   ============================================================================= */

.glossary-term-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.glossary-term-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--color-accent, #3b82f6);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.glossary-term-card:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);
}

.glossary-term-card:hover::before {
    transform: scaleY(1);
}

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

.term-card-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-primary, #0f172a);
    margin: 0;
    line-height: 1.3;
}

.term-card-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.term-card-title a:hover {
    color: var(--color-accent, #3b82f6);
}

.term-card-category {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--color-accent, #3b82f6);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.term-card-pronunciation {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 10px;
    font-style: italic;
}

.term-card-definition {
    font-size: 15px;
    line-height: 1.6;
    color: var(--color-text-secondary, #64748b);
    margin-bottom: 15px;
}

.term-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #f1f5f9;
}

.term-card-read-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-accent, #3b82f6);
    text-decoration: none;
    transition: gap 0.2s ease;
}

.term-card-read-more:hover {
    gap: 10px;
}


/* =============================================================================
   8. PAGE SINGLE TERME (FICHE DÉTAILLÉE)
   ============================================================================= */

.single-glossary .entry-header {
    margin-bottom: 30px;
}

.single-glossary .entry-title {
    font-size: 42px;
    font-weight: 700;
    color: var(--color-primary, #0f172a);
    margin-bottom: 10px;
}

.glossary-meta-info {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 30px;
}

.meta-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.meta-info-label {
    font-weight: 600;
    color: var(--color-text-secondary, #64748b);
}

.meta-info-value {
    color: var(--color-text-main, #334155);
}

.glossary-definition-full {
    font-size: 18px;
    line-height: 1.8;
    color: var(--color-text-main, #334155);
    margin-bottom: 30px;
}

.glossary-example-section {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.glossary-example-section h3 {
    font-size: 18px;
    font-weight: 700;
    color: #92400e;
    margin-bottom: 10px;
}

.glossary-example-section p {
    font-size: 16px;
    line-height: 1.7;
    color: #78350f;
    margin: 0;
}

.glossary-related-terms {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 20px;
}

.glossary-related-terms h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-primary, #0f172a);
    margin-bottom: 15px;
}

.related-terms-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.related-terms-list li a {
    display: inline-block;
    padding: 8px 16px;
    background: #ffffff;
    border: 1px solid #bae6fd;
    border-radius: 20px;
    color: var(--color-accent, #3b82f6);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.related-terms-list li a:hover {
    background: var(--color-accent, #3b82f6);
    color: #ffffff;
    border-color: var(--color-accent, #3b82f6);
}


/* =============================================================================
   9. SHORTCODE EMBED TERM
   ============================================================================= */

.glossary-term-embed {
    background: #f8fafc;
    border-left: 4px solid var(--color-accent, #3b82f6);
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.glossary-term-embed h4 {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-primary, #0f172a);
    margin-bottom: 8px;
}

.glossary-term-embed .pronunciation {
    font-size: 14px;
    color: #64748b;
    font-style: italic;
    margin-bottom: 12px;
}

.glossary-term-embed .definition {
    font-size: 15px;
    line-height: 1.7;
    color: var(--color-text-main, #334155);
    margin-bottom: 12px;
}

.glossary-term-embed .example {
    font-size: 14px;
    color: #64748b;
    padding: 10px;
    background: #ffffff;
    border-radius: 4px;
    margin-bottom: 12px;
}


/* =============================================================================
   10. WIDGET TERMES RÉCENTS
   ============================================================================= */

.glossary-widget-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.glossary-widget-list li {
    padding: 10px 0;
    border-bottom: 1px solid #e2e8f0;
}

.glossary-widget-list li:last-child {
    border-bottom: none;
}

.glossary-widget-list li a {
    color: var(--color-text-main, #334155);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.glossary-widget-list li a:hover {
    color: var(--color-accent, #3b82f6);
}


/* =============================================================================
   11. DARK MODE
   ============================================================================= */

@media (prefers-color-scheme: dark) {
    .glossary-tooltip {
        background: #1e293b;
        border-color: #334155;
        color: #e2e8f0;
    }
    
    .glossary-tooltip::after {
        border-top-color: #1e293b;
    }
    
    .glossary-tooltip::before {
        border-top-color: #334155;
    }
    
    .tooltip-term-title {
        color: #f1f5f9;
    }
    
    .tooltip-definition {
        color: #cbd5e1;
    }
    
    .glossary-search-input {
        background: #1e293b;
        border-color: #334155;
        color: #e2e8f0;
    }
    
    .glossary-term-card {
        background: #1e293b;
        border-color: #334155;
    }
    
    .term-card-title {
        color: #f1f5f9;
    }
    
    .term-card-definition {
        color: #94a3b8;
    }
    
    .alphabet-letter {
        background: #1e293b;
        border-color: #334155;
        color: #e2e8f0;
    }
}


/* =============================================================================
   12. ANIMATIONS & TRANSITIONS
   ============================================================================= */

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

.glossary-term-card {
    animation: fadeInUp 0.4s ease backwards;
}

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


/* =============================================================================
   13. PRINT STYLES
   ============================================================================= */

@media print {
    .glossary-search-bar,
    .glossary-alphabet-nav,
    .term-card-footer {
        display: none !important;
    }
    
    .glossary-term-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}






/* Dans glossary.css */
.glossary-term {
    color: #e74c3c; /* Rouge au lieu de bleu */
    border-bottom-color: #e74c3c;
}
