/**
 * KAIZER DIGITAL — Responsive global (mobile, tablette, Mac/iOS Safari)
 * Chargé sur le site public, l’admin et l’espace utilisateur.
 */

/* Validation formulaires — champs obligatoires */
.kz-form-errors-summary {
    background: rgba(220, 53, 69, 0.12);
    border: 1px solid rgba(220, 53, 69, 0.45);
    color: #ff6b6b;
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
}
.kz-field-invalid,
input.kz-field-invalid,
select.kz-field-invalid,
textarea.kz-field-invalid,
.kz-cgu-accept.kz-field-invalid {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.25) !important;
}
.kz-cgu-accept.kz-field-invalid {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #dc3545 !important;
}
.kz-field-error {
    color: #ff6b6b;
    font-size: 0.8rem;
    margin-top: 6px;
    line-height: 1.35;
}
label.kz-field-invalid {
    color: #ff6b6b !important;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    font-size: clamp(14px, 0.35vw + 13px, 16px);
}

:root {
    --kz-bar-h: 56px;
    --kz-shell-h: 58px;
}
@media (max-width: 991.98px) {
    :root {
        --kz-bar-h: 56px;
        --kz-shell-h: clamp(88px, 17vw, 110px);
    }
}
@media (max-width: 767.98px) {
    :root {
        --kz-bar-h: 72px;
        --kz-shell-h: clamp(112px, 29vw, 140px);
    }
}

body {
    font-size: 1rem;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

img,
video,
svg,
canvas {
    max-width: 100%;
    height: auto;
}

iframe {
    max-width: 100%;
}

/* Tables scrollables sur petit écran (Safari iOS / Mac trackpad) */
.table-responsive,
.tbl-wrap,
.kz-table-scroll,
.ord-card,
[style*="overflow-x:auto"],
[style*="overflow-x: auto"] {
    -webkit-overflow-scrolling: touch;
}

/* Zone sûre iPhone / encoche (compatible Mac Safari) */
@supports (padding: max(0px)) {
    .user-header,
    .kz-topbar {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }
    .kz-fab-group {
        bottom: max(16px, env(safe-area-inset-bottom));
        right: max(16px, env(safe-area-inset-right));
    }
}

/* Boutons flottants (thème + WhatsApp) */
.kz-fab-group {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    z-index: 1000;
}

.kz-fab-group .whatsapp-btn {
    position: static;
}

/* Hauteur = barre + débordement logo (bannières collées sous le header) */
.kz-nav-spacer {
    height: var(--kz-shell-h, 58px);
}

/* Pages connexion / inscription / validation — espace sous le logo du header */
body:has(.auth-page-wrap) .kz-nav-spacer {
    height: clamp(96px, 13vw, 128px);
}
body:has(.auth-page-wrap--verify) .kz-nav-spacer {
    height: clamp(100px, 14vw, 132px);
}
@media (max-width: 991.98px) {
    body:has(.auth-page-wrap) .kz-nav-spacer {
        height: clamp(108px, 22vw, 138px);
    }
}
@media (max-width: 767.98px) {
    body:has(.auth-page-wrap) .kz-nav-spacer {
        height: clamp(112px, 28vw, 148px);
    }
}

/* Mobile — bannières / hero étudiant collés sous la barre navbar (logo déborde dans l’image) */
@media (max-width: 991.98px) {
    body:has(.page-hero:not(.page-hero-home)) .kz-nav-spacer,
    body:has(.sp-hero) .kz-nav-spacer {
        height: var(--kz-bar-h, 56px);
    }
    body:has(.page-hero:not(.page-hero-home)) .page-hero,
    body:has(.sp-hero) .sp-hero {
        margin-top: 0 !important;
    }
    body:has(.sp-hero) .sp-hero {
        padding-top: clamp(14px, 3.5vw, 22px);
    }
    /* À propos — bannière remontée (gap résiduel sur cette page uniquement) */
    body:has(.page-hero-about) .kz-nav-spacer {
        height: var(--kz-bar-h, 56px);
    }
    .page-hero-about {
        margin-top: clamp(-28px, -5vw, -14px) !important;
    }
    .page-hero-about .page-hero-bg {
        top: clamp(-22px, -4vw, -12px);
        height: calc(100% + clamp(22px, 4vw, 34px));
    }
}

/* Pages auth : espace = barre navbar + débordement du logo (évite que le formulaire passe sous le header) */
body:has(.auth-page-wrap) .kz-nav-spacer {
    height: clamp(76px, 10vw, 106px);
}
body:has(.auth-page-wrap) {
    scroll-padding-top: clamp(80px, 11vw, 112px);
}
@media (max-width: 991.98px) {
    body:has(.auth-page-wrap) .kz-nav-spacer {
        height: clamp(72px, 14vw, 96px);
    }
}
@media (max-width: 576px) {
    body:has(.auth-page-wrap) .kz-nav-spacer {
        height: clamp(68px, 18vw, 88px);
    }
}

/* Bandeau logos partenaires — collé aux témoignages, boucle infinie */
.kz-partners-block {
    margin-top: clamp(1.75rem, 4vw, 2.5rem);
    padding-top: clamp(1.25rem, 3vw, 1.75rem);
    border-top: 1px solid rgba(201, 168, 76, 0.18);
}
.kz-partners-heading {
    text-align: center;
    font-size: clamp(1.15rem, 2.8vw, 1.45rem);
    font-weight: 700;
    margin: 0 0 1.15rem;
    letter-spacing: 0.01em;
}
.kz-partners-marquee {
    overflow: hidden;
    padding: 0.35rem 0 0.15rem;
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 6%, #000 94%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0%, #000 6%, #000 94%, transparent 100%);
}
.kz-partners-track {
    display: flex;
    width: max-content;
    animation: kz-partners-scroll 55s linear infinite;
    will-change: transform;
}
.kz-partners-marquee:hover .kz-partners-track {
    animation-play-state: paused;
}
.kz-partners-strip {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: clamp(1.75rem, 4.5vw, 3.25rem);
    padding-right: clamp(1.75rem, 4.5vw, 3.25rem);
}
.kz-partners-item {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: clamp(110px, 15vw, 160px);
    height: clamp(64px, 9vw, 80px);
    padding: 0.65rem 1.1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(201, 168, 76, 0.14);
    border-radius: 12px;
    transition: border-color 0.2s ease, background 0.2s ease;
}
body.light-theme .kz-partners-item {
    background: rgba(0, 0, 0, 0.035);
    border-color: rgba(201, 168, 76, 0.22);
}
.kz-partners-item:hover {
    border-color: rgba(201, 168, 76, 0.35);
    background: rgba(201, 168, 76, 0.06);
}
.kz-partners-item a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    line-height: 0;
}
.kz-partners-logo {
    height: clamp(46px, 6.5vw, 60px);
    width: auto;
    max-width: clamp(120px, 17vw, 165px);
    object-fit: contain;
    object-position: center;
    opacity: 0.95;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.kz-partners-item:hover .kz-partners-logo {
    opacity: 1;
    transform: scale(1.04);
}
@keyframes kz-partners-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
    .kz-partners-track {
        animation: none;
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
        gap: 1rem;
    }
    .kz-partners-strip[aria-hidden="true"] {
        display: none;
    }
    .kz-partners-marquee {
        -webkit-mask-image: none;
        mask-image: none;
    }
}

