/**
 * glossaire.css - Styles pour le glossaire/dictionnaire IA multilingue
 * BenchVibe Design System - Version 1.0.0
 */

/* ============================================
   VARIABLES SPECIFIQUES AU GLOSSAIRE
   ============================================ */

:root {
    /* Couleurs spécifiques au glossaire */
    --glossary-primary: #6366f1;
    --glossary-primary-dark: #4f46e5;
    --glossary-secondary: #8b5cf6;
    --glossary-accent: #06b6d4;
    --glossary-success: #10b981;
    
    /* Espacements */
    --glossary-gap: 1.5rem;
    --glossary-section-spacing: 3rem;
    
    /* Bordures et ombres */
    --glossary-radius: 16px;
    --glossary-radius-sm: 8px;
    --glossary-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    --glossary-shadow-hover: 0 20px 60px rgba(99, 102, 241, 0.15);
}

/* Mode sombre - surcharge des variables */
[data-theme="dark"] {
    --glossary-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    --glossary-shadow-hover: 0 20px 60px rgba(99, 102, 241, 0.25);
}

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

/* Container global - limite la largeur à 1200px */
.glossary-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    width: 100%;
    box-sizing: border-box;
}

/* Responsive adjustments for the container */
@media (max-width: 1248px) {
    .glossary-container {
        padding: 0 1rem;
    }
}

@media (max-width: 768px) {
    .glossary-container {
        padding: 0 0.75rem;
    }
}

/* Main container spécifique au glossaire */
main.main-single-term {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Conteneur de la grille du glossaire */
.glossary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--glossary-gap);
    margin: 2rem 0;
    padding: 0;
}

/* ============================================
   HEADER DU GLOSSAIRE
   ============================================ */

.glossary-header {
    background: linear-gradient(135deg, 
        rgba(99, 102, 241, 0.08) 0%, 
        rgba(139, 92, 246, 0.12) 25%,
        rgba(6, 182, 212, 0.08) 50%,
        rgba(67, 233, 123, 0.05) 75%,
        rgba(99, 102, 241, 0.08) 100%
    );
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--glossary-radius);
    margin: 0 0 var(--glossary-section-spacing);
    padding: 3rem 2rem;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        var(--glossary-shadow),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    text-align: center;
}

/* Effet de particules animées */
.glossary-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(6, 182, 212, 0.08) 0%, transparent 40%);
    animation: glossaryParticlesFloat 20s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes glossaryParticlesFloat {
    0% { transform: rotate(0deg) scale(1); opacity: 0.6; }
    50% { transform: rotate(180deg) scale(1.1); opacity: 0.8; }
    100% { transform: rotate(360deg) scale(1); opacity: 0.6; }
}

.glossary-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
    background: linear-gradient(135deg, 
        #4f46e5 0%, 
        #7c3aed 25%, 
        #06b6d4 50%, 
        #10b981 75%, 
        #4f46e5 100%
    );
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 0.75rem;
    letter-spacing: -0.02em;
    animation: glossaryTitleGradient 4s ease-in-out infinite;
    position: relative;
    z-index: 1;
    display: inline-block;
}

@keyframes glossaryTitleGradient {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.glossary-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--text-secondary);
    font-weight: 500;
    max-width: 600px;
    margin: 0 auto 2rem;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

/* ============================================
   STATISTIQUES DU GLOSSAIRE
   ============================================ */

.glossary-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}

.stat-item {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 1.25rem 1.75rem;
    border-radius: var(--glossary-radius);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: var(--shadow-sm);
    min-width: 120px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--glossary-shadow);
}

[data-theme="dark"] .stat-item {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(255, 255, 255, 0.1);
}

.stat-number {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   BARRE DE RECHERCHE
   ============================================ */

.glossary-search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    z-index: 1;
}

.glossary-search {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid transparent;
    border-radius: 50px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    color: var(--text-primary);
    outline: none;
}

.glossary-search::placeholder {
    color: var(--text-tertiary);
}

.glossary-search:focus {
    border-color: var(--glossary-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15), var(--shadow-lg);
}

