/* ═══════════════════════════════════════════════════════════════
   [Chat-Responsive] STYLES RESPONSIVE POUR CHAT-INTERFACE
   NautiSphere Pro - Interface Chat Skipper AI
   Mobile first approach
   ═══════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────
   [Chat-Responsive] VARIABLES CSS
   ───────────────────────────────────────────────────────────────── */

:root {
    /* Dimensions Chat */
    --chat-sidebar-width: 320px;
    --chat-sidebar-collapsed: 0px;
    --chat-header-height: 60px;
    --chat-input-height: 80px;
    --chat-navbar-height: 80px;

    /* Transitions */
    --chat-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Couleurs (cohérentes avec le thème NautiSphere) */
    --chat-overlay-bg: rgba(0, 0, 0, 0.5);
    --chat-primary: #00b9d1;
    --chat-primary-dark: #001e57;
    --chat-sidebar-bg: #0f172a;
    --chat-bg: #f8fafc;
}

/* ─────────────────────────────────────────────────────────────────
   [Chat-Responsive] LAYOUT PRINCIPAL
   ───────────────────────────────────────────────────────────────── */

.chat-interface-wrapper {
    display: flex;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height pour mobile */
    overflow: hidden;
    position: relative;
    padding-top: var(--chat-navbar-height);
}

/* ─────────────────────────────────────────────────────────────────
   [Chat-Responsive] HEADER MOBILE POUR LE CHAT
   ───────────────────────────────────────────────────────────────── */

.chat-mobile-header {
    display: none; /* Masqué par défaut (desktop) */
    position: fixed;
    top: var(--chat-navbar-height);
    left: 0;
    right: 0;
    height: var(--chat-header-height);
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 16px;
    align-items: center;
    justify-content: space-between;
    z-index: 35;
}

.chat-hamburger-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #374151;
    transition: background 0.2s;
}

.chat-hamburger-btn:hover {
    background: #f3f4f6;
}

.chat-hamburger-btn:focus-visible {
    outline: 2px solid var(--chat-primary);
    outline-offset: 2px;
}

.chat-mobile-header .chat-logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-mobile-header .chat-logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--chat-primary-dark), var(--chat-primary));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.chat-mobile-header .chat-logo-text {
    font-weight: 700;
    font-size: 16px;
    color: #1e293b;
}

.chat-mobile-header .chat-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-action-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #64748b;
    transition: background 0.2s, color 0.2s;
}

.chat-action-btn:hover {
    background: #f1f5f9;
    color: #334155;
}

/* ─────────────────────────────────────────────────────────────────
   [Chat-Responsive] OVERLAY SIDEBAR
   ───────────────────────────────────────────────────────────────── */

.chat-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--chat-navbar-height);
    background: var(--chat-overlay-bg);
    backdrop-filter: blur(2px);
    z-index: 38;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--chat-transition), visibility var(--chat-transition);
}

.chat-sidebar-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* ─────────────────────────────────────────────────────────────────
   [Chat-Responsive] SIDEBAR HISTORIQUE
   ───────────────────────────────────────────────────────────────── */

/* Les styles de base pour la sidebar sont dans le HTML inline.
   Ces styles gèrent uniquement le comportement responsive */

#sidebar.chat-sidebar-responsive {
    transition: transform var(--chat-transition), width var(--chat-transition);
}

.chat-sidebar-close-btn {
    display: none; /* Visible uniquement sur mobile/tablette */
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #64748b;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.chat-sidebar-close-btn:hover {
    background: #e2e8f0;
    color: #334155;
    border-color: #cbd5e1;
}

.chat-sidebar-close-btn:focus-visible {
    outline: 2px solid var(--chat-primary);
    outline-offset: 2px;
}

/* ─────────────────────────────────────────────────────────────────
   [Chat-Responsive] ZONE PRINCIPALE DU CHAT
   ───────────────────────────────────────────────────────────────── */

.chat-main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--chat-bg);
    position: relative;
}

#messagesContainer.chat-messages-responsive {
    flex: 1;
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* ─────────────────────────────────────────────────────────────────
   [Chat-Responsive] ÉCRAN DE BIENVENUE
   ───────────────────────────────────────────────────────────────── */

