/**
 * Chatbot Widget - Styles
 *
 * Design glassmorphism assorti au site annecy-osteopathie.com
 * Variables couleurs : --color-accent: #D4A574, --color-bg-dark: #0a1628
 *
 * @package View360
 * @subpackage Chatbot
 */

/* ================================
   CONTENEUR PRINCIPAL
   ================================ */

.v360-chatbot {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* ================================
   BULLE FLOTTANTE
   ================================ */

.v360-cb-bubble {
    height: 56px;
    padding: 0 22px;
    border-radius: 28px;
    background: linear-gradient(135deg, #D4A574, #B8844E);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    box-shadow: 0 6px 22px rgba(212, 165, 116, 0.5), 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease, padding 0.3s ease, border-radius 0.3s ease;
    position: relative;
}

/* Etiquette texte de la pilule (option C : toujours visible) */
.v360-cb-bubble-label {
    color: #ffffff;
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

/* Etat ouvert : la pilule se reduit en bouton rond pour afficher la croix */
.v360-chatbot.open .v360-cb-bubble {
    padding: 0;
    width: 56px;
    border-radius: 50%;
}

.v360-chatbot.open .v360-cb-bubble-label {
    display: none;
}

.v360-cb-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(212, 165, 116, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3);
}

.v360-cb-bubble svg {
    width: 22px;
    height: 22px;
    color: white;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.v360-cb-icon-close {
    position: absolute;
    opacity: 0;
    transform: rotate(-90deg);
}

.v360-chatbot.open .v360-cb-icon-chat {
    opacity: 0;
    transform: rotate(90deg);
}

.v360-chatbot.open .v360-cb-icon-close {
    opacity: 1;
    transform: rotate(0deg);
}

/* Pulse animation au demarrage */
.v360-cb-bubble::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 28px;
    background: rgba(212, 165, 116, 0.35);
    animation: v360-pulse 2s ease-out infinite;
}

.v360-chatbot.open .v360-cb-bubble::before {
    animation: none;
    opacity: 0;
}

@keyframes v360-pulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.6); opacity: 0; }
}

/* ================================
   FENETRE DE CHAT
   ================================ */

.v360-cb-window {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 120px);
    background: rgba(43, 22, 40, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(212, 165, 116, 0.1);
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.v360-chatbot.open .v360-cb-window {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ================================
   HEADER
   ================================ */

.v360-cb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: linear-gradient(135deg, rgba(212, 165, 116, 0.15), rgba(212, 165, 116, 0.05));
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.v360-cb-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.v360-cb-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #D4A574, #B8844E);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.v360-cb-avatar svg {
    width: 20px;
    height: 20px;
    color: white;
}

.v360-cb-header-title {
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
}

.v360-cb-header-subtitle {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.v360-cb-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.v360-cb-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

.v360-cb-close svg {
    width: 18px;
    height: 18px;
    color: rgba(255, 255, 255, 0.7);
}

/* ================================
   ZONE DE MESSAGES
   ================================ */

.v360-cb-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

/* Scrollbar personnalisee */
.v360-cb-messages::-webkit-scrollbar {
    width: 5px;
}

.v360-cb-messages::-webkit-scrollbar-track {
    background: transparent;
}

.v360-cb-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

/* ================================
   MESSAGES (BULLES)
   ================================ */

.v360-cb-msg {
    display: flex;
    max-width: 85%;
    animation: v360-fadeIn 0.3s ease;
}

.v360-cb-msg-bot {
    align-self: flex-start;
}

.v360-cb-msg-user {
    align-self: flex-end;
}

.v360-cb-msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    word-break: break-word;
}

.v360-cb-msg-bubble.bot {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    border-bottom-left-radius: 4px;
}

.v360-cb-msg-bubble.user {
    background: linear-gradient(135deg, #D4A574, #B8844E);
    color: white;
    border-bottom-right-radius: 4px;
}

@keyframes v360-fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ================================
   BOUTONS D'OPTIONS
   ================================ */

.v360-cb-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    animation: v360-fadeIn 0.3s ease;
}

.v360-cb-options.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.v360-cb-option-btn {
    padding: 8px 14px;
    border-radius: 20px;
    border: 1px solid rgba(212, 165, 116, 0.4);
    background: rgba(212, 165, 116, 0.08);
    color: #D4A574;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
}

.v360-cb-option-btn:hover {
    background: rgba(212, 165, 116, 0.2);
    border-color: rgba(212, 165, 116, 0.6);
    transform: translateY(-1px);
}

.v360-cb-option-btn:active {
    transform: translateY(0);
}

.v360-cb-option-btn:disabled {
    cursor: default;
    opacity: 0.5;
}

/* ================================
   INDICATEUR DE FRAPPE
   ================================ */

.v360-cb-dots {
    display: flex;
    gap: 5px;
    padding: 4px 0;
}

.v360-cb-dots span {
    width: 7px;
    height: 7px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    animation: v360-dotBounce 1.4s ease-in-out infinite;
}

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

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

@keyframes v360-dotBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ================================
   ZONE INPUT (FORMULAIRES)
   ================================ */

.v360-cb-input-area {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.v360-cb-input-area:empty {
    display: none;
}

/* Formulaire date */
.v360-cb-date-form {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
}

/* Formulaire contact */
.v360-cb-contact-form {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.v360-cb-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.v360-cb-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
}

.v360-cb-input {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.06);
    color: #e0e0e0;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease;
    width: 100%;
}

.v360-cb-input:focus {
    border-color: rgba(212, 165, 116, 0.5);
    background: rgba(255, 255, 255, 0.1);
}

.v360-cb-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* Fix pour input date sur fond sombre */
.v360-cb-input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
}

.v360-cb-send-btn {
    padding: 10px 16px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #D4A574, #B8844E);
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
}

.v360-cb-send-btn:hover {
    opacity: 0.9;
}

.v360-cb-submit-btn {
    padding: 12px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #D4A574, #B8844E);
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
    margin-top: 4px;
    font-family: inherit;
}

.v360-cb-submit-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.v360-cb-submit-btn:active {
    transform: translateY(0);
}

/* ================================
   RESPONSIVE
   ================================ */

@media (max-width: 480px) {
    .v360-chatbot {
        bottom: 12px;
        right: 12px;
    }

    .v360-cb-bubble {
        height: 52px;
        padding: 0 18px;
        gap: 8px;
    }
    .v360-cb-bubble-label {
        font-size: 14px;
    }

    .v360-cb-window {
        bottom: 70px;
        right: -8px;
        width: calc(100vw - 16px);
        height: calc(100vh - 100px);
        max-height: calc(100vh - 100px);
        border-radius: 16px;
    }

    .v360-cb-msg {
        max-width: 90%;
    }
}

/* ================================
   PRINT : MASQUER LE CHATBOT
   ================================ */

@media print {
    .v360-chatbot {
        display: none !important;
    }
}