[data-theme="dark"] .glossary-search {
    background: rgba(30, 41, 59, 0.95);
    color: var(--text-primary);
}

[data-theme="dark"] .glossary-search::placeholder {
    color: var(--text-tertiary);
}

/* ============================================
   CARTES DE TERMES / CATEGORIES
   ============================================ */

.term-card {
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(255, 255, 255, 0.8) 100%);
    border-radius: var(--glossary-radius);
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.75rem;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--glossary-shadow);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    height: 100%;
}

.term-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(99, 102, 241, 0.1),
        transparent
    );
    transition: left 0.6s ease;
}

.term-card:hover::before {
    left: 100%;
}

.term-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--glossary-shadow-hover);
    border-color: rgba(99, 102, 241, 0.2);
}

[data-theme="dark"] .term-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.8) 100%);
    border-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .term-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
}

.term-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.term-icon {
    font-size: 1.75rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-radius: var(--glossary-radius-sm);
    flex-shrink: 0;
}

.term-category {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--glossary-primary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
}

.term-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.75rem;
    line-height: 1.3;
}

.term-card:hover .term-name {
    color: var(--glossary-primary);
}

.term-definition {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.term-count {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--glossary-success);
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .term-count {
    border-top-color: rgba(255, 255, 255, 0.05);
}

/* ============================================
   FIL D'ARIANE (BREADCRUMB)
   ============================================ */

.breadcrumb-container {
    max-width: 1200px;
    margin: 0 auto 1.5rem;
    padding: 0 1rem;
}

.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    background: var(--bg-secondary);
    border-radius: var(--glossary-radius-sm);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .breadcrumb {
    background: var(--bg-secondary);
    border-color: rgba(255, 255, 255, 0.1);
}

.breadcrumb-home {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--glossary-primary);
    font-weight: 600;
    font-size: 0.9375rem;
    transition: color 0.2s ease;
}

.breadcrumb-home:hover {
    color: var(--glossary-primary-dark);
}

.breadcrumb-home svg {
    width: 18px;
    height: 18px;
}

.breadcrumb-sep {
    color: var(--text-tertiary);
    font-size: 1.1rem;
    font-weight: 300;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

.breadcrumb-item:hover {
    color: var(--glossary-primary);
    background: rgba(99, 102, 241, 0.08);
}

.breadcrumb-item.current {
    color: var(--text-primary);
    font-weight: 600;
    pointer-events: none;
}

.breadcrumb-icon {
    font-size: 1rem;
}

/* ============================================
   AFFICHAGE D'UN TERME UNIQUE
   ============================================ */

.single-term-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.single-term-card {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(255, 255, 255, 0.9) 100%);
    border-radius: var(--glossary-radius);
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 3rem;
    box-shadow: var(--glossary-shadow);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.single-term-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        var(--glossary-primary) 0%, 
        var(--glossary-secondary) 50%, 
        var(--glossary-accent) 100%
    );
}

[data-theme="dark"] .single-term-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.9) 100%);
    border-color: rgba(255, 255, 255, 0.05);
}

.single-term-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    display: inline-block;
}

.single-term-card .term-category {
    display: inline-block;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    margin-bottom: 1.25rem;
}

.single-term-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 1.5rem;
    line-height: 1.2;
}

.single-term-def {
    font-size: 1.125rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin: 0 0 2rem;
    text-align: left;
}

/* ============================================
   LIEN RETOUR
   ============================================ */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, var(--glossary-primary) 0%, var(--glossary-secondary) 100%);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9375rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.back-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    filter: brightness(1.1);
}

/* ============================================
   MESSAGE D'ERREUR
   ============================================ */

.glossary-error {
    max-width: 600px;
    margin: 4rem auto;
    padding: 3rem 2rem;
    text-align: center;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(255, 255, 255, 0.9) 100%);
    border-radius: var(--glossary-radius);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: var(--glossary-shadow);
}

[data-theme="dark"] .glossary-error {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.9) 100%);
    border-color: rgba(255, 255, 255, 0.05);
}

.glossary-error-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
}

