/*==================================================
  SCHOOLEAD - CONNEXION.CSS (OPTIMIZED & RESPONSIVE)
==================================================*/

:root {
    --primary: #0A58CA;
    --primary-dark: #003B95;
    --secondary: #ff7a00;
    --orange: #ff7a00;
    --blue-light: #5a7dff;
    --white: #ffffff;
    --light: #f5f8fc;
    --light-gray: #f8f9fa;
    --text: #222222;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --gray: #777777;
    --border: #e5e5e5;
    --success: #28a745;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #eef4ff, #ffffff);
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--text);
    position: relative;
    line-height: 1.6;
}

img { max-width: 100%; height: auto; display: block; }

.container {
    width: 92%;
    max-width: 1450px;
    margin: 0 auto;
}

/*==============================
  2. PRELOADER (WITH CSS FAILSAFE)
==============================*/
#schoolead-preloader {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--white);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    animation: autoPreloaderDismiss 0.4s ease 1.2s forwards;
}

@keyframes autoPreloaderDismiss {
    0% { opacity: 1; visibility: visible; }
    100% { opacity: 0; visibility: hidden; pointer-events: none; }
}

.spinner-wrapper {
    position: relative;
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.spinner-wrapper img {
    width: 45px;
    z-index: 10;
    border-radius: 5px;
}

.circle-orange, .circle-blue {
    position: absolute;
    border-radius: 50%;
    border: 3px solid transparent;
}

.circle-orange {
    width: 100%; height: 100%;
    border-top-color: var(--secondary);
    border-bottom-color: var(--secondary);
    animation: spin 1.2s linear infinite;
}

.circle-blue {
    width: 70%; height: 70%;
    border-left-color: var(--primary);
    border-right-color: var(--primary);
    animation: spin 1.8s linear infinite reverse;
}

.preloader-text {
    font-size: 20px;
    color: var(--primary);
    font-weight: 700;
    letter-spacing: 2px;
}

/*==============================
  3. HEADER & NAVIGATION
==============================*/
.header {
    position: fixed;
    width: 100%;
    top: 0; left: 0;
    background: var(--white);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    z-index: 1000;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.header .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.header .logo img { width: 42px; height: auto; }

.header .logo-text h2 {
    font-size: 18px;
    color: var(--primary);
    margin-bottom: -2px;
    font-weight: 800;
}

.header .logo-text span {
    font-size: 10px;
    color: var(--gray);
    display: block;
}

.navbar ul {
    display: flex;
    gap: 20px;
    list-style: none;
}

.navbar a {
    color: var(--text-dark);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: 0.3s;
}

.navbar a:hover, .navbar a.active { color: var(--primary); font-weight: 600; }

.sidenav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-idemo, .btn-login, .btn-demo {
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    padding: 8px 14px;
    transition: 0.3s;
    text-align: center;
    white-space: nowrap;
}

.btn-idemo { border: 1.5px solid var(--secondary); color: var(--secondary); }
.btn-idemo:hover { background: var(--secondary); color: var(--white); }
.btn-login { color: var(--primary); }
.btn-login:hover, .btn-login.active { background: var(--light-gray); }
.btn-demo { background: var(--primary); color: var(--white); border: 1.5px solid var(--primary); }
.btn-demo:hover { background: transparent; color: var(--primary); }

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 5px;
    z-index: 1002;
}

.menu-toggle span {
    width: 25px; height: 3px;
    background: var(--primary);
    border-radius: 2px;
    transition: 0.3s ease-in-out;
}

.menu-toggle.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/*==============================
  4. BACKGROUND ELEMENTS
==============================*/
.bg-circle {
    position: absolute;
    border-radius: 50%;
    z-index: -1;
    filter: blur(5px);
}

.circle1 { width: 320px; height: 320px; background: rgba(10, 88, 202, .12); top: -120px; left: -120px; }
.circle2 { width: 250px; height: 250px; background: rgba(255, 122, 0, .12); right: -80px; top: 120px; }
.circle3 { width: 420px; height: 420px; background: rgba(10, 88, 202, .08); bottom: -180px; right: -100px; }

.wave-bg {
    position: fixed;
    left: 0; top: 0; width: 100%; height: 100%;
    z-index: -2;
    overflow: hidden;
}

.wave-bg svg { width: 100%; height: 100%; }

/*==============================
  5. MAIN CONNEXION LAYOUT
==============================*/
main.connexion-container {
    min-height: calc(100vh - 70px);
    padding-top: 100px;
    padding-bottom: 60px;
    display: grid;
    grid-template-columns: 1fr 520px;
    align-items: center;
    gap: 70px;
}

.left { padding: 20px 30px; animation: slideLeft .8s ease; }
.left .logo { display: flex; align-items: center; gap: 18px; margin-bottom: 45px; }
.left .logo-img { width: 75px; height: 75px; object-fit: contain; filter: drop-shadow(0 8px 20px rgba(0,0,0,.15)); animation: float 5s infinite ease-in-out; }
.left .logo h1 { font-size: 40px; font-weight: 700; }
.left .logo span { color: var(--orange); }
.left .logo p { color: var(--gray); margin-top: 4px; font-size: 15px; }
.left h2 { font-size: 48px; line-height: 1.25; font-weight: 700; margin-bottom: 20px; }

.orange-line {
    width: 90px; height: 6px;
    background: var(--orange);
    border-radius: 30px;
    margin-bottom: 40px;
}

.feature {
    display: flex;
    align-items: center;
    gap: 22px;
    background: rgba(255, 255, 255, .75);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 22px;
    margin-bottom: 25px;
    border: 1px solid rgba(255, 255, 255, .7);
    box-shadow: 0 12px 25px rgba(0, 0, 0, .05);
    transition: .35s;
}

.feature:hover { transform: translateY(-6px); box-shadow: 0 18px 35px rgba(0, 0, 0, .10); }
.feature:hover .icon { transform: rotate(10deg) scale(1.08); transition: .4s; }

.icon {
    width: 64px; height: 64px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex; justify-content: center; align-items: center;
    color: var(--white); font-size: 26px; flex-shrink: 0;
}

.feature h3 { font-size: 19px; margin-bottom: 4px; }
.feature p { color: var(--gray); line-height: 1.5; font-size: 14px; }

/*==============================
  6. LOGIN CARD
==============================*/
.right { display: flex; justify-content: center; align-items: center; animation: slideRight .8s ease; }

.login-card {
    width: 100%;
    max-width: 500px;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(25px);
    border-radius: 28px;
    padding: 45px;
    border: 1px solid rgba(255, 255, 255, .8);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .12);
    animation: fadeUp .8s ease;
}