#welcomeSection.chat-welcome-responsive {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100%;
    padding: 20px;
}

#welcomeSection.chat-welcome-responsive .text-center {
    max-width: 600px;
    width: 100%;
}

#welcomeSection.chat-welcome-responsive h3 {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ─────────────────────────────────────────────────────────────────
   [Chat-Responsive] ZONE DE SAISIE
   ───────────────────────────────────────────────────────────────── */

#fixedInputArea.chat-input-responsive {
    background: white;
    border-top: 1px solid #e5e7eb;
}

.chat-disclaimer {
    text-align: center;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 8px;
}

/* ═══════════════════════════════════════════════════════════════
   [Chat-Responsive] RESPONSIVE : MOBILE (< 768px)
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {

    /* Header mobile visible */
    .chat-mobile-header {
        display: flex;
    }

    /* Overlay disponible */
    .chat-sidebar-overlay {
        display: block;
    }

    /* Sidebar en overlay (cachée par défaut) */
    #sidebar.chat-sidebar-responsive {
        position: fixed !important;
        top: var(--chat-navbar-height) !important;
        left: 0;
        bottom: 0;
        width: var(--chat-sidebar-width) !important;
        transform: translateX(-100%);
        box-shadow: none;
        z-index: 39;
        margin-left: 0 !important;
    }

    #sidebar.chat-sidebar-responsive.is-open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    }

    /* Bouton fermer visible */
    .chat-sidebar-close-btn {
        display: flex;
    }

    /* Zone principale avec padding top pour le header mobile */
    .chat-main-area {
        padding-top: var(--chat-header-height);
    }

    /* Masquer le toggle sidebar existant */
    #toggleSidebarBtn {
        display: none !important;
    }

    /* Ajustements du welcome */
    #welcomeSection.chat-welcome-responsive {
        padding: 16px;
    }

    #welcomeSection.chat-welcome-responsive h3 {
        font-size: 1.25rem !important;
        padding: 0 10px;
    }

    #welcomeSection.chat-welcome-responsive p {
        font-size: 0.875rem;
        padding: 0 10px;
    }

    /* Bouton catégories pleine largeur */
    #welcomeSection.chat-welcome-responsive button[onclick="openCategoriesModal()"] {
        width: 100%;
        max-width: 100%;
        justify-content: center;
        padding: 14px 16px !important;
    }

    /* Zone input welcome adaptée */
    .welcome-input-area {
        padding: 0 8px !important;
    }

    .welcome-input-area .input-wrapper {
        padding: 4px !important;
    }

    /* Zone de saisie fixée en bas */
    #fixedInputArea.chat-input-responsive {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 30;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    /* Ajuster la zone de messages pour ne pas être cachée par l'input */
    #messagesContainer.chat-messages-responsive {
        padding-bottom: calc(var(--chat-input-height) + 20px);
    }

    /* Masquer les bannières publicitaires */
    .skipper-ad-sidebar,
    #skipper-ad-left,
    #skipper-ad-right,
    [id*="skipper-ad"] {
        display: none !important;
    }

    /* Body scroll lock quand sidebar ouverte */
    body.chat-sidebar-open {
        overflow: hidden;
    }

    /* [Chat-Nav] Masquer Exporter et Partager sur mobile */
    .navbar-btn:has(.fa-download),
    .navbar-btn:has(.fa-share-alt),
    button.navbar-btn:nth-of-type(1),
    button.navbar-btn:nth-of-type(2) {
        display: none !important;
    }

    /* Fallback: masquer les boutons Exporter/Partager dans la navbar */
    #mainNavbar .flex.items-center.gap-3 > button.navbar-btn {
        display: none !important;
    }

    /* Réduire les boutons d'action dans l'input */
    #fixedInputArea .flex.items-end.gap-3 {
        gap: 8px !important;
    }

    #fixedInputArea button {
        flex-shrink: 0;
    }

    /* Bouton envoyer plus compact */
    #fixedInputArea button[onclick="sendMessage()"] {
        padding: 12px 16px !important;
    }

    #fixedInputArea button[onclick="sendMessage()"] span {
        display: none;
    }

    /* Masquer la navbar principale sur mobile pour le chat */
    #mainNavbar {
        display: flex !important;
    }

    /* Ajuster le container principal */
    #mainContainer {
        padding-top: var(--chat-navbar-height) !important;
    }

    #mainContainer.chat-sidebar-open {
        overflow: hidden;
    }
}

