body { margin: 0; font-family: 'Inter', Arial, sans-serif; background: #f6f8fa; color: #24324d; letter-spacing: 0.01em; }
/* Responsive container */
#container { width: 100%; height: 100vh; margin: 0; background: #fff; overflow: hidden; display: flex; flex-direction: column; position: relative; /* Added for positioning context */ }
#container header {    background: linear-gradient(90deg, #1b2445 0%, #03071c 100%); color: #fff; padding: 0.65rem 1rem; text-align: center; font-size: 1.12rem; font-weight: 700; letter-spacing: 0.01em; border-bottom: 1px solid #e3e7ee; min-height: unset; position: relative; /* Added for icon positioning */}
#content { flex: 1 1 0; /* display: flex; */ /* Removed flex for absolute positioning */ min-height: 0; height: 100%; position: relative; overflow: hidden; /* Added for absolute positioning context */ }
#leftSide { /* flex: 2 1 0; */ /* Removed flex sizing */ width: 100%; /* Chat takes full width */ display: flex; flex-direction: column; min-height: 0; height: 100%; background: #fafdff; }

#controls { 
    padding: 1rem; 
    border-top: 1px solid #ccc; 
    background: #fff; 
    box-shadow: 0 -2px 8px rgba(0,0,0,0.04); 
    display: flex; 
    gap: 0.5rem; 
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 10;
}

/* État initial : controls au centre avec flou d'arrière-plan */
#controls.centered {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 2rem;
    border-radius: 20px;
    border: 1px solid #e3e7ee;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-width: 70%;
    width: 90%;
}

/* Flou d'arrière-plan */
.page-blur::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    backdrop-filter: blur(8px);
    background: rgba(0, 0, 0, 0.1);
    z-index: 999;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animation pour la transition */
#controls.transitioning {
    animation: moveToBottom 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes moveToBottom {
    from {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        padding: 2rem;
        border-radius: 20px;
        max-width: 600px;
        width: 90%;
    }
    to {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        padding: 1rem;
        border-radius: 0;
        max-width: none;
        width: auto;
    }
}
.free-row { display: flex; flex: 1; gap: 0.5rem; }
.free-row > input { flex:1; padding:.75rem 1.25rem; border:1px solid #b4bcd4; border-radius:2rem; font-size: 1rem; background: #f8fafd; }
.confirm-button { padding: .75rem 1.5rem; border: none; background: linear-gradient(90deg,#0066ff,#3399ff); color: #fff; border-radius: 2rem; cursor: pointer; font-weight: 600; font-size: 1rem; margin: 5px 0; }
.confirm-button:hover:not(:disabled) { background: linear-gradient(90deg,#3a8dde,#2956c5); box-shadow: 0 4px 16px rgba(40,60,120,0.10); }

/* Animation de scintillement */
@keyframes shine {
    0% { left: -50%; }
    100% { left: 150%; }
}

/* Animation de pulsation pour l'arrière-plan */
@keyframes pulse-bg {
    0%, 100% { opacity: 0.3; transform: scale(0.95); }
    50% { opacity: 1; transform: scale(1.05); }
}
@keyframes pulse {
    0%, 100% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1); opacity: 1; }
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}
@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
@keyframes gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Styles pour les boutons du header */
.header-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 1rem;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.header-button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

#toggleCartButton {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(90deg, #0ea5e9, #6366f1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 6px 16px rgba(14, 165, 233, 0.25);
}

#toggleCartButton:hover {
    transform: translateY(-52%);
    box-shadow: 0 10px 24px rgba(99, 102, 241, 0.3);
}

#toggleCartButton .cart-btn-icon { font-size: 1rem; }
#toggleCartButton .cart-btn-label { letter-spacing: 0.2px; }
#toggleCartButton .cart-btn-count {
    background: #fff;
    color: #1e293b;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.8rem;
    font-weight: 800;
}

