/* Glossaire IA - Styles */

/* Variables */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(to bottom, #f9fafb, #ffffff);
    min-height: 100vh;
}

.glossary-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
}

/* Header */
.glossary-header {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 60px 40px 40px;
    border-radius: 0 0 20px 20px;
    margin: 0 -20px;
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.back-link {
    display: inline-block;
    color: white;
    text-decoration: none;
    opacity: 0.9;
    margin-bottom: 20px;
    transition: opacity 0.3s;
}

.back-link:hover {
    opacity: 1;
}

.glossary-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.95;
    margin-bottom: 30px;
}

/* Search Container */
.search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto 25px;
}

.search-input {
    width: 100%;
    padding: 15px 50px;
    font-size: 1rem;
    border: none;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-primary);
    transition: all 0.3s;
}

.search-input:focus {
    outline: none;
    background: white;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.3);
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
}

.clear-search {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    transition: color 0.3s;
}

.clear-search:hover {
    color: var(--danger-color);
}

/* Quick Stats */
.quick-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.stat {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.95rem;
}

.stat strong {
    color: white;
    font-weight: 600;
}

/* Alphabet Navigation */
.alphabet-nav {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
    padding: 20px 0;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.letter-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
    font-size: 0.9rem;
}

.letter-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.letter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.letter-btn[data-letter="all"] {
    width: auto;
    padding: 0 15px;
    border-radius: 20px;
}

/* Category Filter */
.category-filter {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.category-btn {
    background: white;
    border: 2px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.category-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.category-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.category-btn .emoji {
    font-size: 1.1rem;
}

/* Main Content */
.glossary-content {
    grid-column: 1;
    min-height: 400px;
}

.results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
}

#resultsCount {
    color: var(--text-secondary);
    font-weight: 500;
}

.random-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.random-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

/* Terms Grid */
.terms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.term-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.term-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.term-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity 0.3s;
}

.term-card:hover::before {
    opacity: 1;
}

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

.term-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.term-category {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 500;
}

.term-definition {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.term-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.difficulty {
    display: flex;
    gap: 2px;
}

.difficulty-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-color);
}

.difficulty-dot.filled {
    background: var(--primary-color);
}

.view-more {
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 500;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

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

.no-results h3 {
    color: var(--text-primary);
    margin-bottom: 10px;
}

.no-results p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.reset-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.reset-btn:hover {
    transform: scale(1.05);
}

/* Quick Access Sidebar */
.quick-access {
    grid-column: 2;
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow-sm);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.quick-access h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.popular-terms {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 25px;
}

.quick-term {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.85rem;
}

.quick-term:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.trending-terms {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 25px;
}

.trend-badge {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.did-you-know {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 10px;
}

.did-you-know p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 10px;
}

.refresh-fact {
    background: white;
    border: 1px solid var(--border-color);
    color: var(--primary-color);
    padding: 5px 10px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.85rem;
}

.refresh-fact:hover {
    background: var(--primary-color);
    color: white;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s;
}

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

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 700px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.3s;
}

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

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s;
}

.modal-close:hover {
    color: var(--danger-color);
}

.modal-header {
    padding: 30px 30px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    color: var(--text-primary);
    margin-bottom: 10px;
}

.modal-category {
    display: inline-block;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.modal-body {
    padding: 30px;
}

.definition-section,
.example-section,
.related-section,
.technical-section {
    margin-bottom: 25px;
}

.modal-body h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.modal-body p {
    color: var(--text-secondary);
    line-height: 1.7;
}

.related-terms {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.related-term {
    background: var(--bg-secondary);
    color: var(--primary-color);
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.related-term:hover {
    background: var(--primary-color);
    color: white;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
}

.action-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.action-btn:hover {
    transform: scale(1.05);
}

.action-btn.secondary {
    background: white;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* Footer */
.glossary-footer {
    grid-column: 1 / -1;
    background: white;
    border-radius: 12px;
    padding: 40px;
    margin-top: 40px;
    box-shadow: var(--shadow-sm);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
}

.footer-section h4 {
    color: var(--text-primary);
    margin-bottom: 10px;
}

.footer-section p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.suggest-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.suggest-btn:hover {
    transform: scale(1.05);
}

.download-btn {
    background: white;
    border: 2px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    margin-right: 10px;
}

.download-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--text-primary);
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    animation: slideInRight 0.3s;
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .glossary-container {
        grid-template-columns: 1fr;
    }
    
    .quick-access {
        display: none;
    }
}

@media (max-width: 768px) {
    .glossary-header {
        padding: 40px 20px;
    }
    
    .glossary-header h1 {
        font-size: 2rem;
    }
    
    .alphabet-nav {
        padding: 15px 10px;
    }
    
    .letter-btn {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
    
    .category-filter {
        padding: 15px;
    }
    
    .category-btn {
        font-size: 0.85rem;
        padding: 6px 12px;
    }
    
    .terms-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        border-radius: 15px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

/* Print Styles */
@media print {
    .glossary-header,
    .alphabet-nav,
    .category-filter,
    .quick-access,
    .modal,
    .toast {
        display: none;
    }
    
    .terms-grid {
        grid-template-columns: 1fr;
    }
    
    .term-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
}