/* ============================================
   CHATBOT WIDGET STYLES
   Estilos para widget flotante y página dedicada
   ============================================ */

:root {
    --chatbot-primary: #d60da4;
    --chatbot-primary-dark: #b00a86;
    --chatbot-secondary: #f8f9fa;
    --chatbot-text: #333;
    --chatbot-text-light: #666;
    --chatbot-border: #e0e0e0;
    --chatbot-shadow: 0 4px 12px rgba(214, 13, 164, 0.4);
    --chatbot-shadow-heavy: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* ============================================
   WIDGET FLOTANTE
   ============================================ */

.chatbot-widget {
    position: fixed;
    bottom: 90px; /* Encima del botón de WhatsApp si existe */
    right: 20px;
    z-index: 999;
    font-family: "Afacad Flux", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Botón flotante del toggle */
.chatbot-toggle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--chatbot-shadow);
    transition: all 0.3s ease;
    position: relative;
    border: none;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(214, 13, 164, 0.6);
}

.chatbot-toggle i {
    color: white;
    font-size: 28px;
}

/* Badge de notificación */
.chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Ventana de chat flotante */
.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 16px;
    box-shadow: var(--chatbot-shadow-heavy);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.chatbot-window.active {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header de la ventana de chat */
.chatbot-window-header {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-dark) 100%);
    color: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chatbot-window-header .chatbot-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-window-header i {
    font-size: 24px;
}

.chatbot-window-header .chatbot-title-text h5 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chatbot-window-header .chatbot-title-text small {
    font-size: 12px;
    opacity: 0.9;
}

.chatbot-window-header .chatbot-actions button {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.chatbot-window-header .chatbot-actions button:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Body con mensajes */
.chatbot-window-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--chatbot-secondary);
}