#newChatButton {
    position: absolute;
    left: 1rem; /* tout à gauche */
    top: 50%;
    transform: translateY(-50%);
}

/* ============================================
   RESPONSIVE MOBILE - BASE LAYOUT
   ============================================ */

/* Tablettes et petits écrans */
@media (max-width: 1024px) {
    #container header {
        padding: 0.6rem 1rem;
        font-size: 1rem;
    }

    #toggleCartButton {
        padding: 0.4rem 0.85rem;
        font-size: 0.85rem;
        gap: 6px;
    }

    #newChatButton {
        padding: 0.45rem 0.9rem;
        font-size: 0.85rem;
    }
}

/* Smartphones et petits écrans */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    #container {
        height: 100dvh; /* Dynamic viewport height pour mobile */
    }

    #container header {
        padding: 0.75rem 0.5rem;
        font-size: 0.95rem;
        min-height: 70px;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    #container header h1 {
        font-size: 0.95rem;
        line-height: 1.2;
        margin: 0;
        text-align: center;
    }

    #container header br {
        display: none;
    }

    /* Texte bêta plus petit sur mobile */
    #container header {
        font-size: 0.7rem !important;
    }

    #content {
        flex-direction: column;
        overflow: visible;
    }

    #leftSide {
        width: 100%;
        height: 100%;
        z-index: 1;
    }

    /* Zone de saisie responsive */
    #controls {
        padding: 0.75rem 0.5rem;
        gap: 0.4rem;
    }

    #controls.centered {
        max-width: 92%;
        width: 92%;
        padding: 1.5rem;
        border-radius: 16px;
    }

    .free-row {
        flex-direction: row;
        gap: 0.4rem;
    }

    .free-row > input {
        padding: 0.65rem 1rem;
        font-size: 0.95rem;
        border-radius: 1.5rem;
    }

    .confirm-button {
        padding: 0.65rem 1.2rem;
        font-size: 0.95rem;
        border-radius: 1.5rem;
        white-space: nowrap;
    }

    /* Masquer les boutons du header sur mobile */
    #container header #toggleCartButton,
    #container header #newChatButton {
        display: none !important;
    }

    /* STICKY BAR avec les deux boutons côte à côte */
    body #container header #toggleCartButton,
    #container #toggleCartButton,
    #toggleCartButton {
        position: fixed !important;
        top: var(--header-height, 70px) !important;
        right: 0 !important;
        left: auto !important;
        width: auto !important;
        max-width: 50% !important;
        padding: 0.75rem 1rem !important;
        font-size: 0.85rem !important;
        gap: 6px !important;
        z-index: 1100 !important;
        background: #1a2242;
                border: none !important;
        border-radius: 0 !important;
        border-left: 1px solid rgba(255, 255, 255, 0.2) !important;
        box-shadow: -2px 2px 12px rgba(99, 102, 241, 0.3) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        margin: 0 !important;
        transform: none !important;
    }

    body #container header #newChatButton,
    #container #newChatButton,
    #newChatButton {
        position: fixed !important;
        top: var(--header-height, 70px) !important;
        left: 0 !important;
        right: auto !important;
        width: auto !important;
        max-width: 50% !important;
        padding: 0.75rem 1rem !important;
        font-size: 0.85rem !important;
        gap: 6px !important;
        z-index: 1100 !important;
        background: #1a2242;
                color: white !important;
        border: none !important;
        border-radius: 0 !important;
        border-right: 1px solid rgba(255, 255, 255, 0.2) !important;
        box-shadow: 2px 2px 12px rgba(99, 102, 241, 0.3) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        margin: 0 !important;
        transform: none !important;
        order: 0 !important;
    }

    #newChatButton i {
        font-size: 0.85rem !important;
        margin-right: 6px !important;
        color: white !important;
    }

    .cart-btn-label {
        display: inline !important;
        font-size: 0.85rem !important;
        font-weight: 600 !important;
        color: white !important;
    }

    .cart-btn-icon {
        font-size: 1rem !important;
    }

    .cart-btn-count {
        background: white !important;
        color: #1e293b !important;
        padding: 2px 8px !important;
        font-size: 0.75rem !important;
        font-weight: 800 !important;
        border-radius: 999px !important;
    }

    /* Overlay pour bloquer l'interaction quand panier ouvert */
    #pageOverlay.active-backdrop {
        display: block;
        z-index: 1999;
        background-color: rgba(0, 0, 0, 0.4);
    }

    #leftSide.blurred-by-cart {
        filter: blur(3px);
        pointer-events: none;
    }
}

