/* ==========================================================================
   SITE UI — boutons flottants (langue + thème), thème sombre, RTL
   Boutons AMOVIBLES (drag) et visibles sur tout l'écran (mobile + desktop)
   ========================================================================== */

/* L'ancien petit bouton globe est remplacé par le nouveau conteneur */
.site-lang { display: none !important; }

/* ---- Conteneur flottant (déplaçable) ----------------------------------- */
.ui-fab {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9999;
    font-family: Inter, Cairo, Tahoma, sans-serif;
    touch-action: none; /* permet le drag tactile sans scroller la page */
    user-select: none;
    -webkit-user-select: none;
}
.ui-fab.has-sidebar { left: calc(var(--sidebar-w, 260px) + 16px); }
html[dir=rtl] .ui-fab { left: auto; right: 20px; }
html[dir=rtl] .ui-fab.has-sidebar { left: auto; right: calc(var(--sidebar-w, 260px) + 16px); }

/* Quand l'utilisateur a déplacé les boutons, on retire le centrage vertical */
.ui-fab.ui-fab-dragged { transform: none; }

.ui-fab-wrap {
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: uiFloat 4s ease-in-out infinite;
}
.ui-fab.ui-fab-dragged .ui-fab-wrap { animation: none; }
.ui-fab-item { position: relative; }

.ui-fab-btn {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    color: #1a237e;
    font-size: 1.6rem;
    line-height: 1;
    background: rgba(255,255,255,.55);
    border: 1px solid rgba(255,255,255,.7);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    box-shadow: 0 8px 24px rgba(26,35,126,.22);
    animation: uiPulse 2.6s ease-in-out infinite;
    transition: transform .25s ease, filter .25s ease;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.ui-fab-btn:active { cursor: grabbing; }
.ui-fab-item + .ui-fab-item .ui-fab-btn { animation-delay: 1.3s; }
.ui-fab-btn:hover { transform: scale(1.08); filter: drop-shadow(0 12px 18px rgba(230,57,70,.35)); }
.ui-fab-btn:active { transform: scale(.96); }
.ui-fab-btn:focus-visible { outline: 3px solid rgba(230,57,70,.5); outline-offset: 2px; }

.ui-fab-btn svg { width: 26px; height: 26px; }
.ui-ico-moon { display: none; }
html[data-theme=dark] .ui-ico-sun { display: none; }
html[data-theme=dark] .ui-ico-moon { display: block; }
.ui-ico-sun { color: #f59e0b; }
.ui-ico-moon { color: #c5cae9; }

/* ---- Drapeaux SVG (vraies icônes) ------------------------------------- */
.ui-flag-svg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 20px;
    border-radius: 3px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.15);
}
.ui-flag-svg svg { width: 100%; height: 100%; display: block; }

.ui-lang-menu .ui-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 16px;
    border-radius: 2px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(0,0,0,.12);
    flex-shrink: 0;
}
.ui-lang-menu .ui-flag svg { width: 100%; height: 100%; display: block; }

@keyframes uiFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}
@keyframes uiPulse {
    0%, 100% { box-shadow: 0 8px 24px rgba(26,35,126,.22), 0 0 0 0 rgba(230,57,70,.38); }
    50%      { box-shadow: 0 12px 30px rgba(26,35,126,.32), 0 0 0 12px rgba(230,57,70,0); }
}