/* ═══════════════════════════════════════════════════════════════
   [Chat-Responsive] RESPONSIVE : TABLETTE (768px - 1023px)
   ═══════════════════════════════════════════════════════════════ */

@media (min-width: 768px) and (max-width: 1023px) {

    /* Header mobile visible sur tablette aussi */
    .chat-mobile-header {
        display: flex;
    }

    /* Overlay disponible */
    .chat-sidebar-overlay {
        display: block;
    }

    /* Sidebar rétractable */
    #sidebar.chat-sidebar-responsive {
        position: fixed !important;
        top: var(--chat-navbar-height) !important;
        left: 0;
        bottom: 0;
        width: var(--chat-sidebar-width) !important;
        transform: translateX(-100%);
        z-index: 39;
        margin-left: 0 !important;
    }

    #sidebar.chat-sidebar-responsive.is-open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    }

    .chat-sidebar-close-btn {
        display: flex;
    }

    /* Zone principale avec padding top */
    .chat-main-area {
        padding-top: var(--chat-header-height);
    }

    /* Masquer le toggle sidebar existant */
    #toggleSidebarBtn {
        display: none !important;
    }

    /* Welcome plus large */
    #welcomeSection.chat-welcome-responsive .text-center {
        max-width: 500px;
    }

    /* Masquer les bannières latérales */
    .skipper-ad-sidebar,
    #skipper-ad-left,
    #skipper-ad-right,
    [id*="skipper-ad"] {
        display: none !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   [Chat-Responsive] RESPONSIVE : DESKTOP (>= 1024px)
   ═══════════════════════════════════════════════════════════════ */

@media (min-width: 1024px) {

    /* Header mobile masqué */
    .chat-mobile-header {
        display: none;
    }

    /* Sidebar toujours visible */
    #sidebar.chat-sidebar-responsive {
        position: relative;
        transform: none;
    }

    .chat-sidebar-close-btn {
        display: none;
    }

    /* Overlay jamais visible */
    .chat-sidebar-overlay {
        display: none !important;
    }

    /* Zone principale sans padding top */
    .chat-main-area {
        padding-top: 0;
    }

    /* Input non fixé */
    #fixedInputArea.chat-input-responsive {
        position: relative;
    }

    #messagesContainer.chat-messages-responsive {
        padding-bottom: 20px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   [Chat-Responsive] GRAND DESKTOP (>= 1280px) - Avec bannières
   ═══════════════════════════════════════════════════════════════ */

@media (min-width: 1280px) {
    .skipper-ad-sidebar {
        display: block;
    }
}

/* ═══════════════════════════════════════════════════════════════
   [Chat-Responsive] ANIMATIONS
   ═══════════════════════════════════════════════════════════════ */

@keyframes chatSlideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes chatFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ═══════════════════════════════════════════════════════════════
   [Chat-Responsive] SAFE AREAS (iPhone X+)
   ═══════════════════════════════════════════════════════════════ */

@supports (padding: env(safe-area-inset-bottom)) {
    @media (max-width: 767px) {
        #fixedInputArea.chat-input-responsive {
            padding-bottom: max(12px, env(safe-area-inset-bottom));
        }

        #sidebar.chat-sidebar-responsive {
            padding-bottom: env(safe-area-inset-bottom);
        }
    }
}

/* ═══════════════════════════════════════════════════════════════
   [Chat-Responsive] ACCESSIBILITÉ
   ═══════════════════════════════════════════════════════════════ */