.login-card h1 { font-size: 36px; text-align: center; margin-bottom: 8px; color: var(--primary-dark); }
.login-card p { text-align: center; color: var(--gray); margin-bottom: 20px; font-size: 15px; }
.center { margin-left: auto; margin-right: auto; }

form { margin-top: 25px; }
label { display: block; font-weight: 600; margin-bottom: 8px; margin-top: 18px; color: #333; font-size: 14px; }

.input-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--white);
    border: 1px solid #dddddd;
    border-radius: 15px;
    padding: 14px 18px;
    transition: .3s;
}

.input-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(10, 88, 202, .15);
}

.input-box i { color: #999; font-size: 18px; }
.input-box input { width: 100%; border: none; outline: none; background: transparent; font-size: 15px; color: #333; }

.options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 18px;
    margin-bottom: 28px;
    font-size: 14px;
}

.options label.remember-me { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.options a.forgot-link { color: var(--primary); text-decoration: none; font-weight: 500; }
.options a.forgot-link:hover { text-decoration: underline; }

.login-btn {
    width: 100%;
    height: 56px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: .35s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.login-btn:hover { transform: translateY(-3px); box-shadow: 0 15px 30px rgba(10, 88, 202, 0.35); }

.separator { position: relative; text-align: center; margin: 30px 0; }
.separator::before { content: ""; position: absolute; width: 100%; height: 1px; background: #ddd; left: 0; top: 50%; }
.separator span { background: var(--white); position: relative; padding: 0 18px; color: #888; font-size: 14px; }

.admin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 54px;
    border-radius: 16px;
    background: var(--white);
    border: 1.5px solid #ddd;
    color: var(--primary-dark);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: .3s;
    gap: 10px;
}

.admin-btn:hover { border-color: var(--primary); color: var(--primary); }
.contact { margin-top: 25px; text-align: center; font-size: 14px; }
.contact a { color: var(--orange); text-decoration: none; font-weight: 600; }

/*==============================
  7. MULTI-SCHOOL MODAL STYLING
==============================*/
.school-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(6px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100000;
    padding: 20px;
}

.school-modal-box {
    background: #ffffff;
    width: 100%;
    max-width: 560px;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: fadeUp 0.3s ease;
}

.school-modal-header {
    background: #0f172a;
    color: #ffffff;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.school-modal-header h3 { font-size: 17px; font-weight: 700; color: #f97316; display: flex; align-items: center; gap: 10px; }
.school-modal-header .close-btn { background: none; border: none; color: #94a3b8; font-size: 24px; cursor: pointer; }
.school-modal-header .close-btn:hover { color: #fff; }

.school-modal-body { padding: 24px; max-height: 70vh; overflow-y: auto; }
.modal-desc { font-size: 14px; color: #64748b; margin-bottom: 20px; }

.school-list { display: flex; flex-direction: column; gap: 12px; }

.school-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: 0.2s;
}

.school-card:hover { border-color: #f97316; background: #fffbf7; }
.school-info h4 { font-size: 15px; color: #0f172a; font-weight: 700; margin-bottom: 4px; }
.school-meta { display: flex; gap: 12px; font-size: 13px; color: #64748b; align-items: center; }

.role-badge { padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.role-fonde { background: #ffedd5; color: #c2410c; }
.role-directeur { background: #e0f2fe; color: #0369a1; }
.role-comptable { background: #dcfce7; color: #15803d; }
.role-caissier { background: #f3e8ff; color: #7e22ce; }
.role-secretaire { background: #f1f5f9; color: #475569; }

.btn-select-school {
    background: #ea580c;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-select-school:hover { background: #c2410c; }

/*==============================
  8. FLOATING WIDGETS
==============================*/
.widget-btn {
    width: 50px; height: 50px;
    border-radius: 50%;
    border: none;
    color: var(--white);
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.18);
    transition: transform 0.3s;
    display: flex; justify-content: center; align-items: center;
}
.widget-btn:hover { transform: translateY(-3px); }

.left-widgets { position: fixed; bottom: 25px; left: 25px; z-index: 1001; display: flex; flex-direction: column; gap: 15px; }
.calendar-btn { background: var(--primary); }
.wa-trigger { background: #25D366; }
.whatsapp-container { position: relative; }

.wa-info-card {
    position: absolute; bottom: 0; left: 65px; width: 240px;
    background: var(--white); border-radius: 12px; padding: 15px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.15);
    display: none; border: 1px solid #eaeaea;
}
.wa-info-card.active { display: block; }
.wa-info-card p { font-size: 13px; font-weight: 600; margin-bottom: 12px; }

.whatsapp-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    background: #25D366; color: var(--white); text-decoration: none;
    padding: 10px 14px; border-radius: 8px; font-weight: 600; font-size: 13px;
}

.close-wa { position: absolute; top: 8px; right: 12px; background: none; border: none; font-size: 18px; color: var(--gray); cursor: pointer; }

.right-widgets { position: fixed; bottom: 25px; right: 25px; z-index: 1001; }
.chat-trigger-btn {
    width: 55px; height: 55px; border-radius: 50%; background: #2570ff; color: var(--white);
    border: none; font-size: 22px; cursor: pointer; box-shadow: 0 4px 15px rgba(37,112,255,0.4);
    display: flex; align-items: center; justify-content: center;
}
.chat-badge {
    position: absolute; top: -2px; right: -2px; background: #e63946; color: #fff;
    font-size: 11px; font-weight: bold; width: 20px; height: 20px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; border: 2px solid #fff;
}

.chat-window {
    position: absolute; bottom: 70px; right: 0; width: 320px; background: var(--white);
    border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,0.15); display: none;
    overflow: hidden; border: 1px solid #eaeaea;
}
.chat-window.active { display: block; }
.chat-header { padding: 10px 15px 0; text-align: right; }
.close-chat { background: none; border: none; font-size: 22px; color: var(--gray); cursor: pointer; }
.chat-body { padding: 0 20px 20px; }
.chat-message { background: #f8f9fa; border: 1px solid #eaeaea; padding: 12px 15px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.chat-options { display: flex; flex-direction: column; gap: 8px; }
.chat-opt { text-decoration: none; border: 1.5px solid #2570ff; color: #2570ff; padding: 9px 14px; border-radius: 20px; font-size: 12px; font-weight: 600; text-align: center; }
.chat-opt:hover { background: #2570ff; color: #fff; }

/*==============================
  9. FOOTER
==============================*/
.footer { background: #0f172a; color: var(--white); padding-top: 70px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1.5fr; gap: 40px; }
.footer-about img { width: 140px; margin-bottom: 20px; }
.footer-about p { color: #cbd5e1; font-size: 14px; }
.footer h3 { margin-bottom: 25px; font-size: 18px; color: #fff; }
.footer-links ul { list-style: none; }
.footer-links ul li { margin-bottom: 12px; }
.footer-links ul li a { color: #cbd5e1; text-decoration: none; font-size: 14px; }
.footer-links ul li a:hover { color: var(--primary); }
.footer-contact p { color: #cbd5e1; margin-bottom: 12px; display: flex; align-items: center; gap: 12px; font-size: 14px; }
.footer-bottom { margin-top: 50px; border-top: 1px solid rgba(255, 255, 255, 0.08); text-align: center; padding: 22px 0; color: #94a3b8; font-size: 14px; }

/*==============================
  10. KEYFRAMES & RESPONSIVE
==============================*/
@keyframes fadeUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideLeft { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideRight { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes spin { 100% { transform: rotate(360deg); } }

@media (max-width: 992px) {
    main.connexion-container { grid-template-columns: 1fr; padding-top: 90px; gap: 40px; }
    .left { text-align: center; }
    .left .logo { justify-content: center; }
    .orange-line { margin: 0 auto 35px; }
    .feature { max-width: 600px; margin: 0 auto 20px; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .menu-toggle { display: flex; }
    .navbar { display: none; }
    .left { display: none; }
    main.connexion-container { padding-top: 85px; }
    .login-card { padding: 30px 22px; }
}
