:root {
    --vizeo-dark: #10152b;
    --vizeo-primary: #19203b;
    --vizeo-light: #2a3454;
    --vizeo-accent: #3d4a6e;
    --vizeo-red: #f24c52;
    --vizeo-red-dark: #d93a40;
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --success: #10b981;
    --success-light: #d1fae5;
    --error: #f24c52;
    --error-light: #fee2e2;
    --warning: #f59e0b;
}

body {
    margin: 0;
    font-family: 'Inter', Arial, sans-serif;
    background: var(--gray-50);
    color: var(--vizeo-primary);
    letter-spacing: 0.01em;
}

/* Responsive container */
#container {
    width: 100%;
    height: 100vh;
    margin: 0;
    background: var(--white);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    /* Added for positioning context */
}

/* HEADER DESIGN */
#container header {
    background: var(--vizeo-primary);
    color: var(--white);
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--vizeo-accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 20;
    height: 56px;
    /* Compact height */
    box-sizing: border-box;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

#container header h1 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--white);
}

.header-subtitle {
    font-size: 0.85rem;
    color: var(--gray-400);
    font-weight: 400;
    padding-left: 12px;
    border-left: 1px solid var(--vizeo-accent);
}

/* Header Actions - Boutons à droite */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Style commun pour les boutons d'action header */
.header-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    white-space: nowrap;
}

/* Bouton secondaire (Nouvelle conversation) */
.header-action-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border-color: rgba(255, 255, 255, 0.2);
}

.header-action-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.35);
    transform: translateY(-1px);
}

.header-action-secondary i {
    font-size: 0.9rem;
}

/* Bouton principal (Panier) */
.header-action-primary {
    background: linear-gradient(135deg, var(--vizeo-red) 0%, var(--vizeo-red-dark) 100%);
    color: var(--white);
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(242, 76, 82, 0.3);
}

.header-action-primary:hover {
    background: linear-gradient(135deg, var(--vizeo-red-dark) 0%, #c02e34 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(242, 76, 82, 0.4);
}

.header-action-primary .cart-btn-icon {
    font-size: 1rem;
}

.header-action-primary .cart-btn-label {
    font-weight: 600;
}

.header-action-primary .cart-btn-count {
    background: var(--white);
    color: var(--vizeo-red);
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 800;
    min-width: 18px;
    text-align: center;
}

.beta-badge {
    background: rgba(242, 76, 82, 0.15);
    color: var(--vizeo-red);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid rgba(242, 76, 82, 0.3);
    margin-left: 12px;
}

.beta-disclaimer {
    font-size: 0.75rem;
    color: var(--gray-400);
    font-weight: 400;
    margin-left: 10px;
    font-style: italic;
}

#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 var(--gray-300);
    border-radius: 2rem;
    font-size: 1rem;
    background: var(--gray-50);
    color: var(--gray-900);
}

.confirm-button {
    padding: .75rem 1.5rem;
    border: none;
    background: linear-gradient(90deg, var(--vizeo-accent), var(--vizeo-light));
    color: var(--white);
    border-radius: 2rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    margin: 5px 0;
}

.confirm-button:hover:not(:disabled) {
    background: linear-gradient(90deg, var(--vizeo-light), var(--vizeo-primary));
    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%;
    }
}

/* Anciens styles de boutons header - désactivés car maintenant intégrés en flexbox */
/* Les nouveaux styles sont dans .header-action-btn, .header-action-primary, .header-action-secondary */

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

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

    .header-action-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
        gap: 6px;
    }

    .header-action-btn span:not(.cart-btn-count):not(.cart-btn-icon) {
        display: none;
    }

    .header-action-secondary i {
        margin-right: 0;
    }
}

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

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

    #container header {
        padding: 0 0.75rem;
        height: 50px;
        min-height: 50px;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }

    .header-left {
        gap: 8px;
    }

    .header-subtitle {
        display: none;
    }

    .beta-badge {
        display: none;
    }

    .beta-disclaimer {
        display: none;
    }

    #container header h1 {
        font-size: 1rem;
        margin: 0;
    }

    /* Boutons header mobile */
    .header-actions {
        gap: 6px;
    }

    .header-action-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
        gap: 5px;
        border-radius: 6px;
    }

    /* Masquer les labels sur très petit écran */
    .header-action-btn span:not(.cart-btn-count):not(.cart-btn-icon) {
        display: none;
    }

    .header-action-primary .cart-btn-count {
        padding: 1px 5px;
        font-size: 0.7rem;
        min-width: 16px;
    }

    #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;
    }

    /* 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;
    }

    .cart-btn-label {
        display: none !important;
    }

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

    .cart-btn-count {
        background: var(--white) !important;
        color: var(--vizeo-primary) !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;
    }

    .header-action-btn {
        padding: 5px 8px;
        font-size: 0.7rem;
    }

    .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-action-btn,
    .confirm-button {
        min-height: 44px;
        /* Recommandation Apple/Google */
        min-width: 44px;
    }

    /* Désactiver les transformations hover sur tactile */
    .header-action-btn:hover {
        transform: none;
    }

    /* Effet :active à la place */
    .header-action-btn:active {
        transform: 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, var(--vizeo-accent), var(--vizeo-light));
    color: var(--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, var(--vizeo-light), var(--vizeo-primary));
    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(16, 21, 43, 0.95);
    /* Using vizeo-dark approximation */
    color: var(--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(16, 21, 43, 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;
    }
}