/* Focus trap visual indicator */
.chat-focus-trap-active *:focus {
    outline: 2px solid var(--chat-primary);
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    #sidebar.chat-sidebar-responsive,
    .chat-sidebar-overlay {
        transition: none !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   [Chat-Responsive] FIXES SPÉCIFIQUES
   ═══════════════════════════════════════════════════════════════ */

/* Fix: Texte "Bienvenue" ne doit pas être coupé */
@media (max-width: 767px) {
    #welcomeSection h3,
    #welcomeSection .text-2xl {
        font-size: 1.125rem !important;
        line-height: 1.4 !important;
        word-break: break-word;
        hyphens: auto;
    }

    /* Fix: Logo et texte welcome */
    #welcomeSection #welcome-logo {
        width: 48px !important;
        height: 48px !important;
    }

    /* Fix: Contenu centré */
    #welcomeSection .max-w-2xl {
        max-width: 100%;
        padding: 0 16px;
    }
}

/* Fix: Promo banner responsive */
@media (max-width: 767px) {
    #promoBanner {
        padding: 8px 12px !important;
    }

    #promoBanner .max-w-6xl {
        flex-direction: column;
        text-align: center;
        gap: 12px !important;
    }

    #promoBanner p.font-bold {
        font-size: 0.875rem !important;
    }

    #promoBanner p.text-xs {
        font-size: 0.7rem !important;
    }
}

/* Fix: Container principal hauteur */
@media (max-width: 767px) {
    #mainContainer {
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
    }
}

/* Fix: Message counter sur mobile */
@media (max-width: 767px) {
    #messageCounter {
        bottom: auto !important;
        top: calc(var(--chat-navbar-height) + var(--chat-header-height) + 10px);
        right: 10px;
    }

    #messageCounter > div {
        padding: 8px 12px !important;
    }

    #messageCounter .text-3xl {
        font-size: 1.5rem !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   [Chat-Responsive] CORRECTIONS MODE NON-CONNECTÉ
   ═══════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────
   BANDEAU PROMO (Non-connecté) - Mobile
   ───────────────────────────────────────────────────────────────── */

@media (max-width: 767px) {
    #promoBanner.promo-banner {
        position: fixed;
        top: var(--chat-navbar-height, 80px);
        left: 0;
        right: 0;
        padding: 12px 16px;
        z-index: 40;
    }

    #promoBanner .max-w-6xl {
        flex-direction: column;
        text-align: center;
        gap: 10px !important;
    }

    #promoBanner .flex.items-center.gap-3:first-child {
        flex-direction: column;
        gap: 8px;
    }

    /* Icône cadeau plus petite */
    #promoBanner .w-10.h-10 {
        width: 32px !important;
        height: 32px !important;
    }

    /* Texte du bandeau promo */
    #promoBanner p.font-bold {
        font-size: 0.8125rem !important;
        line-height: 1.4;
    }

    #promoBanner p.text-xs {
        font-size: 0.6875rem !important;
        line-height: 1.3;
    }

    /* Boutons du bandeau */
    #promoBanner .flex.items-center.gap-2:last-child {
        width: 100%;
        justify-content: center;
    }

    #promoBanner .promo-banner-btn {
        padding: 8px 16px;
        font-size: 0.8125rem;
    }

    /* Bouton fermer plus petit */
    #promoBanner button.w-8.h-8 {
        width: 28px !important;
        height: 28px !important;
    }
}

/* ─────────────────────────────────────────────────────────────────
   BANDEAU MESSAGES RESTANTS - Mobile & Tablette
   Format bandeau horizontal sous le disclaimer
   ───────────────────────────────────────────────────────────────── */

/* Base : popup visible */
#messageCounter.message-counter {
    position: fixed;
    z-index: 45;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Desktop : position originale (bas droite) - popup classique */
