/* Chatbot Genicotik - Styles */

/* Bouton flottant */
.chatbot-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(180deg, #2aa8ff, #1987e6);
    border: none;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(42, 168, 255, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(42, 168, 255, 0.5), 0 6px 16px rgba(0, 0, 0, 0.4);
}

.chatbot-toggle.active {
    background: linear-gradient(180deg, #4dc3ff, #2aa8ff);
    opacity: 0;
    pointer-events: none;
    transform: scale(0.85);
}

.chatbot-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ff5a6b;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Overlay modal */
.chatbot-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(4, 8, 18, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10049;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-backdrop.active {
    opacity: 1;
    pointer-events: all;
}

body.chatbot-modal-open {
    overflow: hidden;
}

/* Fenêtre de chat */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 420px;
    max-width: calc(100vw - 48px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: linear-gradient(180deg, #0f1627, #0c111d);
    border: 1px solid rgba(77, 140, 255, 0.3);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(42, 168, 255, 0.2);
    z-index: 10051;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.chatbot-window.modal-mode {
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    width: min(760px, calc(100vw - 32px));
    height: min(780px, calc(100vh - 48px));
    max-width: min(760px, calc(100vw - 32px));
    max-height: min(780px, calc(100vh - 48px));
    transform: translate(-50%, -48%) scale(0.92);
    border-radius: 24px;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.65),
                0 0 0 1px rgba(77, 140, 255, 0.25),
                0 0 60px rgba(42, 168, 255, 0.15);
}

.chatbot-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.chatbot-window.modal-mode.active {
    transform: translate(-50%, -50%) scale(1);
}

/* Header */
.chatbot-header {
    padding: 20px;
    border-bottom: 1px solid rgba(77, 140, 255, 0.2);
    background: linear-gradient(180deg, rgba(42, 168, 255, 0.1), transparent);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.chatbot-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2aa8ff, #4dc3ff);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.chatbot-header h3 {
    margin: 0;
    font-size: 16px;
    color: #c9d7ff;
    font-weight: 600;
}

.chatbot-header p {
    margin: 4px 0 0;
    font-size: 12px;
    color: #7b8aad;
}

.chatbot-close {
    background: none;
    border: none;
    color: #7b8aad;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-close:hover {
    background: rgba(77, 140, 255, 0.1);
    color: #c9d7ff;
}

/* Messages */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: rgba(11, 15, 23, 0.5);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(77, 140, 255, 0.3);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(77, 140, 255, 0.5);
}

.chatbot-message {
    display: flex;
    gap: 12px;
    animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-message-user {
    flex-direction: row-reverse;
}

.chatbot-message-user .message-content {
    background: linear-gradient(135deg, #2aa8ff, #1987e6);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chatbot-message-bot .message-content {
    background: rgba(77, 140, 255, 0.1);
    color: #c9d7ff;
    border-bottom-left-radius: 4px;
}

.chatbot-message-bot.has-options .message-content {
    width: 100%;
    max-width: 100%;
}

.message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 14px;
}

.chatbot-welcome-kicker {
    color: #69c6ff;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.chatbot-welcome-note {
    color: #93a7cc;
    font-size: 13px;
}

.chatbot-primary-action {
    margin-top: 8px;
    min-height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 8px;
    background: #2aa8ff;
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.chatbot-primary-action:hover {
    background: #4dc3ff;
}

.message-content p {
    margin: 0 0 8px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content .price {
    color: #31d0aa;
    font-weight: 700;
    font-size: 16px;
}

.message-content.error {
    color: #ff5a6b;
}

/* Typing indicator - Animation améliorée et visible */
.chatbot-typing {
    display: flex;
    padding: 12px 20px;
    align-items: center;
    animation: typingPulse 2s ease-in-out infinite;
}

.typing-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: linear-gradient(135deg, rgba(42, 168, 255, 0.15), rgba(77, 140, 255, 0.1));
    border: 1px solid rgba(77, 140, 255, 0.3);
    border-radius: 18px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(42, 168, 255, 0.2);
    animation: typingGlow 2s ease-in-out infinite;
}

.typing-dots {
    display: flex;
    gap: 8px;
    align-items: center;
}

.typing-dots span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2aa8ff, #4dc3ff);
    box-shadow: 0 0 12px rgba(42, 168, 255, 0.6), 0 0 20px rgba(42, 168, 255, 0.3);
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

.typing-text {
    color: #93a7cc;
    font-size: 13px;
    font-style: italic;
    font-weight: 500;
    animation: typingFade 2s ease-in-out infinite;
    white-space: nowrap;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.8;
    }
    30% {
        transform: translateY(-14px) scale(1.3);
        opacity: 1;
        box-shadow: 0 0 20px rgba(42, 168, 255, 0.9), 0 0 30px rgba(42, 168, 255, 0.5);
    }
}

@keyframes typingPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.85;
    }
}

@keyframes typingGlow {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(42, 168, 255, 0.2);
        border-color: rgba(77, 140, 255, 0.3);
    }
    50% {
        box-shadow: 0 4px 16px rgba(42, 168, 255, 0.4), 0 0 20px rgba(42, 168, 255, 0.2);
        border-color: rgba(77, 140, 255, 0.5);
    }
}

@keyframes typingFade {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
}

/* Input area */
.chatbot-input-area {
    padding: 16px 20px;
    border-top: 1px solid rgba(77, 140, 255, 0.2);
    background: rgba(11, 15, 23, 0.5);
}

.chatbot-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

#chatbot-input {
    flex: 1;
    background: rgba(77, 140, 255, 0.1);
    border: 1px solid rgba(77, 140, 255, 0.2);
    border-radius: 12px;
    padding: 12px 16px;
    color: #c9d7ff;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    transition: all 0.2s ease;
}