/* ---- Menu de langue ---------------------------------------------------- */
.ui-lang-menu {
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    min-width: 150px;
    padding: 6px;
    border-radius: 16px;
    background: rgba(255,255,255,.92);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(0,0,0,.08);
    box-shadow: 0 16px 40px rgba(0,0,0,.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-50%) scale(.94);
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
}
html[dir=rtl] .ui-lang-menu { left: auto; right: calc(100% + 12px); }
.ui-fab-item.open .ui-lang-menu { opacity: 1; visibility: visible; transform: translateY(-50%) scale(1); }
.ui-lang-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 11px;
    font-size: .88rem;
    font-weight: 600;
    color: #1a1a2e;
    background: transparent;
    cursor: pointer;
    text-align: start;
    white-space: nowrap;
}
.ui-lang-menu button:hover { background: rgba(26,35,126,.08); }
.ui-lang-menu button.active { background: rgba(230,57,70,.1); color: #e63946; }

/* ---- Sélecteur de langue DANS L'EN-TÊTE (vrais drapeaux SVG) ---------- */
.ui-lang-picker {
    position: relative;
    margin-inline-start: 12px;
    flex-shrink: 0;
}
.ui-lang-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 50px;
    font-size: .82rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    color: rgba(255,255,255,.9);
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.3);
    transition: background .25s ease, color .25s ease, border-color .25s ease;
}
.ui-lang-trigger:hover { background: rgba(255,255,255,.22); }
.ui-lang-trigger .ui-flag-svg {
    width: 26px;
    height: 17px;
    border-radius: 3px;
    flex-shrink: 0;
}
.ui-lang-caret { font-size: .6rem; opacity: .75; transition: transform .25s ease; }
.ui-lang-picker.open .ui-lang-caret { transform: rotate(180deg); }