/* Très petits smartphones */
@media (max-width: 375px) {
    #container header h1 {
        font-size: 0.9rem;
    }

    #toggleCartButton,
    #newChatButton {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }

    .free-row > input {
        padding: 0.6rem 0.9rem;
        font-size: 0.9rem;
    }

    .confirm-button {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
}

/* Tablettes en mode paysage */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: landscape) {
    #container header {
        padding: 0.5rem 1rem;
    }

    .free-row > input {
        font-size: 0.95rem;
    }
}

/* Optimisations pour écrans tactiles */
@media (hover: none) and (pointer: coarse) {
    /* Augmenter la zone tactile des boutons */
    button,
    .header-button,
    .confirm-button {
        min-height: 44px; /* Recommandation Apple/Google */
        min-width: 44px;
    }

    /* Désactiver les transformations hover sur tactile */
    #toggleCartButton:hover {
        transform: translateY(-50%);
    }

    .header-button:hover {
        transform: none;
    }

    /* Effet :active à la place */
    #toggleCartButton:active {
        transform: translateY(-50%) scale(0.95);
    }

    .confirm-button:active {
        transform: scale(0.97);
    }
}

/* ============================================
   INFOBULLE PRIX HT - RESPONSIVE
   ============================================ */

/* Conteneur pour le prix avec icône info */
.price-with-info {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: visible;
}

/* S'assurer que les conteneurs parents ne coupent pas l'infobulle */
.price-with-info .price-info-icon {
    position: relative;
    overflow: visible;
}

/* Icône d'information */
.price-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    font-style: normal;
    cursor: help;
    transition: all 0.2s ease;
    user-select: none;
    flex-shrink: 0;
}

.price-info-icon:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: scale(1.1);
}

/* Infobulle - cachée par défaut */
.price-info-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 41, 59, 0.95);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
    pointer-events: none;
}

/* Flèche de l'infobulle */
.price-info-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(30, 41, 59, 0.95);
}

/* Afficher l'infobulle au survol sur desktop */
@media (hover: hover) and (pointer: fine) {
    .price-info-icon:hover .price-info-tooltip {
        opacity: 1;
        visibility: visible;
        bottom: calc(100% + 12px);
    }
}

/* Version mobile/tactile - infobulle au clic */
@media (hover: none) and (pointer: coarse), (max-width: 768px) {
    .price-info-icon {
        cursor: pointer;
    }
    
    /* Classe ajoutée via JavaScript au clic */
    .price-info-icon.active .price-info-tooltip {
        opacity: 1;
        visibility: visible;
        bottom: calc(100% + 12px);
    }
    
    /* Augmenter la zone tactile */
    .price-info-icon {
        width: 24px;
        height: 24px;
        font-size: 13px;
    }
    
    /* Permettre le retour à la ligne sur mobile pour infobulles longues */
    .price-info-tooltip {
        white-space: normal;
        min-width: 220px;
        max-width: 90vw;
        width: max-content;
        text-align: center;
        word-break: break-word;
        left: 50%;
        right: auto;
        font-size: 12px;
    }
}

/* Très petits écrans - ajustement supplémentaire */
@media (max-width: 375px) {
    .price-info-tooltip {
        min-width: 180px !important;
        max-width: 85vw !important;
        font-size: 11px !important;
        padding: 8px 12px !important;
    }
}