/* Variables CSS */
:root {
    /* @tweakable primary color for the college branding */
    --primary-color: #1e40af;
    /* @tweakable secondary color for accents */
    --secondary-color: #eab308;
    /* @tweakable animation duration for smooth transitions */
    --animation-duration: 0.3s;
}

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

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    scroll-behavior: smooth;
}

/* Custom animations */
@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fade-in 1s ease-out;
}

/* Hero section custom styles */
.hero-bg {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e3a8a 100%);
    position: relative;
    overflow: hidden;
}

.hero-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="2" fill="rgba(255,255,255,0.1)"/></svg>') repeat;
    animation: float 20s infinite linear;
}

@keyframes float {
    from {
        transform: translateY(0px);
    }
    to {
        transform: translateY(-100px);
    }
}

/* Card hover effects */
.card-hover {
    transition: all var(--animation-duration) ease;
}

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Custom chatbot styles */
#chatbot-widget {
    /* @tweakable chatbot widget size */
    width: 60px;
    height: 60px;
    transition: all var(--animation-duration) ease;
    animation: pulse 2s infinite;
}

#chatbot-widget:hover {
    transform: scale(1.1);
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(30, 64, 175, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(30, 64, 175, 0);
    }
}

/* Chat messages styles */
.chat-message {
    max-width: 80%;
    margin-bottom: 12px;
    padding: 8px 12px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
}

.chat-message.user {
    background-color: var(--primary-color);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.chat-message.bot {
    background-color: #f3f4f6;
    color: #374151;
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

/* Mobile responsiveness improvements */
@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 2.5rem;
    }
    
    .hero-section p {
        font-size: 1.125rem;
    }
    
    #chatbot-window {
        width: 320px;
        right: -20px;
    }
}

/* Loading animation */
.loading-dots {
    display: inline-block;
}

.loading-dots::after {
    content: '...';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% {
        content: '.';
    }
    40% {
        content: '..';
    }
    60%, 100% {
        content: '...';
    }
}

/* Smooth scrolling offset for fixed navbar */
section {
    scroll-margin-top: 80px;
}

/* Custom button styles */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e3a8a 100%);
    transition: all var(--animation-duration) ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(30, 64, 175, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #ca8a04 100%);
    transition: all var(--animation-duration) ease;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(234, 179, 8, 0.3);
}


/* Styles pour le bouton hamburger */
.mobile-menu-button {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
    cursor: pointer;
    padding: 0;
    background: transparent;
    border: none;
}

.mobile-menu-button span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: #ffffff;
    border-radius: 3px;
    transition: all 0.3s linear;
    position: relative;
    transform-origin: 1px;
}

/* Animation du hamburger vers X */
.mobile-menu-button.open span:first-child {
    transform: rotate(45deg);
}

.mobile-menu-button.open span:nth-child(2) {
    opacity: 0;
    transform: translateX(20px);
}

.mobile-menu-button.open span:third-child {
    transform: rotate(-45deg);
}

/* Menu mobile caché par défaut */
.mobile-menu {
    display: none;
    position: fixed;
    top: 80px; /* Hauteur du header */
    left: 0;
    right: 0;
    background: rgba(30, 64, 175, 0.98);
    backdrop-filter: blur(10px);
    z-index: 1000;
    padding: 20px;
    transform: translateY(-100%);
    transition: all 0.3s ease-in-out;
}

.mobile-menu.show {
    transform: translateY(0);
}

.mobile-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-menu li {
    margin: 15px 0;
}

.mobile-menu a {
    color: white;
    text-decoration: none;
    font-size: 18px;
    font-weight: 500;
    display: block;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.mobile-menu a:hover {
    color: #fbbf24;
    padding-left: 10px;
}

/* Affichage sur mobile */
@media (max-width: 768px) {
    .mobile-menu-button {
        display: flex !important;
    }
    
    .desktop-menu {
        display: none !important;
    }
    
    .mobile-menu {
        display: block;
    }
}

/* ========================================
   CORRECTIONS POUR LE CHATBOT MOBILE 
   ======================================== */

/* Conteneur principal du chatbot */
#chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

/* Widget du chatbot */
#chatbot-widget {
    width: 60px;
    height: 60px;
    background: #3b82f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
    transition: all 0.3s ease;
    animation: pulse-ring 3s infinite;
}

#chatbot-widget:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(59, 130, 246, 0.6);
}

/* Fenêtre du chatbot - Version Desktop */
#chatbot-window {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid #e5e7eb;
    overflow: hidden;
    transform: scale(0.8) translateY(20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: none;
}

#chatbot-window.show {
    transform: scale(1) translateY(0);
    opacity: 1;
    display: block;
}

/* CORRECTIONS MOBILE POUR LE CHATBOT */
@media (max-width: 640px) {
    #chatbot-container {
        bottom: 15px;
        right: 15px;
        left: 15px;
        display: flex;
        justify-content: flex-end;
    }
    
    #chatbot-widget {
        width: 55px;
        height: 55px;
        position: relative;
    }
    
    #chatbot-window {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 70vh !important;
        border-radius: 20px 20px 0 0 !important;
        transform: translateY(100%) !important;
        opacity: 1 !important;
    }
    
    #chatbot-window.show {
        transform: translateY(0) !important;
        opacity: 1 !important;
    }
    
    /* Ajustements pour le contenu du chat sur mobile */
    #chat-messages {
        height: calc(70vh - 120px) !important;
        padding: 15px !important;
    }
    
    .message-content {
        max-width: 90% !important;
        font-size: 15px !important;
    }
    
    /* Zone de saisie sur mobile */
    .chat-input-container {
        padding: 15px !important;
        background: white;
        border-top: 1px solid #e5e7eb;
    }
    
    #chat-input {
        font-size: 16px !important; /* Empêche le zoom sur iOS */
        padding: 12px 15px !important;
    }
}