@media (min-width: 1024px) {
    #messageCounter.message-counter {
        bottom: 30px;
        right: 20px;
        top: auto;
        left: auto;
    }
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE & TABLETTE : Format BANDEAU horizontal
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 1023px) {
    /* Conteneur bandeau - pleine largeur AU-DESSUS de l'input */
    #messageCounter.message-counter {
        position: fixed;
        bottom: var(--chat-input-height, 100px); /* Au-dessus de la zone de saisie */
        left: 0;
        right: 0;
        top: auto;
        transform: translateY(100%); /* Caché par défaut (hors écran vers le bas) */
        max-width: 100%;
        width: 100%;
        z-index: 50;
        opacity: 0;
        pointer-events: none;
    }

    /* Ajuster pour les safe areas iPhone */
    @supports (padding: env(safe-area-inset-bottom)) {
        #messageCounter.message-counter {
            bottom: calc(var(--chat-input-height, 100px) + env(safe-area-inset-bottom));
        }
    }

    /* Bandeau visible avec animation */
    #messageCounter.message-counter.banner-visible {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    /* Style du bandeau intérieur */
    #messageCounter.message-counter > div {
        padding: 10px 16px !important;
        border-radius: 0 !important;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
        background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0891b2 100%) !important;
        border: none !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 12px;
    }

    /* Section gauche : icône + messages restants */
    #messageCounter .flex.items-center.gap-2 {
        margin-bottom: 0 !important;
        flex-shrink: 0;
    }

    #messageCounter .flex.items-center.gap-2 i {
        color: #22d3ee !important;
        font-size: 1rem;
    }

    #messageCounter .font-semibold {
        font-size: 0.8125rem;
        color: white !important;
    }

    /* Compteur au centre - compact */
    #messageCounter .text-3xl {
        font-size: 1.25rem !important;
        color: #22d3ee !important;
        margin: 0 8px;
        font-weight: 700;
    }

    /* Texte "Connectez-vous..." - caché sur bandeau */
    #messageCounter .text-xs.text-gray-500 {
        display: none !important;
    }

    /* Bouton connexion - compact à droite */
    #messageCounter button {
        margin-top: 0 !important;
        padding: 8px 14px !important;
        font-size: 0.75rem;
        border-radius: 6px;
        white-space: nowrap;
        flex-shrink: 0;
        background: white !important;
        color: #0f172a !important;
        font-weight: 600;
    }

    #messageCounter button:hover {
        background: #f1f5f9 !important;
    }

    /* Restructuration en ligne pour le bandeau */
    #messageCounter.message-counter.banner-visible > div {
        flex-wrap: nowrap;
    }

    /* Safe area pour iPhone */
    @supports (padding: env(safe-area-inset-bottom)) {
        #messageCounter.message-counter > div {
            padding-bottom: max(10px, env(safe-area-inset-bottom)) !important;
        }
    }
}

/* ═══════════════════════════════════════════════════════════════
   ANIMATIONS DU BANDEAU
   ═══════════════════════════════════════════════════════════════ */

/* Animation slide up pour apparition */
@keyframes bannerSlideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Animation slide down pour disparition */
@keyframes bannerSlideDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100%);
        opacity: 0;
    }
}

@media (max-width: 1023px) {
    #messageCounter.message-counter.banner-visible {
        animation: bannerSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    }

    #messageCounter.message-counter.banner-hiding {
        animation: bannerSlideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    }
}

/* ═══════════════════════════════════════════════════════════════
   AJUSTEMENTS ZONE MESSAGES QUAND BANDEAU VISIBLE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 1023px) {
    /* Ajuster le padding des messages pour laisser place au bandeau */
    body.message-banner-visible #messagesContainer.chat-messages-responsive {
        padding-bottom: calc(var(--chat-input-height, 100px) + 60px);
        transition: padding-bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Welcome section avec espace pour le bandeau */
    body.message-banner-visible #welcomeSection.chat-welcome-responsive .text-center {
        padding-bottom: 180px; /* Espace pour input + bandeau */
    }
}

/* ─────────────────────────────────────────────────────────────────
   CONTENU PRINCIPAL NON-CONNECTÉ - Ajustements Mobile
   ───────────────────────────────────────────────────────────────── */

