/* =============================================
   B.A.I.F — Styles globaux
   ============================================= */

/* Glassmorphism */
.glass-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 30px -10px rgba(30, 58, 138, 0.15);
}

/* Dégradé Hero */
.hero-gradient {
    background: linear-gradient(135deg, #0A2463 0%, #1E3A8A 100%);
}

/* Hover lift */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px -10px rgba(30, 58, 138, 0.25);
}

/* Scrollbar custom */
::-webkit-scrollbar        { width: 6px; }
::-webkit-scrollbar-track  { background: #F5F5F7; }
::-webkit-scrollbar-thumb  { background: #0A2463; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #1E3A8A; }

/* ---- Animations scroll ---- */
.will-animate {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}
.will-animate.animated.fade-up {
    opacity: 1;
    transform: translateY(0);
}
.will-animate.animated.fade-in {
    opacity: 1;
    transform: none;
}

/* ---- Hero interne (pages secondaires) ---- */
.page-hero {
    background: linear-gradient(135deg, #0A2463 0%, #1E3A8A 100%);
    padding-top: 6rem;
    padding-bottom: 3rem;
}
@media (min-width: 768px) {
    .page-hero {
        padding-top: 8rem;
        padding-bottom: 4rem;
    }
}
.page-hero h1 {
    font-size: clamp(2rem, 5vw, 3.75rem);
    line-height: 1.1;
}
html, body { overflow-x: hidden; }

/* ---- Badges statut transaction ---- */
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-pending { background: #FEF3C7; color: #92400E; }
.badge-failed  { background: #FEE2E2; color: #991B1B; }

/* ---- Accordion FAQ ---- */
.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}
.faq-answer.open {
    max-height: 400px;
}

/* ---- Stepper ---- */
.step-item::before {
    content: '';
    position: absolute;
    top: 50%;
    right: -50%;
    width: 100%;
    height: 2px;
    background: #E5E7EB;
    transform: translateY(-50%);
}
.step-item.done::before   { background: #0A2463; }
.step-item:last-child::before { display: none; }

/* ---- Simulateur range ---- */
input[type="range"] {
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: #E5E7EB;
    outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #0A2463;
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px #0A2463;
}

/* ---- Focus visible global ---- */
:focus-visible {
    outline: 2px solid #0A2463;
    outline-offset: 2px;
}
button:focus-visible,
a:focus-visible {
    outline: 2px solid #0A2463;
    outline-offset: 3px;
    border-radius: 4px;
}

/* ---- Input transitions ---- */
input, textarea, select {
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

/* ---- Glass card focus-within ---- */
.glass-card:focus-within {
    box-shadow: 0 10px 30px -10px rgba(10, 36, 99, 0.1);
}

/* ---- Nav scroll transition ---- */
nav.fixed {
    transition: box-shadow 0.3s ease, background-color 0.3s ease;
}

/* ---- Burger → X animation ---- */
#burger.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
#burger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
#burger.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ---- Mobile menu slide (uniquement sur mobile, lg:hidden gère le desktop) ---- */
@media (max-width: 1023px) {
    #mobile-menu {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.35s ease;
        display: block;
    }
    #mobile-menu.open {
        max-height: 600px;
    }
}

/* ---- Table row hover ---- */
.table-hover tbody tr {
    transition: background-color 0.15s ease;
}
.table-hover tbody tr:hover {
    background-color: rgba(10, 36, 99, 0.03) !important;
}

/* ---- Dashboard card hover ---- */
.kpi-card {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 40px -10px rgba(10, 36, 99, 0.18);
}

/* ---- Transaction row hover ---- */
.tx-row {
    transition: background-color 0.15s ease;
    cursor: default;
}
.tx-row:hover {
    background-color: rgba(10, 36, 99, 0.025);
    border-radius: 0.5rem;
}

/* ---- Button active feedback ---- */
button[type="submit"]:active,
.btn-primary:active {
    transform: scale(0.98);
    opacity: 0.92;
}

/* ---- Scroll shadow for overflow tables ---- */
.scroll-shadow {
    position: relative;
}
.scroll-shadow::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 40px;
    background: linear-gradient(to left, rgba(245,245,247,0.9), transparent);
    pointer-events: none;
    border-radius: 0 1rem 1rem 0;
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    .hover-lift,
    .hover-lift:hover {
        transform: none !important;
        transition: box-shadow 0.2s ease !important;
    }
    .will-animate {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
    #burger span,
    #mobile-menu {
        transition: none !important;
    }
    .toast {
        transition: opacity 0.15s ease !important;
    }
}

/* ---- Modal overlay ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 36, 99, 0.55);
    backdrop-filter: blur(4px);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}
.modal-box {
    background: #fff;
    border-radius: 1rem;
    max-width: 28rem;
    width: 100%;
    box-shadow: 0 25px 60px -10px rgba(10, 36, 99, 0.35);
    transform: translateY(16px);
    transition: transform 0.2s ease;
}
.modal-overlay.open .modal-box {
    transform: translateY(0);
}

/* ---- Toast notification ---- */
.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    background: #0A2463;
    color: #fff;
    padding: 0.875rem 1.25rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(10, 36, 99, 0.3);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    max-width: 22rem;
}
.toast.show {
    transform: translateY(0);
    opacity: 1;
}
.toast.toast-success { background: #065F46; }
.toast.toast-error   { background: #991B1B; }
.toast.toast-info    { background: #0A2463; }

/* ---- Spinner ---- */
.spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}
.spinner-royal {
    border-color: rgba(10,36,99,0.2);
    border-top-color: #0A2463;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Form states ---- */
.field-error {
    border-color: #EF4444 !important;
    ring: none;
}
.field-error-msg {
    color: #DC2626;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}
.field-success {
    border-color: #10B981 !important;
}

/* ---- Loading button ---- */
.btn-loading {
    pointer-events: none;
    opacity: 0.7;
}

/* ---- Typing indicator (messagerie) ---- */
.typing-dot {
    animation: typing-dot 1.4s ease infinite;
}
@keyframes typing-dot {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30%            { opacity: 1;   transform: translateY(-3px); }
}
