/* --- 1. VARIABLES & SYSTÈME DE THÈME --- */
:root {
    /* PAR DÉFAUT : THÈME SOMBRE */
    --bg-main: #020617;
    --bg-card: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(15, 23, 42, 0.85);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);

    /* Couleurs fixes */
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --accent: #ef4444;
    --accent-hover: #dc2626;
    
    /* Animation */
    --transition-speed: 0.3s;
    --transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

/* OPTIONNEL : THÈME CLAIR (activé via la classe .lightmode) */
body.lightmode {
    --bg-main: #ffffff;
    --bg-card: #f8fafc;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.1);
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* --- 2. RESET & BASES --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Outfit', 'Segoe UI', Tahoma, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
    overflow-x: hidden;
}

/* Transitions fluides lors du clic */
body.is-transitioning, body.is-transitioning * {
    transition: background-color var(--transition-speed) ease, 
                color var(--transition-speed) ease, 
                border-color var(--transition-speed) ease, 
                transform var(--transition-speed) ease !important;
}

a { text-decoration: none; color: inherit; }
img { user-select: none; -webkit-user-drag: none; max-width: 100%; pointer-events: none; }

/* --- 3. LOGO & HEADER --- */
.div-logo {
    padding: 3rem 1rem;
    text-align: center;
    background: radial-gradient(circle at center, var(--bg-card) 0%, var(--bg-main) 100%);
}

.logo-icon {
    width: 80px;
    filter: drop-shadow(0 0 15px rgba(59, 130, 246, 0.4));
    transition: var(--transition);
}

.title-logo {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 4px;
    text-transform: uppercase;
    background: linear-gradient(90deg, var(--text-main), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- 4. NAVIGATION --- */
.navbar {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-link {
    color: var(--text-main) !important;
    font-weight: 600;
    padding: 0.6rem 1.25rem !important;
    border-radius: 10px;
    transition: var(--transition);
}

.nav-link:hover { background: rgba(59, 130, 246, 0.1); color: var(--primary) !important; }

/* --- 5. FORMULAIRE DE CONTACT --- */
.main { max-width: 900px; margin: 4rem auto; padding: 0 1.5rem; text-align: center; }

fieldset {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: var(--shadow);
}

legend {
    font-size: 1.5rem;
    font-weight: 800;
    padding: 0.5rem 2rem;
    background-color: var(--accent);
    color: #fff;
    border-radius: 50px;
    margin: 0 auto 2rem auto;
}

.contact, .contact-message {
    width: 100%;
    background: var(--bg-main);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.25rem;
}

.btn-submit {
    width: 100%;
    background: var(--accent);
    color: #fff;
    padding: 1rem;
    border-radius: 12px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

/* --- 6. FOOTER & SWITCH --- */
footer.footer-glass {
    margin-top: 5rem;
    padding: 4rem 2rem;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
}

.switch-ui {
    width: 60px;
    height: 30px;
    background: #1e293b; /* Couleur sombre par défaut */
    border-radius: 30px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 5px;
    transition: background-color var(--transition-speed) ease;
}

body.lightmode .switch-ui { background: #e2e8f0; }

/* LOGIQUE DES ICÔNES (Sombre par défaut) */
.switch-ui i { font-size: 1rem; z-index: 2; }

/* Par défaut (Sombre) : On montre la lune, on cache le soleil */
.sun-icon { color: #f59e0b; display: none; }
.moon-icon { color: var(--primary); display: block; }

/* Mode Clair : On montre le soleil, on cache la lune */
body.lightmode .sun-icon { display: block; }
body.lightmode .moon-icon { display: none; }

.switch-ui::after {
    content: '';
    position: absolute;
    left: 2px;
    width: 26px;
    height: 26px;
    background: white;
    border-radius: 50%;
    /* Position par défaut à droite (Sombre) */
    transform: translateX(30px);
    transition: transform var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 1;
}

/* En mode clair, on ramène le cercle à gauche */
body.lightmode .switch-ui::after { transform: translateX(0); }

/* --- 7. RESPONSIVE --- */
@media (max-width: 991px) {
    .main { width: 95%; }
}

/* --- MODAL TERMS --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: none; /* Caché par défaut */
    justify-content: center;
    align-items: center;
    z-index: 99999;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    padding: 30px !important;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 1.5rem;
    color: var(--accent);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    overflow-y: auto;
    text-align: left;
    padding-right: 10px;
}

/* Custom Scrollbar pour le modal */
.modal-body::-webkit-scrollbar { width: 5px; }
.modal-body::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 10px; }

.modal-body h3 {
    font-size: 1rem;
    color: var(--text-main);
    margin: 15px 0 5px;
}

.modal-body p {
    font-size: 0.9rem;
    color: var(--text-dim);
    line-height: 1.6;
}

.modal-footer {
    margin-top: 20px;
}

.box-button {
  width: 100%;
  height: 58px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 16px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: var(--transition);
  margin-top: 20px;
}

.box-button:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px var(--accent-glow);
}

/* --- AMBIANCE SOLAIRE (Mode Clair) --- */
body.lightmode .sun {
    display: block;
}

/* Le corps du soleil */
.sun {
    position: fixed;
    top: -80px;
    left: -80px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, 
        #ffffff 0%, 
        #fff9c4 20%, 
        #ffeb3b 50%, 
        transparent 70%);
    border-radius: 50%;
    filter: blur(20px);
    z-index: -1;
    display: none;
    animation: sunGlow 15s infinite alternate ease-in-out;
}

/* Les rayons de soleil (Lens Flare) */
body.lightmode .sun::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200vw;
    height: 2px;
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.4) 0%, 
        rgba(255, 235, 59, 0.1) 50%, 
        transparent 100%);
    transform: rotate(35deg) translateY(-50%);
    box-shadow: 0 0 40px rgba(255, 255, 255, 0.2);
    pointer-events: none;
}

/* Cercles de réfraction (petits reflets dans l'objectif) */
.lens-flare {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: -1;
    display: none;
}

body.lightmode .lens-flare {
    display: block;
    background: 
        radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.1) 0%, transparent 10%),
        radial-gradient(circle at 45% 55%, rgba(255, 235, 59, 0.05) 0%, transparent 15%),
        radial-gradient(circle at 60% 70%, rgba(255, 255, 255, 0.08) 0%, transparent 8%);
}

@keyframes sunGlow {
    from { transform: scale(1); opacity: 0.7; }
    to { transform: scale(1.1); opacity: 1; }
}

/* Animation Nuit : Scintillement */
@keyframes twinkle {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* Animation Jour : Flottement de poussière solaire */
@keyframes floatSolar {
    0% { transform: translate(0, 0); opacity: 0; }
    20% { opacity: 0.5; }
    80% { opacity: 0.5; }
    100% { transform: translate(40px, -60px); opacity: 0; }
}

/* Conteneur pour s'assurer que rien ne dépasse */
#star-field {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}