.navbar.scrolled .ui-lang-trigger,
.content-navbar .ui-lang-trigger {
    color: #1a1a2e;
    background: rgba(0,0,0,.05);
    border-color: rgba(0,0,0,.14);
}
.navbar.scrolled .ui-lang-trigger:hover,
.content-navbar .ui-lang-trigger:hover { background: rgba(0,0,0,.09); }
.navbar.scrolled .ui-lang-dropdown,
.content-navbar .ui-lang-dropdown { color: #1a1a2e; }

.ui-lang-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    inset-inline-end: 0;
    min-width: 172px;
    padding: 6px;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid rgba(0,0,0,.1);
    box-shadow: 0 16px 40px rgba(5,8,35,.22);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
    z-index: 2200;
}
.ui-lang-picker.open .ui-lang-dropdown { opacity: 1; visibility: visible; transform: none; }
.ui-lang-dropdown button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border-radius: 10px;
    font-size: .85rem;
    font-weight: 600;
    color: #1a1a2e;
    background: transparent;
    cursor: pointer;
    text-align: start;
    white-space: nowrap;
}
.ui-lang-dropdown button:hover { background: rgba(26,35,126,.08); }
.ui-lang-dropdown button.active { background: rgba(230,57,70,.1); color: #e63946; }
.ui-lang-dropdown button .ui-flag-svg {
    width: 24px;
    height: 16px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* Ancien <select> (conservé au cas où, plus utilisé) */
.ui-lang-select {
    margin-inline-start: 12px;
    padding: 8px 12px;
    border-radius: 50px;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    color: #fff;
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.3);
}
.ui-lang-select option { color: #111; background: #fff; }
.navbar .navbar-nav { margin-inline-start: auto; }
.navbar.scrolled .ui-lang-select,
.content-navbar .ui-lang-select {
    color: #1a1a2e;
    background: rgba(0,0,0,.05);
    border-color: rgba(0,0,0,.14);
}

/* ---- Mobile : boutons toujours visibles et déplaçables ---------------- */
@media (max-width: 768px) {
    .ui-fab, .ui-fab.has-sidebar { left: 10px; }
    html[dir=rtl] .ui-fab, html[dir=rtl] .ui-fab.has-sidebar { left: auto; right: 10px; }
    .ui-fab-btn { width: 50px; height: 50px; border-radius: 16px; font-size: 1.4rem; }
    .ui-fab-btn svg { width: 24px; height: 24px; }
    .ui-fab-wrap { gap: 10px; }
    .ui-lang-select { margin-inline-start: auto; margin-inline-end: 10px; }
    .ui-lang-picker { margin-inline-start: auto; margin-inline-end: 10px; }
    .ui-lang-trigger { padding: 6px 10px; gap: 6px; }
    .ui-lang-trigger-name { display: none; }
    .ui-lang-trigger .ui-flag-svg { width: 24px; height: 16px; }
}
@media (prefers-reduced-motion: reduce) {
    .ui-fab-wrap, .ui-fab-btn { animation: none !important; }
}

/* ---- RTL : alignement du texte ---------------------------------------- */
html[dir=rtl] body { text-align: right; }
html[dir=rtl] .text-center, html[dir=rtl] .hero-content, html[dir=rtl] .auth-title,
html[dir=rtl] .auth-subtitle, html[dir=rtl] .auth-link { text-align: center; }
html[dir=rtl] .data-table th, html[dir=rtl] .data-table td,
html[dir=rtl] .table-wrapper th, html[dir=rtl] .table-wrapper td { text-align: right; }
html[dir=rtl] .page-title, html[dir=rtl] .page-subtitle, html[dir=rtl] .card-header,
html[dir=rtl] .form-group label, html[dir=rtl] .sidebar-nav a { text-align: right; }
html[dir=rtl] .ui-lang-dropdown button { text-align: right; }

/* ---- Transition de thème (0.4s) --------------------------------------- */
html.ui-theme-anim, html.ui-theme-anim *, html.ui-theme-anim *::before, html.ui-theme-anim *::after {
    transition: background-color .4s ease, color .4s ease, border-color .4s ease, box-shadow .4s ease !important;
}

/* ==========================================================================
   THÈME SOMBRE
   ========================================================================== */
html[data-theme=dark] {
    color-scheme: dark;
    --bg-primary: #0a0a0f;
    --bg-secondary: #11111a;
    --bg-card: #14141f;
    --text-primary: #f1f1f6;
    --text-secondary: #b4b4c6;
    --text-muted: #8a8aa0;
    --border-glass: rgba(255,255,255,.1);
}
html[data-theme=dark] body { background: #0a0a0f; color: #f1f1f6; }

html[data-theme=dark] .card,
html[data-theme=dark] .stat-card,
html[data-theme=dark] .dash-stat-card,
html[data-theme=dark] .profile-card,
html[data-theme=dark] .table-wrapper,
html[data-theme=dark] .testimonial-card,
html[data-theme=dark] .faq-item,
html[data-theme=dark] .step-card,
html[data-theme=dark] .content-card,
html[data-theme=dark] .payment-card,
html[data-theme=dark] .panel-svc-card,
html[data-theme=dark] .auth-card,
html[data-theme=dark] .auth-shell,
html[data-theme=dark] .auth-shell .auth-card,
html[data-theme=dark] .brand-marquee {
    background: #14141f;
    border-color: rgba(255,255,255,.1);
}
html[data-theme=dark] .modal,
html[data-theme=dark] .glass { background: rgba(20,20,31,.96); border-color: rgba(255,255,255,.12); }

html[data-theme=dark] .card-header,
html[data-theme=dark] .data-table thead th,
html[data-theme=dark] .table-wrapper th { background: #1a1a28; color: #b4b4c6; border-color: rgba(255,255,255,.08); }

html[data-theme=dark] .page-title,
html[data-theme=dark] .dash-stat-value,
html[data-theme=dark] .stat-value,
html[data-theme=dark] .section-title,
html[data-theme=dark] .step-card h3,
html[data-theme=dark] .faq-question,
html[data-theme=dark] .auth-title,
html[data-theme=dark] .content-card h2,
html[data-theme=dark] .testimonial-name,
html[data-theme=dark] .range-value,
html[data-theme=dark] .payment-card h4,
html[data-theme=dark] .modal-header h2,
html[data-theme=dark] .card-header,
html[data-theme=dark] .auth-brand-link,
html[data-theme=dark] .marquee-item,
html[data-theme=dark] .data-table tbody td { color: #f1f1f6; }
html[data-theme=dark] .table-wrapper td,
html[data-theme=dark] .step-card p,
html[data-theme=dark] .testimonial-text,
html[data-theme=dark] .faq-answer { color: #c4c4d4; }
html[data-theme=dark] .data-table tbody td,
html[data-theme=dark] .table-wrapper td { border-color: rgba(255,255,255,.07); }
html[data-theme=dark] .data-table tbody tr:hover td { background: #1a1a28; }

html[data-theme=dark] .form-control,
html[data-theme=dark] select,
html[data-theme=dark] textarea,
html[data-theme=dark] input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]) {
    background: rgba(255,255,255,.06);
    border-color: rgba(255,255,255,.16);
    color: #f1f1f6;
}
html[data-theme=dark] .auth-shell .form-control,
html[data-theme=dark] .auth-shell .verify-digit,
html[data-theme=dark] .verify-digit { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.16); color: #f1f1f6; }
html[data-theme=dark] .auth-shell .form-control:focus { background: rgba(255,255,255,.1); }
html[data-theme=dark] .auth-shell .auth-tabs,
html[data-theme=dark] .auth-tabs,
html[data-theme=dark] .lang-switch button,
html[data-theme=dark] .auth-mode-btn { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.12); color: #c4c4d4; }

html[data-theme=dark] .btn-outline,
html[data-theme=dark] .subcategory-pill { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.16); color: #f1f1f6; }
html[data-theme=dark] .modal-close { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.12); }

html[data-theme=dark] .navbar.scrolled,
html[data-theme=dark] .content-navbar { background: rgba(10,10,15,.92); border-color: rgba(255,255,255,.08); }
html[data-theme=dark] .navbar.scrolled .navbar-brand,
html[data-theme=dark] .content-navbar .navbar-brand { color: #fff; }
html[data-theme=dark] .navbar.scrolled .ui-lang-select,
html[data-theme=dark] .content-navbar .ui-lang-select,
html[data-theme=dark] .navbar.scrolled .ui-lang-trigger,
html[data-theme=dark] .content-navbar .ui-lang-trigger { color: #f1f1f6; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.2); }
html[data-theme=dark] .ui-lang-trigger { color: #f1f1f6; background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.22); }
html[data-theme=dark] .ui-lang-trigger:hover { background: rgba(255,255,255,.18); }
html[data-theme=dark] .ui-lang-dropdown { background: #16161f; border-color: rgba(255,255,255,.14); }
html[data-theme=dark] .ui-lang-dropdown button { color: #f1f1f6; }
html[data-theme=dark] .ui-lang-dropdown button:hover { background: rgba(255,255,255,.08); }
html[data-theme=dark] .ui-lang-dropdown button.active { background: rgba(230,57,70,.18); color: #ff8b93; }
html[data-theme=dark] .navbar-nav.open { background: rgba(10,10,15,.97); }
html[data-theme=dark] .navbar-nav.open a { color: #f1f1f6 !important; }
html[data-theme=dark] .content-page { background: linear-gradient(180deg, #0d0d14 0%, #0a0a0f 42%); }

/* Blocs admin avec couleurs écrites directement dans la page */
html[data-theme=dark] [style*="background:#fff"],
html[data-theme=dark] [style*="background:#f8f9fb"],
html[data-theme=dark] [style*="background:#f5f7fa"],
html[data-theme=dark] [style*="background:#fafbfc"] { background: #1a1a28 !important; color: #e6e6f0; }
html[data-theme=dark] [style*="color:#333"],
html[data-theme=dark] [style*="color:#444"],
html[data-theme=dark] [style*="color:#222"],
html[data-theme=dark] [style*="color:#666"] { color: #d4d4e2 !important; }

/* Boutons flottants en thème sombre */
html[data-theme=dark] .ui-fab-btn { background: rgba(22,22,34,.6); border-color: rgba(255,255,255,.18); color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
html[data-theme=dark] .ui-lang-menu { background: rgba(22,22,34,.94); border-color: rgba(255,255,255,.14); }
html[data-theme=dark] .ui-lang-menu button { color: #f1f1f6; }
html[data-theme=dark] .ui-lang-menu button:hover { background: rgba(255,255,255,.08); }

/* ==========================================================================
   CARTES DE SERVICE — icônes bien visibles (contraste renforcé)
   Charge après style.css : cercle blanc plein + icône à la couleur de marque.
   ========================================================================== */
.service-card .icon {
    background: #ffffff;
    color: var(--card-bg, #4f8cff);
    box-shadow: 0 8px 20px rgba(5,8,35,.22);
}
.service-card .icon i { color: inherit; }

/* Snapchat : carte jaune → cercle sombre translucide, icône noire */
.service-card[data-service="snapchat"] .icon {
    background: rgba(0,0,0,.12);
    color: #000000;
    box-shadow: none;
}

/* ==========================================================================
   OPTIMISATION TABLETTE (769px → 1100px)
   iPad portrait/landscape, Galaxy Tab, iPad Air… : évite les grilles trop
   serrées, la sidebar trop large et les tableaux compressés.
   N'affecte NI le mobile (≤768px) NI le bureau (≥1101px).
   ========================================================================== */
@media (min-width: 769px) and (max-width: 1100px) {

    /* ---- Conteneurs ---- */
    .container { padding: 0 20px; }

    /* ---- Navigation publique ---- */
    .navbar { padding: 12px 0; }
    .navbar-nav { gap: 2px; }
    .navbar-nav a { padding: 8px 12px; font-size: .85rem; }
    .navbar-brand { font-size: 1.3rem; }
    .navbar .site-logo { height: 32px; max-width: 150px; }

    /* ---- Hero ---- */
    .hero { padding: 110px 0 72px; }
    .hero h1 { font-size: 2.9rem; }
    .hero p { font-size: 1.05rem; }
    .hero-content { max-width: 780px; }
    .hero-buttons { gap: 10px; }
    .floating-icon { width: 56px; height: 56px; border-radius: 15px; font-size: 1.6rem; }
    .hero-chip { font-size: .76rem; padding: 8px 13px; }
    .hero-chip-a { left: 4%; top: 22%; }
    .hero-chip-b { right: 4%; bottom: 14%; }

    /* ---- Sections de la landing ---- */
    .services-section { padding: 72px 0; }
    .services-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
    .service-card { padding: 28px 16px; }
    .service-card .icon { width: 68px; height: 68px; font-size: 1.9rem; }
    .service-card h3 { font-size: 1rem; }
    .section-title { font-size: 1.9rem; }
    .section-subtitle { font-size: 1rem; margin-bottom: 36px; }
    .how-section, .stats-section, .testimonials-section, .faq-section { padding: 64px 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 18px; }
    .content-feature-grid, .contact-grid { gap: 16px; }
    .content-hero { padding: 62px 0 50px; }
    .content-hero h1 { font-size: 2.6rem; }
    .content-hero p { font-size: 1rem; }
    .content-section { padding: 56px 0 72px; }
    .content-card { padding: 26px; }
    .content-legal { padding: 34px 32px; }
    .cta-band { padding: 46px 28px; }

    /* ---- Tableau de bord : sidebar plus étroite ---- */
    .sidebar { width: 220px; }
    .main-content { margin-left: 220px; padding: 26px 22px; }
    .sidebar-brand { font-size: 1.15rem; padding: 0 18px 20px; }
    .sidebar-brand .site-logo { height: 28px; max-width: 140px; }
    .sidebar-nav { padding: 0 10px; }
    .sidebar-nav a { padding: 11px 14px; font-size: .85rem; gap: 10px; }
    .sidebar-user { padding: 14px 18px; }
    .page-header { flex-wrap: wrap; gap: 12px; }
    .page-title { font-size: 1.4rem; }
    .page-subtitle { font-size: .85rem; }

    /* ---- Cartes de statistiques ---- */
    .stats-cards { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
    .stat-card { padding: 16px 18px; gap: 12px; }
    .stat-value { font-size: 1.15rem; }
    .dash-stats { grid-template-columns: repeat(2, 1fr); gap: 16px; }
    .dash-stat-card { padding: 20px; }
    .dash-stat-value { font-size: 1.5rem; }

    /* ---- Tableaux : défilement horizontal plutôt que colonnes écrasées ---- */
    .table-wrapper { overflow-x: auto; }
    .table-wrapper table { min-width: 640px; }
    .data-table thead th { padding: 11px 12px; font-size: .68rem; }
    .data-table tbody td { padding: 11px 12px; font-size: .82rem; }
    .card-header { padding: 14px 18px; font-size: .9rem; }
    .card-body { padding: 18px; }

    /* ---- Formulaires admin en 2 colonnes → une seule colonne ---- */
    [style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }

    /* ---- Profil / paiement ---- */
    .profile-grid { gap: 18px; }
    .profile-card { padding: 22px; }
    .payment-methods-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .payment-card { padding: 18px 14px; }

    /* ---- Modale de commande ---- */
    .modal { width: 420px; }
    .modal-overlay { padding: 84px 16px 20px; }
    .modal { max-height: calc(100vh - 116px); }
}