/* Mensajes */
.chatbot-message {
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mensaje del usuario */
.user-message {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-message .message-content {
    background: var(--chatbot-primary);
    color: white;
    padding: 12px 16px;
    border-radius: 18px 18px 4px 18px;
    max-width: 75%;
    word-wrap: break-word;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Mensaje del bot */
.bot-message {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.bot-message .message-content {
    background: white;
    color: var(--chatbot-text);
    padding: 12px 16px;
    border-radius: 18px 18px 18px 4px;
    max-width: 75%;
    word-wrap: break-word;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin: 0 5px;
}

.message-time {
    font-size: 11px;
    color: var(--chatbot-text-light);
    margin: 4px 5px 0 5px;
}

/* Mensaje de error */
.error-message .message-content {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef5350;
}

/* Typing indicator */
.chatbot-typing {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.typing-indicator {
    background: white;
    padding: 12px 16px;
    border-radius: 18px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 4px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Footer con input */
.chatbot-window-footer {
    padding: 12px;
    background: white;
    border-top: 1px solid var(--chatbot-border);
    flex-shrink: 0;
}

.chatbot-window-footer .input-group {
    display: flex;
    gap: 8px;
}

.chatbot-window-footer input {
    flex: 1;
    border: 1px solid var(--chatbot-border);
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.chatbot-window-footer input:focus {
    border-color: var(--chatbot-primary);
    box-shadow: 0 0 0 3px rgba(214, 13, 164, 0.1);
}

.chatbot-window-footer button {
    background: var(--chatbot-primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chatbot-window-footer button:hover:not(:disabled) {
    background: var(--chatbot-primary-dark);
    transform: scale(1.05);
}

.chatbot-window-footer button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   PÁGINA COMPLETA DEL CHATBOT
   ============================================ */

.chatbot-page {
    padding: 40px 20px;
    min-height: calc(100vh - 200px);
    background: var(--chatbot-secondary);
}

.chatbot-card {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    /*max-width: 900px;
    margin: 0 auto;*/
    box-shadow: var(--chatbot-shadow-heavy);
}

/* Header de la página */
.chatbot-header {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-dark) 100%);
    color: white;
    padding: 20px;
}

.chatbot-avatar {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-avatar i {
    font-size: 28px;
}

/* Mensajes en página completa */
.chatbot-messages {
    height: 500px;
    overflow-y: auto;
    background: var(--chatbot-secondary);
    padding: 20px;
}

/* Input area */
.chatbot-input-area {
    padding: 20px;
    background: white;
    border-top: 1px solid var(--chatbot-border);
}

.chatbot-input-area form {
    display: flex;
    gap: 10px;
}

.chatbot-input-area input {
    flex: 1;
    padding: 12px 20px;
    border: 1px solid var(--chatbot-border);
    border-radius: 24px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.chatbot-input-area input:focus {
    border-color: var(--chatbot-primary);
    box-shadow: 0 0 0 3px rgba(214, 13, 164, 0.1);
}

.chatbot-input-area button[type="submit"] {
    background: var(--chatbot-primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chatbot-input-area button[type="submit"]:hover:not(:disabled) {
    background: var(--chatbot-primary-dark);
    transform: scale(1.05);
}

.chatbot-input-area button[type="submit"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Preguntas rápidas */
.quick-questions {
    margin-top: 12px;
}

.quick-questions small {
    color: var(--chatbot-text-light);
    font-size: 12px;
}

.quick-q {
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 16px;
    border: 1px solid var(--chatbot-border);
    background: white;
    color: var(--chatbot-text);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 6px;
    margin-right: 6px;
}

.quick-q:hover {
    background: var(--chatbot-primary);
    color: white;
    border-color: var(--chatbot-primary);
    transform: translateY(-2px);
}

/* Botones de calificación */
.rating-buttons {
    margin-top: 8px;
    margin-left: 5px;
    padding: 8px 0;
}

.rating-buttons small {
    display: block;
    font-size: 11px;
    margin-bottom: 4px;
    color: var(--chatbot-text-light);
}

.rating-stars {
    display: flex;
    gap: 4px;
}

.rating-star {
    background: transparent;
    border: none;
    color: #ccc;
    padding: 4px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s ease;
    outline: none;
}

.rating-star:hover {
    transform: scale(1.2);
}

.rating-star i.fas {
    color: #ffc107; /* Dorado para estrellas llenas */
}

.rating-star i.far {
    color: #ccc; /* Gris para estrellas vacías */
}

.rating-buttons.rated .rating-star {
    cursor: default;
    pointer-events: none;
}

.rating-buttons.rated small.text-success {
    color: #28a745 !important;
    font-weight: 500;
}

/* ============================================
   SCROLLBAR PERSONALIZADO
   ============================================ */

.chatbot-window-body::-webkit-scrollbar,
.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-window-body::-webkit-scrollbar-track,
.chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chatbot-window-body::-webkit-scrollbar-thumb,
.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--chatbot-primary);
    border-radius: 3px;
}

.chatbot-window-body::-webkit-scrollbar-thumb:hover,
.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: var(--chatbot-primary-dark);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .chatbot-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 160px);
        bottom: 70px;
        right: 20px;
        position: sticky;
        z-index: 9999 !important;
    }

    .chatbot-toggle {
        width: 56px;
        height: 56px;
        bottom: 80px;
    }

    .chatbot-toggle i {
        font-size: 26px;
    }

    .chatbot-page {
        padding: 0px 0px;
    }

    .chatbot-messages {
        height: 400px;
    }

    .chatbot-input-area input {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 160px);
        bottom: 10px;
        right: 10px;
        border-radius: 12px;
        position: sticky;
        z-index: 9999 !important;
    }

    .chatbot-widget {
        bottom: 70px;
        right: 10px;
    }

    .chatbot-toggle {
        bottom: 10px;
    }

    .user-message .message-content,
    .bot-message .message-content {
        max-width: 85%;
        font-size: 14px;
        padding: 10px 14px;
    }

    .quick-q {
        font-size: 11px;
        padding: 5px 10px;
    }
}

/* ============================================
   UTILIDADES
   ============================================ */

.chatbot-hidden {
    display: none !important;
}

.chatbot-disabled {
    opacity: 0.5;
    pointer-events: none;
}

.chatbot-loading {
    opacity: 0.7;
}

/* Fade animations */
.fade-in {
    animation: fadeIn 0.3s ease;
}

.fade-out {
    animation: fadeOut 0.3s ease;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Slide animations */
.slide-up {
    animation: slideUp 0.3s ease;
}

.slide-down {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
