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

:root {
    --primary-color: #667eea;
    --primary-dark: #764ba2;
    --secondary-color: #f5f7fa;
    --accent-color: #ffd700;
    --text-dark: #1a202c;
    --text-light: #4a5568;
    --text-muted: #718096;
    --border-color: #e2e8f0;
    --shadow-light: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-heavy: 0 10px 25px rgba(0, 0, 0, 0.15);
    --border-radius: 0.5rem;
    --border-radius-lg: 1rem;
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    --secondary-color: #1a202c;
    --text-dark: #f7fafc;
    --text-light: #e2e8f0;
    --text-muted: #a0aec0;
    --border-color: #2d3748;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--secondary-color);
    overflow-x: hidden;
    padding-top: 80px;
}

[dir="rtl"] body {
    font-family: 'Cairo', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: var(--transition);
}

[data-theme="dark"] .header {
    background: rgba(26, 32, 44, 0.95);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary-color);
    text-decoration: none;
}

.logo-icon {
    font-size: 1.5rem;
}

.nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.language-selector {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: white;
    color: var(--text-dark);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
}

[data-theme="dark"] .language-selector {
    background: var(--text-dark);
    color: var(--secondary-color);
    border-color: var(--border-color);
}

.language-selector:hover {
    border-color: var(--primary-color);
}

.theme-toggle,
.share-btn,
.install-btn {
    padding: 0.5rem;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: var(--transition);
    font-size: 1.25rem;
}

.theme-toggle:hover,
.share-btn:hover,
.install-btn:hover {
    background: var(--border-color);
}

/* Hero Section avec vidéo de fond */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: white;
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    overflow: hidden;
}

.hero-video {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    transform: translate(-50%, -50%);
    object-fit: cover;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.6) 0%,
        rgba(0, 0, 0, 0.4) 50%,
        rgba(0, 0, 0, 0.6) 100%
    );
    z-index: -1;
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}