@media (max-width: 767px) {
    /* Padding pour éviter chevauchement bandeau promo + popup */
    body.has-promo-banner #messagesContainer.chat-messages-responsive {
        padding-top: 80px; /* Espace pour le bandeau promo */
    }

    /* Welcome section avec bandeau promo */
    body.has-promo-banner #welcomeSection.chat-welcome-responsive {
        padding-top: 60px;
    }

    /* Padding bottom pour la popup + input */
    body.has-message-popup #messagesContainer.chat-messages-responsive {
        padding-bottom: calc(var(--chat-input-height, 100px) + 120px);
    }

    /* Welcome content sans être coupé */
    #welcomeSection .welcome-content,
    #welcomeSection.chat-welcome-responsive .text-center {
        padding-top: 16px;
        padding-bottom: 120px; /* Espace pour popup + input */
    }

    /* Logo welcome plus petit */
    #welcomeSection #welcome-logo {
        width: 48px !important;
        height: 48px !important;
        font-size: 1.25rem !important;
        margin-bottom: 12px !important;
    }

    /* Titre bienvenue */
    #welcomeSection h3,
    #welcomeSection #welcome-title {
        font-size: 1.125rem !important;
        line-height: 1.4 !important;
        margin-bottom: 8px !important;
        padding: 0 16px;
    }

    /* Description */
    #welcomeSection p.text-gray-600,
    #welcomeSection #welcome-description {
        font-size: 0.8125rem !important;
        line-height: 1.5;
        padding: 0 16px;
        margin-bottom: 16px !important;
    }

    /* Bouton catégories */
    #welcomeSection button[onclick="openCategoriesModal()"] {
        padding: 12px 16px !important;
        font-size: 0.875rem;
    }

    #welcomeSection button[onclick="openCategoriesModal()"] .text-base {
        font-size: 0.875rem !important;
    }

    #welcomeSection button[onclick="openCategoriesModal()"] .text-xs {
        font-size: 0.6875rem !important;
    }
}

/* ─────────────────────────────────────────────────────────────────
   ZONE DE SAISIE - Ajustements pour la popup
   ───────────────────────────────────────────────────────────────── */

@media (max-width: 767px) {
    /* Variable CSS pour la hauteur de l'input */
    :root {
        --chat-input-height: 100px;
    }

    @supports (padding: env(safe-area-inset-bottom)) {
        :root {
            --chat-input-height: calc(100px + env(safe-area-inset-bottom));
        }
    }

    /* Zone de saisie dans le welcome */
    .welcome-input-area {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid #e5e7eb;
        padding: 12px 16px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        z-index: 35;
        margin: 0 !important;
        max-width: 100% !important;
    }

    .welcome-input-area .input-wrapper {
        padding: 4px 8px !important;
        border-radius: 10px;
        max-width: 100%;
    }

    /* Disclaimer sous l'input */
    .welcome-input-area .text-xs.text-gray-500 {
        font-size: 0.625rem !important;
        margin-top: 4px !important;
        padding: 0 8px;
    }
}

/* ─────────────────────────────────────────────────────────────────
   ICÔNE CADEAU FLOTTANTE (optionnel)
   ───────────────────────────────────────────────────────────────── */

@media (max-width: 767px) {
    .gift-floating-btn,
    #gift-promo-btn {
        position: fixed;
        bottom: calc(var(--chat-input-height, 100px) + 16px);
        left: 16px;
        width: 44px;
        height: 44px;
        border-radius: 12px;
        background: linear-gradient(135deg, #0f172a, #1e3a5f);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        z-index: 36;
        cursor: pointer;
        border: none;
    }

    /* Décaler si popup messages visible */
    body.has-message-popup .gift-floating-btn,
    body.has-message-popup #gift-promo-btn {
        bottom: calc(var(--chat-input-height, 100px) + 120px);
    }
}

/* ═══════════════════════════════════════════════════════════════
   [Chat-Responsive] PRINT STYLES
   ═══════════════════════════════════════════════════════════════ */

@media print {
    .chat-mobile-header,
    #sidebar,
    .chat-sidebar-overlay,
    #fixedInputArea,
    #toggleSidebarBtn,
    #messageCounter,
    #promoBanner {
        display: none !important;
    }

    .chat-main-area {
        padding: 0 !important;
    }

    #mainContainer {
        padding-top: 0 !important;
    }
}