/* Prix catalogue : Sur devis + équivalent euro */
.kz-price-quote {
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.kz-price-eur {
    opacity: 0.85;
}

.kz-footer-logo {
    height: clamp(88px, 18vw, 160px);
    max-width: min(280px, 72vw);
}

/* Bandeau succès / erreur — bien visible (inscription formation, etc.) */
.kz-global-flash-wrap {
    margin-top: 12px;
    margin-bottom: 0;
    position: relative;
    z-index: 100;
}
.kz-flash-banner {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px 20px;
    margin-bottom: 22px;
    border-radius: 14px;
    font-size: clamp(0.92rem, 2.2vw, 1.05rem);
    line-height: 1.55;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
    scroll-margin-top: 64px;
    animation: kz-flash-in 0.45s ease-out;
}
.kz-flash-banner__body strong {
    color: inherit;
    font-weight: 700;
}
.kz-flash-banner--success {
    background: linear-gradient(135deg, rgba(25, 135, 84, 0.28), rgba(25, 135, 84, 0.1));
    border: 2px solid rgba(117, 183, 152, 0.65);
    color: #d4f5e4;
}
.kz-flash-banner--success > i {
    font-size: 1.6rem;
    color: #75b798;
    flex-shrink: 0;
    margin-top: 2px;
}
.kz-flash-banner--error {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.22), rgba(220, 53, 69, 0.08));
    border: 2px solid rgba(234, 134, 143, 0.55);
    color: #ffd4d9;
}
.kz-flash-banner--error > i {
    font-size: 1.5rem;
    color: #ea868f;
    flex-shrink: 0;
}
body.light-theme .kz-flash-banner--success {
    color: #14532d;
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.14), rgba(22, 163, 74, 0.05));
    border-color: rgba(22, 163, 74, 0.45);
}
body.light-theme .kz-flash-banner--success > i {
    color: #15803d;
}
body.light-theme .kz-flash-banner--error {
    color: #7f1d1d;
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1), rgba(220, 53, 69, 0.04));
    border-color: rgba(220, 53, 69, 0.35);
}
@keyframes kz-flash-in {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Case à cocher CGU — liens intégrés dans la phrase */
.kz-cgu-accept {
    display: flex;
    align-items: flex-start;
    gap: clamp(8px, 2vw, 12px);
    margin: 14px 0 16px;
    padding: clamp(10px, 2.5vw, 14px) clamp(10px, 3vw, 16px);
    border-radius: 10px;
    border: 1px solid rgba(201, 168, 76, 0.35);
    background: rgba(201, 168, 76, 0.06);
    line-height: 1.45;
    font-size: clamp(0.72rem, 2.5vw, 0.84rem);
    color: #ccc;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.kz-cgu-accept__input {
    width: clamp(18px, 4.5vw, 22px);
    height: clamp(18px, 4.5vw, 22px);
    min-width: clamp(18px, 4.5vw, 22px);
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: #C9A84C;
    cursor: pointer;
}
.kz-cgu-accept__text {
    flex: 1;
    min-width: 0;
}
.kz-cgu-accept__link {
    color: #C9A84C;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
.kz-cgu-accept__link:hover {
    color: #e0c878;
}
.kz-cgu-accept__req {
    color: #ea868f;
}
body.light-theme .kz-cgu-accept {
    color: #444;
    background: rgba(201, 168, 76, 0.08);
    border-color: rgba(138, 106, 34, 0.35);
}

/* Crédit développeur sous le copyright */
.kz-footer-credit {
    font-size: clamp(0.72rem, 1.8vw, 0.8rem);
    color: #777;
    letter-spacing: 0.02em;
}
.kz-footer-credit__name {
    color: #999;
}
.kz-footer-credit__link {
    color: #C9A84C;
    text-decoration: none;
    font-weight: 500;
}
.kz-footer-credit__link:hover {
    color: #e0c878;
    text-decoration: underline;
}
body.light-theme .kz-footer-credit {
    color: #666;
}
body.light-theme .kz-footer-credit__name {
    color: #555;
}

/* Footer & contenu public — texte fluide */
footer h6 {
    font-size: clamp(0.9rem, 2vw, 1rem);
}
footer p,
footer a,
footer li {
    font-size: clamp(0.82rem, 1.8vw, 0.95rem);
}
.card-dark p,
.card-dark .text-gray {
    font-size: clamp(0.88rem, 1.9vw, 1rem);
}
.display-5 {
    font-size: clamp(1.65rem, 4.5vw, 3rem) !important;
}

/* Cibles tactiles minimales (Apple HIG ~44px) — menu replié jusqu'à 1199px */
@media (max-width: 1199.98px) {
    .navbar .nav-link,
    .navbar-toggler,
    .navbar .dropdown-toggle {
        min-height: 44px;
    }
}
@media (max-width: 991px) {
    .nav-link,
    .btn-gold,
    .btn-outline-gold,
    .navbar-toggler,
    .dropdown-toggle,
    .theme-toggle,
    #themeToggle {
        min-height: 44px;
    }
    .navbar-toggler {
        min-width: 44px;
    }
}

/* Menu replié sous 1200px — 9 liens ne tiennent pas dans un container Bootstrap lg */
@media (max-width: 1199.98px) {
    .navbar-toggler:not(.kz-nav-toggler) {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }
    .navbar-toggler.kz-nav-toggler {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }
    .navbar-brand {
        flex: 1 1 auto;
        min-width: 0;
    }
}

/* ── Site public ── */
@media (max-width: 991px) {
    .page-hero {
        height: 220px;
    }
    .page-hero-home {
        height: 380px;
    }
    .page-hero-home .page-hero-title {
        font-size: 2.2rem;
    }
    .page-hero-title {
        font-size: 1.75rem;
    }
    .page-hero-desc {
        font-size: 1rem;
    }
    .section {
        padding: 3.5rem 0;
    }
    .home-hero-section {
        min-height: clamp(420px, 78vh, 680px) !important;
        padding-bottom: 2.5rem !important;
    }
    .home-hero-container {
        padding-top: clamp(1.25rem, 4vh, 2rem) !important;
    }
    .btn-gold,
    .btn-outline-gold {
        padding: 0.65rem 1.35rem;
        font-size: 0.92rem;
    }
    .kz-fab-group {
        bottom: 20px;
        right: 16px;
        gap: 10px;
    }
    .kz-fab-group #themeToggle {
        width: 46px;
        height: 46px;
    }
    .kz-fab-group .whatsapp-btn {
        width: 52px;
        height: 52px;
        font-size: 24px;
    }
}