.hero-title {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    background: linear-gradient(135deg, #ffffff, #f0f0f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    opacity: 0.95;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
    font-weight: 400;
}

.hero-description {
    font-size: 1.1rem;
    margin-bottom: 3rem;
    opacity: 0.9;
    line-height: 1.6;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* Sources avec images des livres */
.sources {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.source-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.source-card:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.source-image {
    width: 60px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    background: white;
    padding: 4px;
    flex-shrink: 0;
}

.book-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.source-content {
    text-align: left;
    flex: 1;
}

.source-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

.source-author {
    font-size: 0.9rem;
    opacity: 0.85;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

/* Fonctionnalités */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.feature {
    text-align: center;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    transition: var(--transition);
}

.feature:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.feature-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

.feature-description {
    font-size: 0.9rem;
    opacity: 0.8;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

/* CTA Button */
.cta-button {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    margin-bottom: 2rem;
    text-shadow: none;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.6);
}

.cta-button:active {
    transform: translateY(0);
}

/* Disclaimer */
.disclaimer {
    font-size: 0.85rem;
    opacity: 0.7;
    max-width: 600px;
    margin: 0 auto;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
    line-height: 1.5;
}

/* Chat Section */
.chat-section {
    background: var(--secondary-color);
    padding: 4rem 0;
    min-height: 100vh;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: var(--border-radius-lg);
    color: white;
}

.chat-avatar {
    font-size: 2rem;
}

.chat-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.chat-subtitle {
    opacity: 0.9;
    font-size: 0.9rem;
}

.chat-messages {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: var(--shadow-medium);
}

[data-theme="dark"] .chat-messages {
    background: #2d3748;
}

.message {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.message:last-child {
    margin-bottom: 0;
}

.message-avatar {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
}

.user-message {
    flex-direction: row-reverse;
}

.user-message .message-content {
    background: var(--primary-color);
    color: white;
    padding: 1rem;
    border-radius: 1rem 1rem 0.25rem 1rem;
    margin-left: 2rem;
}

.assistant-message .message-content {
    background: var(--border-color);
    padding: 1rem;
    border-radius: 1rem 1rem 1rem 0.25rem;
    margin-right: 2rem;
}

[data-theme="dark"] .assistant-message .message-content {
    background: #4a5568;
    color: white;
}

.message-time {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-top: 0.5rem;
    display: block;
}

.chat-input-container {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-medium);
}

[data-theme="dark"] .chat-input-container {
    background: #2d3748;
}

.chat-input-wrapper {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.chat-input {
    flex: 1;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    resize: none;
    transition: var(--transition);
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.send-button {
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.25rem;
}

.send-button:hover:not(:disabled) {
    background: var(--primary-dark);
}

.send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.chat-help {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

.loading-spinner {
    animation: spin 1s linear infinite;
}

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

/* Exemples de questions */
.examples-section {
    margin-top: 2rem;
}

.examples-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    text-align: center;
    color: var(--text-dark);
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.example-btn {
    padding: 1rem;
    background: var(--border-color);
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    font-size: 0.9rem;
    line-height: 1.4;
}

.example-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

/* Footer */
.footer {
    background: var(--text-dark);
    color: white;
    padding: 3rem 0 1rem;
}

[data-theme="dark"] .footer {
    background: #1a202c;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--accent-color);
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.footer-link {
    color: white;
    text-decoration: none;
    transition: var(--transition);
}

.footer-link:hover {
    color: var(--accent-color);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1rem;
    text-align: center;
    font-size: 0.85rem;
    opacity: 0.7;
}

.footer-disclaimer {
    margin-top: 1rem;
    font-size: 0.8rem;
    line-height: 1.5;
}

/* Utilitaires */
.hidden {
    display: none !important;
}

.offline-indicator {
    position: fixed;
    top: 80px;
    right: 1rem;
    background: #f56565;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    z-index: 1001;
    box-shadow: var(--shadow-medium);
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding-top: 70px;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.2rem;
    }
    
    .hero-description {
        font-size: 1rem;
    }
    
    .sources {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .source-card {
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .source-image {
        width: 50px;
        height: 65px;
    }
    
    .features {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .feature {
        padding: 1rem;
    }
    
    .examples-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .header-content {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .nav {
        gap: 0.5rem;
    }
    
    .hero-content {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .source-image {
        width: 45px;
        height: 60px;
    }
    
    .source-title {
        font-size: 1rem;
    }
    
    .source-author {
        font-size: 0.8rem;
    }
    
    .cta-button {
        padding: 0.875rem 2rem;
        font-size: 1rem;
    }
}

/* Amélioration du contraste pour l'accessibilité */
@media (prefers-contrast: high) {
    .hero-overlay {
        background: rgba(0, 0, 0, 0.8);
    }
    
    .source-card {
        background: rgba(0, 0, 0, 0.8);
        border: 2px solid rgba(255, 255, 255, 0.6);
    }
    
    .feature {
        background: rgba(0, 0, 0, 0.8);
        border: 2px solid rgba(255, 255, 255, 0.6);
    }
}

/* Support pour les utilisateurs qui préfèrent moins d'animations */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .hero-video {
        animation: none;
    }
    
    .source-card:hover,
    .feature:hover,
    .cta-button:hover {
        transform: none;
    }
}



/* Styles pour les bulles d'information des sources */
.source-card {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.source-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.source-info-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(102, 126, 234, 0.9);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.source-card:hover .source-info-icon {
    opacity: 1;
}

/* Modal pour les informations des sources */
.source-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.9));
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: slideIn 0.3s ease;
}

.modal-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 20px 20px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.modal-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 25px;
    line-height: 1.6;
    color: #333;
}

.modal-body p {
    margin: 0 0 15px 0;
    font-size: 1rem;
}

.modal-body p:last-child {
    margin-bottom: 0;
}

.modal-body strong {
    color: #667eea;
    font-weight: 600;
}

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

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Mode sombre pour les modals */
[data-theme="dark"] .modal-content {
    background: linear-gradient(135deg, rgba(30, 30, 30, 0.95), rgba(20, 20, 20, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .modal-body {
    color: #e2e8f0;
}

[data-theme="dark"] .modal-body strong {
    color: #a78bfa;
}

/* Responsive */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-header h3 {
        font-size: 1.2rem;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .source-info-icon {
        opacity: 1; /* Toujours visible sur mobile */
    }
}

/* Support RTL pour les modals */
[dir="rtl"] .modal-header {
    direction: rtl;
}

[dir="rtl"] .modal-body {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .source-info-icon {
    right: auto;
    left: 10px;
}



/* Styles modernes pour les boutons et avatars */
.modern-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.modern-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.modern-btn:active {
    transform: translateY(0);
}

.modern-send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    min-width: 48px;
    height: 48px;
}

.modern-send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.modern-send-btn:active {
    transform: translateY(0);
}

.modern-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.send-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modern-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.chat-header .modern-avatar {
    width: 48px;
    height: 48px;
}

.message-avatar.modern-avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

/* Animation pour le spinner de chargement */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.loading-spinner svg {
    animation: spin 1s linear infinite;
}

/* Amélioration du logo */
.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon svg {
    filter: drop-shadow(0 2px 4px rgba(102, 126, 234, 0.3));
}

/* Styles pour les boutons de navigation modernisés */
.share-btn.modern-btn {
    padding: 0.6rem;
    min-width: 44px;
    height: 44px;
}

.theme-toggle {
    padding: 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-theme="dark"] .theme-toggle {
    background: var(--secondary-color);
    border-color: var(--border-color);
}

.theme-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Responsive design pour les nouveaux éléments */
@media (max-width: 768px) {
    .modern-btn {
        padding: 0.5rem;
        min-width: 40px;
        height: 40px;
    }
    
    .modern-send-btn {
        min-width: 44px;
        height: 44px;
    }
    
    .modern-avatar {
        width: 36px;
        height: 36px;
    }
    
    .chat-header .modern-avatar {
        width: 44px;
        height: 44px;
    }
    
    .message-avatar.modern-avatar {
        width: 28px;
        height: 28px;
    }
}