.glossary-error h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.glossary-error p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* ============================================
   MESSAGE AUCUN RESULTAT
   ============================================ */

.no-results {
    display: none;
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-secondary);
    border-radius: var(--glossary-radius);
    border: 2px dashed var(--border-color);
}

.no-results.visible {
    display: block;
}

.no-results h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0;
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin: 3rem 0 2rem;
    flex-wrap: wrap;
}

.pagination a {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: var(--bg-secondary);
    color: var(--glossary-primary);
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9375rem;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.pagination a:hover {
    background: var(--glossary-primary);
    color: white;
    border-color: var(--glossary-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.pagination .current {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

/* ============================================
   FOOTER SPECIFIQUE AU GLOSSAIRE
   ============================================ */

/* Le footer est déjà stylé par le site, 
   mais on peut ajouter des styles spécifiques si besoin */

/* ============================================
   SUPPORT RTL (DROITE À GAUCHE)
   ============================================ */

[dir="rtl"] .glossary-grid {
    direction: rtl;
}

[dir="rtl"] .breadcrumb {
    direction: rtl;
}

[dir="rtl"] .term-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .single-term-def {
    text-align: right;
}

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

/* Tablettes */
@media (max-width: 1024px) {
    .glossary-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.25rem;
    }
    
    .glossary-header {
        padding: 2.5rem 1.5rem;
    }
    
    .stat-item {
        padding: 1rem 1.5rem;
        min-width: 100px;
    }
    
    .single-term-card {
        padding: 2.5rem 2rem;
    }
}

/* Mobiles */
@media (max-width: 768px) {
    main.main-single-term {
        padding: 1rem;
    }
    
    .glossary-header {
        padding: 2rem 1.25rem;
        margin-bottom: 2rem;
    }
    
    .glossary-stats {
        gap: 1rem;
    }
    
    .stat-item {
        padding: 1rem;
        min-width: 90px;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    .glossary-search {
        padding: 0.875rem 1.25rem;
        font-size: 0.9375rem;
    }
    
    .glossary-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .term-card {
        padding: 1.5rem;
    }
    
    .breadcrumb {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    .breadcrumb-item {
        font-size: 0.875rem;
        padding: 0.2rem 0.4rem;
    }
    
    .single-term-container {
        margin: 1rem auto;
    }
    
    .single-term-card {
        padding: 2rem 1.5rem;
    }
    
    .single-term-icon {
        font-size: 3rem;
    }
    
    .pagination {
        gap: 0.75rem;
    }
    
    .pagination a {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
    
    .glossary-error {
        margin: 2rem auto;
        padding: 2rem 1.5rem;
    }
}

/* Petits mobiles */
@media (max-width: 480px) {
    .glossary-header {
        padding: 1.5rem 1rem;
    }
    
    .glossary-stats {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }
    
    .stat-item {
        width: 100%;
        max-width: 200px;
    }
    
    .breadcrumb-home span {
        display: none;
    }
    
    .breadcrumb-home svg {
        width: 24px;
        height: 24px;
    }
    
    .single-term-card {
        padding: 1.5rem 1rem;
    }
    
    .back-link {
        padding: 0.75rem 1.25rem;
        font-size: 0.875rem;
    }
}

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

/* Focus visible pour la navigation au clavier */
.term-card:focus,
.breadcrumb-item:focus,
.back-link:focus,
.pagination a:focus,
.glossary-search:focus {
    outline: 3px solid var(--glossary-primary);
    outline-offset: 2px;
}

/* Réduire les animations pour les utilisateurs qui le préfèrent */
@media (prefers-reduced-motion: reduce) {
    .glossary-header::before,
    .glossary-title,
    .term-card::before {
        animation: none;
    }
    
    .term-card,
    .stat-item,
    .back-link,
    .pagination a {
        transition: none;
    }
}

/* Contraste élevé */
@media (prefers-contrast: high) {
    .term-card {
        border-width: 2px;
    }
    
    .glossary-search {
        border-width: 2px;
    }
    
    .stat-item {
        border-width: 2px;
    }
}

/* ============================================
   UTILITAIRES
   ============================================ */

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}