#chatbot-input:focus {
    outline: none;
    border-color: rgba(77, 140, 255, 0.5);
    background: rgba(77, 140, 255, 0.15);
}

#chatbot-input::placeholder {
    color: #7b8aad;
}

.chatbot-send {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #2aa8ff, #1987e6);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chatbot-speech {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid rgba(77, 195, 255, 0.35);
    background: rgba(42, 168, 255, 0.1);
    color: #8ecfff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chatbot-speech[hidden] { display: none; }
.chatbot-speech:hover { background: rgba(42, 168, 255, 0.2); color: #fff; }
.chatbot-speech.is-listening {
    color: #fff;
    background: #e64d67;
    border-color: #ff8295;
    box-shadow: 0 0 0 5px rgba(230, 77, 103, 0.16);
    animation: chatbot-mic-pulse 1.4s ease-in-out infinite;
}

@keyframes chatbot-mic-pulse {
    50% { transform: scale(1.06); box-shadow: 0 0 0 9px rgba(230, 77, 103, 0.08); }
}

.chatbot-start-intents {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0 12px;
}

.chatbot-start-intents button {
    border: 1px solid rgba(77, 195, 255, 0.38);
    border-radius: 999px;
    padding: 8px 12px;
    background: rgba(42, 168, 255, 0.1);
    color: #cfe9ff;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chatbot-start-intents button:hover,
.chatbot-start-intents button.is-selected {
    background: rgba(42, 168, 255, 0.26);
    border-color: #4dc3ff;
    color: #fff;
    transform: translateY(-1px);
}

.chatbot-start-intents button:disabled:not(.is-selected) { opacity: 0.4; }

.chatbot-welcome-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.chatbot-welcome-brand strong { display: block; color: #f4f8ff; font-size: 17px; line-height: 1.3; }
.chatbot-welcome-kicker { margin: 0 0 3px !important; color: #5ed5ff; font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.chatbot-welcome-copy { margin: 0 !important; color: #b8c8df; line-height: 1.55; }
.chatbot-welcome-note { margin: 10px 0 0 !important; color: #7890aa; font-size: 11px; }
.chatbot-welcome-orb {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 14px;
    color: #06121c;
    font-size: 18px;
    font-weight: 900;
    background: linear-gradient(135deg, #5ee7ff, #2aa8ff 55%, #8d6bff);
    box-shadow: 0 8px 24px rgba(42, 168, 255, .28);
}

.chatbot-company-card {
    align-self: flex-start;
    width: min(520px, 88%);
    margin: 6px 0;
    padding: 16px;
    border: 1px solid rgba(49, 208, 170, .36);
    border-radius: 15px;
    background: linear-gradient(145deg, rgba(13, 35, 42, .98), rgba(13, 24, 40, .98));
    color: #dcecff;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .2);
}

.company-card-top { display: flex; justify-content: space-between; gap: 12px; color: #77dfc4; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.company-card-top strong { color: #8af0ae; }
.chatbot-company-card h4 { margin: 9px 0 12px; color: #fff; font-size: 17px; }
.chatbot-company-card dl { display: grid; gap: 8px; margin: 0 0 12px; }
.chatbot-company-card dl div { display: grid; grid-template-columns: 75px 1fr; gap: 10px; }
.chatbot-company-card dt { color: #7896a8; font-size: 11px; text-transform: uppercase; }
.chatbot-company-card dd { margin: 0; color: #d7e7ee; font-size: 13px; }
.chatbot-company-card a { color: #5ed5ff; font-size: 12px; text-decoration: none; }
.chatbot-analysis-card h5 { margin: 15px 0 8px; color: #9dc4d5; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.analysis-tech-list { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.analysis-tech { display: inline-flex; align-items: center; gap: 4px; padding: 6px 9px; border: 1px solid rgba(94,213,255,.25); border-radius: 999px; background: rgba(25,139,190,.12); color: #dff7ff; font-size: 12px; }
.analysis-tech small { color: #7fa9bb; font-size: 9px; text-transform: uppercase; }
.analysis-tech-muted { color: #8ba7b4; border-style: dashed; }
.chatbot-company-card .analysis-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 14px; }
.chatbot-company-card .analysis-grid div { grid-template-columns: 1fr auto; padding-bottom: 5px; border-bottom: 1px solid rgba(120,150,168,.14); }

.chatbot-send:hover {
    background: linear-gradient(135deg, #4dc3ff, #2aa8ff);
    transform: scale(1.05);
}

.chatbot-send:active {
    transform: scale(0.95);
}

/* Devis options */
.chatbot-devis-options {
    margin-top: 8px;
    padding: 16px;
    background: rgba(42, 168, 255, 0.1);
    border: 1px solid rgba(77, 140, 255, 0.3);
    border-radius: 12px;
}

.devis-summary {
    margin-bottom: 16px;
}

.devis-summary h4 {
    margin: 0 0 12px;
    font-size: 16px;
    color: #c9d7ff;
    font-weight: 600;
}

.devis-summary p {
    margin: 6px 0;
    font-size: 14px;
    color: #93a7cc;
}

.payment-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-payment {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid rgba(77, 140, 255, 0.3);
    background: rgba(77, 140, 255, 0.1);
    color: #c9d7ff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-payment:hover {
    background: rgba(77, 140, 255, 0.2);
    border-color: rgba(77, 140, 255, 0.5);
    transform: translateY(-2px);
}

.btn-stripe {
    background: linear-gradient(135deg, rgba(99, 91, 255, 0.2), rgba(99, 91, 255, 0.1));
    border-color: rgba(99, 91, 255, 0.4);
}

.btn-qonto {
    background: linear-gradient(135deg, rgba(42, 168, 255, 0.2), rgba(42, 168, 255, 0.1));
    border-color: rgba(42, 168, 255, 0.4);
}

.appointment-wizard {
    width: min(100%, 760px);
    margin: 4px 0 8px;
    padding: 22px;
    background: #111a2c;
    border: 1px solid rgba(77, 195, 255, 0.3);
    border-radius: 8px;
    color: #c9d7ff;
}

.appointment-wizard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.appointment-eyebrow {
    color: #69c6ff;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.appointment-wizard h4,
.appointment-wizard h5 {
    margin: 4px 0 0;
    color: #f4f7ff;
    font-size: 18px;
}

.appointment-wizard-header > strong {
    color: #31d0aa;
    font-size: 24px;
}

.appointment-explanation,
.appointment-wizard-body > p,
.appointment-legal {
    color: #93a7cc;
    font-size: 13px;
    line-height: 1.55;
}

.appointment-progress {
    height: 4px;
    margin: 18px 0 22px;
    overflow: hidden;
    background: rgba(123, 138, 173, 0.2);
    border-radius: 2px;
}

.appointment-progress span {
    display: block;
    height: 100%;
    width: 25%;
    background: #2aa8ff;
    transition: width 0.25s ease;
}

.appointment-wizard-body label {
    display: block;
    margin-bottom: 10px;
    color: #f4f7ff;
    font-size: 16px;
    font-weight: 700;
}

.appointment-wizard-body input {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    border: 1px solid rgba(77, 140, 255, 0.4);
    border-radius: 8px;
    outline: none;
    background: #0b0f17;
    color: #fff;
    font: inherit;
}

.appointment-wizard-body input:focus {
    border-color: #4dc3ff;
    box-shadow: 0 0 0 3px rgba(77, 195, 255, 0.12);
}

.appointment-wizard-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    position: sticky;
    bottom: 0;
    z-index: 4;
    padding: 14px 0 2px;
    background: linear-gradient(180deg, rgba(15, 24, 42, 0), #0f182a 28%);
}

.appointment-wizard-actions button,
.appointment-payment-link {
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid rgba(77, 140, 255, 0.35);
    border-radius: 8px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.appointment-next,
.appointment-payment-link {
    border-color: #2aa8ff !important;
    background: #2aa8ff;
    color: #fff;
}

.appointment-back {
    background: transparent;
    color: #c9d7ff;
}

.appointment-wizard-actions button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.appointment-error {
    margin: 12px 0 0;
    padding: 10px 12px;
    border-left: 3px solid #ff5a6b;
    background: rgba(255, 90, 107, 0.08);
    color: #ff9aa5;
    font-size: 13px;
}

.appointment-loading {
    padding: 18px;
    border: 1px solid rgba(77, 140, 255, 0.2);
    border-radius: 8px;
    color: #93a7cc;
    text-align: center;
}

.appointment-slots-summary {
    position: sticky;
    top: 0;
    z-index: 1;
    margin-bottom: 10px;
    padding: 8px 10px;
    background: #111a2c;
    color: #93a7cc;
    font-size: 12px;
}

.appointment-wizard #available-slots {
    max-height: 340px;
    overflow-y: auto;
    padding-right: 6px;
}

.appointment-wizard .slot-btn {
    min-height: 40px;
}

.appointment-wizard .slot-btn[aria-pressed="true"] {
    box-shadow: 0 0 0 2px rgba(77, 195, 255, 0.3), 0 8px 24px rgba(42, 168, 255, 0.18);
}

.appointment-slot-confirmation {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 12px;
    padding: 13px 14px;
    border: 1px solid rgba(44, 222, 179, 0.45);
    border-radius: 10px;
    background: rgba(44, 222, 179, 0.09);
    color: #eafff9;
    line-height: 1.45;
}

.appointment-slot-confirmation[hidden] {
    display: none;
}

.appointment-slot-confirmation small {
    display: block;
    margin-top: 4px;
    color: #9fb8c5;
}

.appointment-slot-check {
    display: inline-grid;
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    place-items: center;
    border-radius: 50%;
    background: #2cdeb3;
    color: #071318;
    font-weight: 900;
}

.appointment-next-ready {
    animation: appointmentCtaReady 0.55s ease-out;
    box-shadow: 0 0 0 4px rgba(42, 168, 255, 0.15), 0 8px 26px rgba(42, 168, 255, 0.3);
}

@keyframes appointmentCtaReady {
    0% { transform: scale(0.97); }
    55% { transform: scale(1.035); }
    100% { transform: scale(1); }
}

.appointment-summary {
    margin: 16px 0;
}

.appointment-summary > div {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(77, 140, 255, 0.16);
}

.appointment-summary dt {
    color: #7b8aad;
}

.appointment-summary dd {
    margin: 0;
    color: #f4f7ff;
}

.appointment-success {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.appointment-payment-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.appointment-success small {
    color: #93a7cc;
}

@media (max-width: 600px) {
    .appointment-wizard {
        padding: 16px;
    }

    .appointment-wizard-actions {
        flex-direction: column-reverse;
    }

    .appointment-wizard-actions button {
        width: 100%;
    }

    .appointment-summary > div {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

.payment-link {
    display: inline-block;
    margin-top: 12px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #2aa8ff, #1987e6);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.payment-link:hover {
    background: linear-gradient(135deg, #4dc3ff, #2aa8ff);
    transform: translateY(-2px);
}

/* Responsive */
@media (max-width: 768px) {
    .chatbot-toggle {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
    }

    .chatbot-window.modal-mode {
        width: calc(100vw - 24px);
        height: calc(100vh - 32px);
        max-width: calc(100vw - 24px);
        max-height: calc(100vh - 32px);
        border-radius: 20px;
    }

    .message-content {
        max-width: 85%;
    }

    .chatbot-quick-reply-btn {
        padding: 13px 16px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .chatbot-window.modal-mode {
        width: calc(100vw - 16px);
        height: calc(100vh - 24px);
        max-width: calc(100vw - 16px);
        max-height: calc(100vh - 24px);
        border-radius: 16px;
    }

    .chatbot-header {
        padding: 16px;
    }

    .chatbot-messages {
        padding: 16px;
    }

    .chatbot-input-area {
        padding: 12px 16px;
    }
}

/* Mode expanded (fullscreen) */
.chatbot-window.expanded {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    border: none;
    z-index: 10052;
    transform: none;
    isolation: isolate;
    background: #06101d;
}

.chatbot-ai-ambient { display: none; }

.chatbot-window.expanded .chatbot-ai-ambient {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(4, 10, 20, .94) 0%, rgba(4, 12, 24, .52) 25%, rgba(3, 9, 18, .44) 50%, rgba(4, 12, 24, .52) 75%, rgba(4, 10, 20, .94) 100%),
        linear-gradient(180deg, rgba(2, 8, 17, .32), rgba(2, 7, 15, .82)),
        url('../images/chatbot-ai-core.png') center 46% / cover no-repeat;
}

.chatbot-window.expanded .chatbot-ai-ambient::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: .22;
    background-image:
        linear-gradient(rgba(65, 190, 255, .14) 1px, transparent 1px),
        linear-gradient(90deg, rgba(65, 190, 255, .14) 1px, transparent 1px);
    background-size: 54px 54px;
    mask-image: radial-gradient(circle at center, #000 0%, transparent 72%);
}

.chatbot-window.expanded .chatbot-ai-ambient::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(77, 216, 255, .55), transparent);
    box-shadow: 0 0 18px rgba(77, 216, 255, .45);
    animation: ai-scan 8s linear infinite;
}

@keyframes ai-scan { from { top: 11%; opacity: 0; } 8% { opacity: .6; } 92% { opacity: .35; } to { top: 92%; opacity: 0; } }

.chatbot-window.expanded .chatbot-header,
.chatbot-window.expanded .chatbot-messages,
.chatbot-window.expanded .chatbot-input-area { position: relative; z-index: 2; }

.chatbot-window.expanded .chatbot-header {
    background: linear-gradient(180deg, rgba(6, 19, 35, .97), rgba(7, 20, 37, .78));
    border-bottom-color: rgba(71, 202, 255, .28);
    box-shadow: 0 8px 35px rgba(0, 0, 0, .28);
    backdrop-filter: blur(16px);
}

.chatbot-window.expanded .chatbot-avatar {
    box-shadow: 0 0 0 1px rgba(112, 224, 255, .45), 0 0 26px rgba(42, 168, 255, .38);
    animation: ai-avatar-breathe 3.4s ease-in-out infinite;
}

@keyframes ai-avatar-breathe { 50% { box-shadow: 0 0 0 5px rgba(112, 224, 255, .08), 0 0 38px rgba(42, 168, 255, .5); } }

.chatbot-window.expanded .chatbot-messages {
    scrollbar-color: rgba(71, 202, 255, .45) transparent;
}

.chatbot-window.expanded .chatbot-message-bot .message-content {
    background: linear-gradient(145deg, rgba(11, 31, 53, .9), rgba(13, 25, 45, .88));
    border: 1px solid rgba(77, 189, 255, .24);
    box-shadow: 0 14px 35px rgba(0, 0, 0, .2), inset 0 1px 0 rgba(255, 255, 255, .035);
    backdrop-filter: blur(14px);
}

.chatbot-window.expanded .chatbot-message-user .message-content {
    background: linear-gradient(135deg, rgba(26, 155, 255, .94), rgba(37, 104, 228, .94));
    box-shadow: 0 10px 30px rgba(0, 119, 255, .24), 0 0 0 1px rgba(132, 218, 255, .22);
}

.chatbot-window.expanded .chatbot-input-area {
    background: linear-gradient(180deg, rgba(5, 14, 27, .72), rgba(4, 12, 24, .97));
    border-top-color: rgba(71, 202, 255, .24);
    box-shadow: 0 -18px 45px rgba(0, 0, 0, .28);
    backdrop-filter: blur(18px);
}

.chatbot-window.expanded .chatbot-input-wrapper {
    padding: 5px;
    border: 1px solid rgba(67, 197, 255, .28);
    border-radius: 18px;
    background: rgba(5, 18, 35, .72);
    box-shadow: 0 0 32px rgba(24, 153, 255, .08), inset 0 0 22px rgba(31, 114, 190, .06);
}

.chatbot-window.expanded #chatbot-input { border: 0; background: transparent; }

.ai-hud {
    position: absolute;
    top: 50%;
    width: 190px;
    padding: 16px;
    border: 1px solid rgba(74, 201, 255, .18);
    background: linear-gradient(135deg, rgba(5, 22, 39, .6), rgba(5, 14, 28, .22));
    color: #7da4b9;
    font: 10px/1.5 Consolas, monospace;
    letter-spacing: .05em;
    backdrop-filter: blur(5px);
}
.ai-hud-left { left: 24px; transform: translateY(-50%); border-left: 2px solid rgba(72, 216, 255, .55); }
.ai-hud-right { right: 24px; transform: translateY(-50%); border-right: 2px solid rgba(138, 108, 255, .55); }
.ai-hud-label { display: block; color: #46d6ff; font-size: 9px; margin-bottom: 4px; }
.ai-hud strong { display: block; color: #d7f5ff; font-size: 12px; margin-bottom: 12px; }
.ai-hud i { display: block; font-style: normal; margin: 6px 0; }
.ai-hud i b { display: inline-block; width: 5px; height: 5px; margin-right: 7px; border-radius: 50%; background: #43e5ba; box-shadow: 0 0 8px #43e5ba; }
.ai-hud small { color: #6d8ca0; }
.ai-wave { display: flex; align-items: center; gap: 4px; height: 28px; margin: 4px 0 10px; }
.ai-wave b { width: 3px; height: 8px; background: #5bcfff; box-shadow: 0 0 6px #42bfff; animation: ai-wave 1.2s ease-in-out infinite; }
.ai-wave b:nth-child(2), .ai-wave b:nth-child(6) { animation-delay: -.2s; }.ai-wave b:nth-child(3), .ai-wave b:nth-child(5) { animation-delay: -.4s; }.ai-wave b:nth-child(4) { animation-delay: -.6s; }
@keyframes ai-wave { 50% { height: 25px; background: #a580ff; } }

.ai-core-reticle { position: absolute; top: 50%; left: 50%; width: min(46vw, 680px); aspect-ratio: 1; transform: translate(-50%, -50%); border: 1px solid rgba(71, 200, 255, .12); border-radius: 50%; animation: ai-reticle 28s linear infinite; }
.ai-core-reticle::before, .ai-core-reticle::after { content: ''; position: absolute; inset: 6%; border: 1px dashed rgba(102, 218, 255, .12); border-radius: inherit; }
.ai-core-reticle::after { inset: 18%; border-style: solid; border-color: rgba(139, 105, 255, .12); }
@keyframes ai-reticle { to { transform: translate(-50%, -50%) rotate(360deg); } }

.chatbot-window.modal-mode.expanded.active {
    transform: none;
    top: 0;
    left: 0;
}

.chatbot-window.expanded .chatbot-messages {
    width: min(100%, 1040px);
    margin: 0 auto;
    padding: 28px 32px;
    font-size: 16px;
}

.chatbot-window.expanded .message-content {
    max-width: min(78%, 760px);
    padding: 16px 20px;
    font-size: 15px;
    line-height: 1.6;
}

.chatbot-window.expanded .chatbot-message-bot.has-options .message-content,
.chatbot-window.expanded .chatbot-appointment-form,
.chatbot-window.expanded .chatbot-devis-options {
    width: min(100%, 900px);
    max-width: 900px;
}

.chatbot-window.expanded .chatbot-input-area {
    width: 100%;
    padding: 14px max(20px, calc((100vw - 980px) / 2));
}

.chatbot-window.expanded .chatbot-header {
    padding-inline: max(20px, calc((100vw - 1040px) / 2));
}

@media (max-width: 768px) {
    .chatbot-window.expanded .chatbot-messages {
        padding: 18px 14px;
    }

    .chatbot-window.expanded .message-content {
        max-width: 92%;
    }
}

@media (max-width: 1240px) {
    .chatbot-window.expanded .ai-hud { display: none; }
    .chatbot-window.expanded .chatbot-ai-ambient { background-position: center 44%; }
}

@media (prefers-reduced-motion: reduce) {
    .chatbot-window.expanded .chatbot-ai-ambient::after,
    .chatbot-window.expanded .chatbot-avatar,
    .ai-wave b,
    .ai-core-reticle { animation: none; }
}

.chatbot-window.expanded #chatbot-input {
    font-size: 15px;
    min-height: 48px;
    padding: 14px 18px;
}

.chatbot-window.expanded .chatbot-send {
    width: 48px;
    height: 48px;
}

.chatbot-expand {
    transition: all 0.2s ease;
}

.chatbot-expand:hover {
    background: rgba(77, 140, 255, 0.2) !important;
    color: #c9d7ff !important;
}

/* Quick reply buttons */
.chatbot-quick-replies {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 14px;
    padding: 14px;
    background: linear-gradient(135deg, rgba(42, 168, 255, 0.12), rgba(25, 135, 230, 0.06));
    border: 1px solid rgba(77, 195, 255, 0.35);
    border-radius: 16px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.chatbot-quick-replies-label {
    width: 100%;
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #7eb8ff;
    margin-bottom: 2px;
}

.chatbot-quick-reply-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: auto;
    max-width: 100%;
    padding: 9px 12px;
    background: linear-gradient(135deg, rgba(42, 168, 255, 0.22), rgba(25, 135, 230, 0.14));
    border: 1.5px solid rgba(77, 195, 255, 0.55);
    border-radius: 999px;
    color: #eef4ff;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
    transition: all 0.2s ease;
    font-family: inherit;
    box-shadow: 0 4px 14px rgba(42, 168, 255, 0.18);
}

.chatbot-quick-reply-btn::after {
    display: none;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(42, 168, 255, 0.25);
    color: #4dc3ff;
    font-size: 16px;
    font-weight: 700;
    transition: all 0.2s ease;
}

.chatbot-quick-reply-text {
    flex: 1;
    line-height: 1.45;
}

.chatbot-quick-reply-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(77, 195, 255, 0.35), rgba(42, 168, 255, 0.22));
    border-color: rgba(77, 195, 255, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(42, 168, 255, 0.28);
    color: #fff;
}

.chatbot-quick-reply-btn:hover:not(:disabled)::after {
    background: rgba(77, 195, 255, 0.4);
    transform: translateX(3px);
}

.chatbot-quick-reply-btn:active:not(:disabled) {
    transform: translateY(0);
}

.chatbot-quick-reply-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.chatbot-quick-reply-other {
    border-style: dashed;
    background: rgba(255, 255, 255, 0.045);
    color: #aebdd2;
}

.chatbot-quick-reply-other:hover:not(:disabled),
.chatbot-quick-reply-other.is-selected {
    background: rgba(141, 107, 255, 0.17);
    border-color: rgba(166, 140, 255, 0.7);
    color: #e6deff;
}

.chatbot-quick-replies.is-selected {
    opacity: 0.7;
    pointer-events: none;
}

/* Curseur de streaming temps réel */
.streaming-cursor {
    display: inline;
    color: #2aa8ff;
    animation: blink-cursor 0.8s step-end infinite;
    font-weight: 400;
}

@keyframes blink-cursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}