/* Corrections spécifiques pour iOS */
@supports (-webkit-touch-callout: none) {
    #chatbot-window {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Animation du pulse pour le widget */
@keyframes pulse-ring {
    0% { 
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); 
    }
    70% { 
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); 
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); 
    }
}

/* Animations pour les messages */
@keyframes slideIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.message {
    animation: slideIn 0.3s ease;
}

/* Indicateur de frappe */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    max-width: 80px;
    margin-bottom: 12px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9ca3af;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { 
        opacity: 0.4; 
        transform: scale(0.8); 
    }
    30% { 
        opacity: 1; 
        transform: scale(1); 
    }
}

/* Overlay pour fermer le chat sur mobile */
.chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

@media (max-width: 640px) {
    .chat-overlay.show {
        display: block;
    }
}

/* ========================================
   CORRECTIONS POUR LE MENU HAMBURGER MOBILE 
   ======================================== */

/* Styles pour le bouton hamburger */
.mobile-menu-button {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
    cursor: pointer;
    padding: 0;
    background: transparent;
    border: none;
}

.mobile-menu-button span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: #ffffff;
    border-radius: 3px;
    transition: all 0.3s linear;
    position: relative;
    transform-origin: 1px;
}

/* Animation du hamburger vers X */
.mobile-menu-button.open span:first-child {
    transform: rotate(45deg);
}

.mobile-menu-button.open span:nth-child(2) {
    opacity: 0;
    transform: translateX(20px);
}

.mobile-menu-button.open span:third-child {
    transform: rotate(-45deg);
}

/* Menu mobile caché par défaut */
.mobile-menu {
    display: none;
    position: fixed;
    top: 80px; /* Hauteur du header */
    left: 0;
    right: 0;
    background: rgba(30, 64, 175, 0.98);
    backdrop-filter: blur(10px);
    z-index: 1000;
    padding: 20px;
    transform: translateY(-100%);
    transition: all 0.3s ease-in-out;
}

.mobile-menu.show {
    transform: translateY(0);
}

.mobile-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-menu li {
    margin: 15px 0;
}

.mobile-menu a {
    color: white;
    text-decoration: none;
    font-size: 18px;
    font-weight: 500;
    display: block;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.mobile-menu a:hover {
    color: #fbbf24;
    padding-left: 10px;
}

/* Affichage sur mobile */
@media (max-width: 768px) {
    .mobile-menu-button {
        display: flex !important;
    }
    
    .desktop-menu {
        display: none !important;
    }
    
    .mobile-menu {
        display: block;
    }
}

/* ========================================
   CORRECTIONS POUR LE CHATBOT MOBILE 
   ======================================== */

/* Conteneur principal du chatbot */
#chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

/* Widget du chatbot */
#chatbot-widget {
    width: 60px;
    height: 60px;
    background: #3b82f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
    transition: all 0.3s ease;
    animation: pulse-ring 3s infinite;
}

#chatbot-widget:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(59, 130, 246, 0.6);
}

/* Fenêtre du chatbot - Version Desktop */
#chatbot-window {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid #e5e7eb;
    overflow: hidden;
    transform: scale(0.8) translateY(20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: none;
}

#chatbot-window.show {
    transform: scale(1) translateY(0);
    opacity: 1;
    display: block;
}

/* CORRECTIONS MOBILE POUR LE CHATBOT */
@media (max-width: 640px) {
    #chatbot-container {
        bottom: 15px;
        right: 15px;
        left: 15px;
        display: flex;
        justify-content: flex-end;
    }
    
    #chatbot-widget {
        width: 55px;
        height: 55px;
        position: relative;
    }
    
    #chatbot-window {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 70vh !important;
        border-radius: 20px 20px 0 0 !important;
        transform: translateY(100%) !important;
        opacity: 1 !important;
    }
    
    #chatbot-window.show {
        transform: translateY(0) !important;
        opacity: 1 !important;
    }
    
    /* Ajustements pour le contenu du chat sur mobile */
    #chat-messages {
        height: calc(70vh - 120px) !important;
        padding: 15px !important;
    }
    
    .message-content {
        max-width: 90% !important;
        font-size: 15px !important;
    }
    
    /* Zone de saisie sur mobile */
    .chat-input-container {
        padding: 15px !important;
        background: white;
        border-top: 1px solid #e5e7eb;
    }
    
    #chat-input {
        font-size: 16px !important; /* Empêche le zoom sur iOS */
        padding: 12px 15px !important;
    }
}

/* Corrections spécifiques pour iOS */
@supports (-webkit-touch-callout: none) {
    #chatbot-window {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Animation du pulse pour le widget */
@keyframes pulse-ring {
    0% { 
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); 
    }
    70% { 
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); 
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); 
    }
}

/* Animations pour les messages */
@keyframes slideIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.message {
    animation: slideIn 0.3s ease;
}

/* Indicateur de frappe */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    max-width: 80px;
    margin-bottom: 12px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9ca3af;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { 
        opacity: 0.4; 
        transform: scale(0.8); 
    }
    30% { 
        opacity: 1; 
        transform: scale(1); 
    }
}

/* Overlay pour fermer le chat sur mobile */
.chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

@media (max-width: 640px) {
    .chat-overlay.show {
        display: block;
    }
}
