/* ==========================================================================
   1. Estructura Principal y Reset
   ========================================================================== */
#dokter-chat-container {
    position: fixed;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    /* La posición (left, right, bottom) es inyectada dinámicamente vía PHP */
}

/* ==========================================================================
   2. Wrapper y Botón Flotante (FAB)
   ========================================================================== */
.dokter-fab-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    gap: 8px; /* Espacio entre el botón y el texto */
    z-index: 999999;
}

#dokter-chat-fab {
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    border-radius: 50%;
    box-shadow: 0 6px 16px rgba(37, 211, 102, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

#dokter-chat-fab svg {
    transition: transform 0.3s ease;
    width: 32px !important;
    height: 32px !important;
    fill: white;
}

.dokter-fab-wrapper:hover #dokter-chat-fab {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(18, 140, 126, 0.5);
}

.dokter-fab-wrapper:hover #dokter-chat-fab svg {
    transform: scale(1.15) rotate(-5deg);
}

/* Texto de Etiqueta (Debajo del FAB) */
.dokter-fab-label {
    background-color: white;
    color: #075E54;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    opacity: 0.95;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none; /* Evita que bloquee el clic del wrapper */
}

.dokter-fab-wrapper:hover .dokter-fab-label {
    opacity: 1;
    transform: scale(1.05);
}

/* Animaciones del FAB Inyectadas desde PHP */
@keyframes dokterPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 15px rgba(37, 211, 102, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

@keyframes dokterBounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-15px); }
    60% { transform: translateY(-7px); }
}

/* ==========================================================================
   3. Ventana del Chat y Cabecera
   ========================================================================== */
#dokter-chat-window {
    display: none; /* Se activa vía JS (flex) */
    width: 350px;
    height: 500px;
    max-height: 80vh;
    max-width: 90vw;
    background-color: #e5ddd5; /* Fondo clásico de WP */
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    position: absolute;
    flex-direction: column;
    overflow: hidden;
    /* pos (bottom, right, left, top) inyectado vía PHP */
}

.dokter-chat-header {
    background-color: #075E54;
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
}

.dokter-chat-close {
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    transition: color 0.2s;
}

.dokter-chat-close:hover {
    color: #ffcccc;
}

.dokter-chat-reset {
    margin-right: 15px;
    transition: color 0.2s;
}

.dokter-chat-reset:hover {
    color: #dcf8c6;
}

/* ==========================================================================
   4. Pantalla Inicial (Menú de Selección)
   ========================================================================== */
#dokter-chat-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 30px 20px;
    background-color: #e5ddd5;
    gap: 15px;
}

.dokter-menu-btn {
    background: linear-gradient(135deg, #075E54 0%, #128C7E 100%);
    color: white;
    border: none;
    padding: 16px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    box-shadow: 0 4px 10px rgba(18, 140, 126, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
}

.dokter-menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(18, 140, 126, 0.4);
    background: linear-gradient(135deg, #128C7E 0%, #075E54 100%);
}

/* ==========================================================================
   5. Formulario de Captura de Leads
   ========================================================================== */
#dokter-chat-lead-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 30px 20px;
    background-color: #e5ddd5;
    gap: 15px;
}

#dokter-chat-lead-form input {
    padding: 12px 15px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

#dokter-chat-lead-form input:focus {
    border-color: #075E54;
}

#dokter-chat-lead-form button {
    background-color: #075E54;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

#dokter-chat-lead-form button:hover {
    background-color: #128C7E;
}

/* ==========================================================================
   6. Área de Mensajes e Interfaz de Conversación
   ========================================================================== */
#dokter-chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dokter-msg {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
}

.dokter-msg.bot {
    align-self: flex-start;
    background-color: white;
    border-top-left-radius: 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.dokter-msg.user {
    align-self: flex-end;
    background-color: #dcf8c6;
    border-top-right-radius: 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.dokter-typing {
    font-style: italic;
    color: #888;
    font-size: 12px;
    background-color: transparent !important;
    box-shadow: none !important;
    padding: 5px 15px !important;
}

/* Área de Input Inferior */
.dokter-chat-input-area {
    display: flex;
    padding: 10px;
    background-color: #f0f0f0;
    border-top: 1px solid #ddd;
}

#dokter-chat-input {
    flex: 1;
    padding: 12px 15px;
    border: none;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

#dokter-chat-send {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 10px;
    color: #075E54;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

#dokter-chat-send:hover {
    color: #128C7E;
}

#dokter-chat-send svg {
    width: 26px;
    height: 26px;
    fill: currentColor;
}