/* ==================== CHATBOT FLOTANTE ==================== */
.chatbot-container {
    position: fixed;
    bottom: 25px;
    left: 25px;
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Botón flotante del chatbot */
.chatbot-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #25D366;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    position: relative;
}

.chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(37, 211, 102, 0.6);
    background: #20BA5A;
}

.chatbot-button i {
    color: white;
    font-size: 28px;
}

/* Badge de notificación */
.chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    font-size: 12px;
    font-weight: bold;
    padding: 3px 7px;
    border-radius: 50%;
    min-width: 20px;
    text-align: center;
    display: none;
}

.chatbot-badge.show {
    display: block;
    animation: bounce 0.5s ease;
}

@keyframes bounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

/* Ventana del chat */
.chatbot-window {
    position: fixed;
    bottom: 95px;
    left: 25px;
    width: 420px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
    z-index: 1001;
}

.chatbot-window.open {
    display: flex;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header del chat */
.chatbot-header {
    background: #128C7E;
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.chatbot-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chatbot-status {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 2px;
}

.chatbot-status.online::before {
    content: '●';
    color: #25D366;
    margin-right: 5px;
}

.chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Cuerpo del chat */
.chatbot-messages {
    flex: 1;
    padding: 20px 15px;
    overflow-y: auto;
    background: #e5ddd5;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="400" height="400" opacity="0.05"><rect fill="%23d9d9d9" width="400" height="400"/><circle fill="%23fff" cx="50" cy="50" r="30"/><circle fill="%23fff" cx="200" cy="150" r="40"/><circle fill="%23fff" cx="350" cy="250" r="35"/></svg>');
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* Mensaje del chat */
.chat-message {
    display: flex;
    gap: 6px;
    margin-bottom: 4px;
    animation: fadeIn 0.3s ease;
    max-width: 85%;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.bot {
    justify-content: flex-start;
    align-self: flex-start;
}

.chat-message.user {
    justify-content: flex-end;
    align-self: flex-end;
}

.chat-message.asesor {
    justify-content: flex-start;
    align-self: flex-start;
}

.chat-message.system {
    align-self: center;
    max-width: 100%;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #128C7E 0%, #075E54 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    align-self: flex-end;
    margin-bottom: 2px;
}

.chat-message.user .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.chat-message.asesor .message-avatar {
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
    font-size: 14px;
}

.message-content {
    padding: 8px 12px;
    border-radius: 7.5px;
    word-wrap: break-word;
    white-space: pre-wrap;
    box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
    line-height: 1.4;
    font-size: 14.2px;
    position: relative;
    min-width: 60px;
}

.chat-message.bot .message-content {
    background: #ffffff;
    color: #303030;
    border-bottom-left-radius: 0;
}

.chat-message.asesor .message-content {
    background: #ffffff;
    color: #1565c0;
    border-bottom-left-radius: 0;
    border-left: 3px solid #1565c0;
}

.chat-message.user .message-content {
    background: #dcf8c6;
    color: #303030;
    border-bottom-right-radius: 0;
}

.chat-message.system .message-content {
    background: #fffbdd;
    color: #54656f;
    text-align: center;
    font-size: 13px;
    padding: 6px 12px;
    box-shadow: none;
    border-radius: 7.5px;
}

.message-time {
    font-size: 11px;
    color: #667781;
    margin-left: 8px;
    display: inline-block;
    vertical-align: bottom;
    float: right;
    margin-top: 4px;
}

.chat-message.user .message-time {
    color: #667781;
}

/* Indicador de escritura */
.typing-indicator {
    display: none;
    gap: 6px;
    padding: 10px 14px;
    background: white;
    border-radius: 7.5px;
    border-bottom-left-radius: 0;
    width: fit-content;
    box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
    align-self: flex-start;
    margin-left: 38px;
}

.typing-indicator.show {
    display: flex;
}

.typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #90949c;
    animation: typing 1.4s infinite;
}

background: #999;
animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.7;
    }

    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Input del chat */
.chatbot-input-container {
    padding: 25px;
    background: #f0f0f0;
    border-top: none;
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.chatbot-input {
    flex: 1;
    padding: 22px 26px;
    border: 2px solid #e0e0e0;
    border-radius: 30px;
    font-size: 20px;
    outline: none;
    background: white;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    resize: none;
    min-height: 90px;
    max-height: 250px;
    overflow-y: auto;
    line-height: 1.8;
    font-weight: 400;
}

.chatbot-input::placeholder {
    color: #999;
    font-size: 19px;
}

.chatbot-input:focus {
    outline: none;
    border-color: #128C7E;
    box-shadow: 0 0 0 3px rgba(18, 140, 126, 0.15);
}

.chatbot-send-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #128C7E;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    font-size: 20px;
}

.chatbot-send-btn:hover {
    background: #075E54;
    transform: scale(1.05);
}

.chatbot-send-btn:active {
    transform: scale(0.98);
}

.chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mensajes de estado */
.chat-status-message {
    text-align: center;
    padding: 12px;
    background: #fff3cd;
    color: #856404;
    border-radius: 8px;
    font-size: 13px;
    margin: 10px 0;
}

.chat-status-message.success {
    background: #d4edda;
    color: #155724;
}

/* Encuesta de satisfacción */
.encuesta-satisfaccion {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 24px;
    border-radius: 16px;
    margin: 16px 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border: 2px solid #1a7bb3;
    animation: fadeIn 0.4s ease;
}

.encuesta-title {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 16px;
    text-align: center;
}

.encuesta-estrellas {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.encuesta-estrellas i {
    font-size: 36px;
    color: #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.encuesta-estrellas i:hover {
    transform: scale(1.25) rotate(-5deg);
    filter: drop-shadow(0 4px 8px rgba(255, 215, 0, 0.4));
}

.encuesta-estrellas i.selected {
    color: #FFD700;
    animation: starPulse 0.4s ease;
}

@keyframes starPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

.encuesta-texto-rating {
    text-align: center;
    font-size: 16px;
    color: #7f8c8d;
    margin-bottom: 16px;
    min-height: 24px;
    font-weight: 500;
    transition: all 0.3s ease;
}

#comentarioSatisfaccion {
    width: 100%;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    margin-bottom: 12px;
}

#comentarioSatisfaccion:focus {
    outline: none;
    border-color: #1a7bb3;
}

.btn-enviar-calificacion {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #1a7bb3 0%, #0d4d73 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-enviar-calificacion:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 123, 179, 0.4);
}

.encuesta-gracias {
    text-align: center;
    padding: 24px;
}

.encuesta-gracias i {
    font-size: 48px;
    color: #25D366;
    margin-bottom: 12px;
}

.encuesta-gracias p {
    font-size: 16px;
    color: #2c3e50;
    font-weight: 600;
}

/* ==================== RESPONSIVE CHATBOT ==================== */

/* Tablets horizontales (1024px - 1199px) */
@media (max-width: 1199px) {
    .chatbot-window {
        width: 360px;
        height: 520px;
    }
}

/* Tablets verticales (768px - 1023px) */
@media (max-width: 1023px) {
    .chatbot-container {
        bottom: 25px;
        left: 25px;
    }

    .chatbot-window {
        width: 350px;
        height: 500px;
        bottom: 95px;
        left: 25px;
    }

    .chatbot-button {
        width: 55px;
        height: 55px;
    }

    .chatbot-button i {
        font-size: 26px;
    }
}

/* Móviles grandes y tablets pequeñas (600px - 767px) */
@media (max-width: 767px) {
    .chatbot-container {
        bottom: 25px;
        left: 20px;
    }

    .chatbot-button {
        width: 52px;
        height: 52px;
        box-shadow: 0 3px 15px rgba(26, 123, 179, 0.4);
    }

    .chatbot-button i {
        font-size: 24px;
    }

    .chatbot-window {
        width: calc(100vw - 40px);
        height: 450px;
        left: 20px;
        bottom: 90px;
        border-radius: 20px;
    }

    .chatbot-header {
        padding: 16px;
    }

    .chatbot-header-info {
        gap: 10px;
    }

    .chatbot-avatar {
        width: 40px;
        height: 40px;
        font-size: 22px;
    }

    .chatbot-title h3 {
        font-size: 15px;
    }

    .chatbot-status {
        font-size: 11px;
    }

    .chatbot-messages {
        padding: 15px 12px;
        gap: 14px;
    }

    .message-content {
        max-width: 80%;
        padding: 12px 16px;
        font-size: 13px;
    }

    .message-avatar {
        width: 34px;
        height: 34px;
        font-size: 15px;
    }

    .chatbot-input-container {
        padding: 12px;
    }

    .chatbot-input {
        padding: 11px 14px;
        font-size: 13px;
    }

    .chatbot-send-btn {
        width: 40px;
        height: 40px;
    }

    .encuesta-satisfaccion {
        padding: 20px;
        margin: 14px 0;
    }

    .encuesta-title {
        font-size: 15px;
        margin-bottom: 14px;
    }

    .encuesta-estrellas i {
        font-size: 28px;
        gap: 10px;
    }
}

/* Móviles estándar (480px - 599px) */
@media (max-width: 599px) {
    .chatbot-container {
        bottom: 25px;
        left: 15px;
    }

    .chatbot-button {
        width: 50px;
        height: 50px;
    }

    .chatbot-button i {
        font-size: 22px;
    }

    .chatbot-window {
        width: calc(100vw - 30px);
        height: 420px;
        left: 15px;
        bottom: 85px;
        border-radius: 18px;
    }

    .chatbot-header {
        padding: 14px;
    }

    .chatbot-avatar {
        width: 38px;
        height: 38px;
        font-size: 20px;
    }

    .chatbot-title h3 {
        font-size: 14px;
    }

    .chatbot-messages {
        padding: 12px 10px;
        gap: 12px;
    }

    .message-content {
        padding: 11px 14px;
        font-size: 13px;
        border-radius: 16px;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .encuesta-estrellas i {
        font-size: 26px;
    }
}

/* Móviles pequeños (375px - 479px) */
@media (max-width: 479px) {
    .chatbot-container {
        bottom: 25px;
        left: 15px;
    }

    .chatbot-button {
        width: 52px;
        height: 52px;
        box-shadow: 0 4px 20px rgba(26, 123, 179, 0.5);
    }

    .chatbot-button i {
        font-size: 24px;
    }

    .chatbot-window {
        width: calc(100vw - 30px);
        height: 400px;
        left: 15px;
        bottom: 85px;
        border-radius: 16px;
        position: fixed;
    }

    .chatbot-header {
        padding: 16px 15px;
    }

    .chatbot-avatar {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .chatbot-title h3 {
        font-size: 15px;
    }

    .chatbot-status {
        font-size: 11px;
    }

    .chatbot-close {
        font-size: 22px;
    }

    .chatbot-messages {
        padding: 15px 12px;
    }

    .message-content {
        max-width: 85%;
        padding: 12px 15px;
        font-size: 14px;
    }

    .message-avatar {
        width: 34px;
        height: 34px;
    }

    .chatbot-input-container {
        padding: 12px;
        gap: 8px;
    }

    .chatbot-input {
        padding: 12px 15px;
        font-size: 14px;
    }

    .chatbot-send-btn {
        width: 42px;
        height: 42px;
    }

    .encuesta-satisfaccion {
        padding: 18px;
    }

    .encuesta-title {
        font-size: 15px;
    }

    .encuesta-estrellas {
        gap: 8px;
    }

    .encuesta-estrellas i {
        font-size: 28px;
    }
}

/* Móviles muy pequeños (menos de 375px) */
@media (max-width: 374px) {
    .chatbot-container {
        bottom: 22px;
        left: 12px;
    }

    .chatbot-button {
        width: 48px;
        height: 48px;
    }

    .chatbot-button i {
        font-size: 22px;
    }

    .chatbot-window {
        width: calc(100vw - 24px);
        height: 380px;
        left: 12px;
        bottom: 80px;
    }

    .chatbot-window {
        width: calc(100vw - 24px);
        height: 420px;
        right: 12px;
        bottom: 75px;
    }

    .chatbot-button i {
        font-size: 24px;
    }

    .chatbot-header {
        padding: 14px 12px;
    }

    .chatbot-avatar {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .chatbot-title h3 {
        font-size: 14px;
    }

    .chatbot-status {
        font-size: 10px;
    }

    .chatbot-messages {
        padding: 12px 10px;
    }

    .message-content {
        padding: 10px 13px;
        font-size: 13px;
    }

    .message-avatar {
        width: 30px;
        height: 30px;
        font-size: 13px;
    }

    .chatbot-input-container {
        padding: 10px;
    }

    .chatbot-input {
        padding: 10px 13px;
        font-size: 13px;
    }

    .chatbot-send-btn {
        width: 38px;
        height: 38px;
    }

    .encuesta-estrellas i {
        font-size: 24px;
    }
}