@media (max-width: 576px) {
    .page-hero {
        height: 180px;
    }
    .page-hero-home {
        height: 300px;
    }
    .page-hero-home .page-hero-title {
        font-size: 1.65rem;
    }
    .page-hero-title {
        font-size: 1.4rem;
    }
    .page-hero-desc {
        font-size: 0.92rem;
        padding: 0 8px;
    }
    .section {
        padding: 2.5rem 0;
    }
    .container,
    .container-fluid {
        padding-left: 14px;
        padding-right: 14px;
    }
    .card-dark:hover {
        transform: none;
    }
    .ticker-wrap {
        font-size: 0.85rem;
    }
    .dropdown-menu {
        max-width: calc(100vw - 24px);
    }
    h1 { font-size: clamp(1.5rem, 5vw, 2.2rem); }
    h2 { font-size: clamp(1.35rem, 4.5vw, 1.9rem); }
}

@media (max-width: 380px) {
    .stats-grid,
    .stats-row,
    .ord-stats {
        grid-template-columns: 1fr !important;
    }
}

/* ── Admin : tables en cartes sur mobile ── */
@media (max-width: 768px) {
    .tbl-wrap table:not(.cfg-log-table) thead {
        display: none;
    }
    .tbl-wrap table:not(.cfg-log-table) tbody tr {
        display: block;
        margin-bottom: 12px;
        border: 1px solid rgba(201, 168, 76, 0.15);
        border-radius: 10px;
        padding: 10px 12px;
        background: rgba(26, 26, 26, 0.5);
    }
    .tbl-wrap table:not(.cfg-log-table) tbody td {
        display: block;
        border: none;
        padding: 5px 0;
        text-align: left !important;
    }
    .tbl-wrap table:not(.cfg-log-table) tbody td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.65rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: #666;
        margin-bottom: 2px;
    }
    .tbl-wrap table:not(.cfg-log-table) tbody td[data-label=""]::before,
    .tbl-wrap table:not(.cfg-log-table) tbody td:not([data-label])::before {
        display: none;
    }
    body.light-theme .tbl-wrap table:not(.cfg-log-table) tbody tr {
        background: #fff;
        border-color: #e5e7eb;
    }
}

/* Stats admin / tableaux larges */
@media (max-width: 768px) {
    .kz-main .d-flex.gap-2,
    .kz-main .d-flex.gap-3,
    .admin-header,
    .toolbar {
        flex-wrap: wrap;
    }
    .fr-students-scroll,
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }
    .kz-map-section .kz-contact-map-iframe {
        min-height: 280px;
        height: 280px;
    }
}

@media (max-width: 480px) {
    .kz-main {
        padding: 72px 10px 16px !important;
    }
    .admin-title,
    .page-title {
        font-size: 1.25rem !important;
    }
    .admin-header {
        flex-direction: column;
        align-items: flex-start !important;
    }
    .btn-gold,
    .btn-action,
    .btn-back {
        width: 100%;
        justify-content: center;
    }
    .fr-modal-panel,
    .modal-box {
        width: 96% !important;
        max-width: none !important;
        margin: 12px auto !important;
    }
}

/* Mobile — texte un peu plus lisible (sans changer la mise en page) */
@media (max-width: 991.98px) {
    html {
        font-size: clamp(14px, 0.35vw + 14px, 17px);
    }
    body {
        font-size: 1.0625rem;
    }
    footer h6 {
        font-size: clamp(0.95rem, 2vw, 1.12rem);
    }
    footer p,
    footer a,
    footer li {
        font-size: clamp(0.88rem, 1.8vw, 1.05rem);
    }
    .kz-footer-credit {
        font-size: clamp(0.78rem, 1.8vw, 0.92rem);
    }
    .card-dark p,
    .card-dark .text-gray,
    .section .text-gray,
    .section p.text-gray,
    .section li.text-gray {
        font-size: clamp(0.92rem, 1.9vw, 1.0625rem);
    }
    .lead {
        font-size: clamp(1.05rem, 2.2vw, 1.25rem);
    }
    .home-hero-section .home-hero-lead {
        font-size: clamp(14px, 1.2vw + 12px, 16px) !important;
    }
    .home-hero-section .home-hero-title {
        font-size: clamp(24px, 4vw, 34px) !important;
    }
    small,
    .small {
        font-size: clamp(0.82rem, 1.8vw, 0.9375rem);
    }
    #newsletter p,
    #newsletter input[type="email"],
    #newsletter button[type="submit"] {
        font-size: 1rem !important;
    }
    footer p[style*="font-size:.85rem"],
    footer p[style*="font-size: .85rem"] {
        font-size: 0.95rem !important;
    }
    .btn-gold,
    .btn-outline-gold {
        font-size: 1rem;
    }
    .navbar-nav .nav-link {
        font-size: 1rem;
    }
}
