/* ================================================
   CHATBOT SANTOS - ESTILOS DEL WIDGET
   ================================================ */

/* -------------------- Variables del Chatbot -------------------- */
.chatbot-container {
    --chat-primary: #e14700;
    --chat-secondary: #6f0505;
    --chat-accent: #22d3ee;
    --chat-bg: var(--color-bg-secondary);
    --chat-surface: var(--color-surface);
    --chat-border: var(--color-border);
    --chat-text: var(--color-text);
    --chat-text-secondary: var(--color-text-secondary);
}

/* -------------------- Botón Flotante -------------------- */
.chatbot-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-secondary));
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(225, 71, 0, 0.4);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(225, 71, 0, 0.6);
}

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

.chatbot-button svg {
    width: 28px;
    height: 28px;
    color: white;
    transition: all 0.3s ease;
}

.chatbot-button.active svg.chat-icon {
    transform: rotate(180deg) scale(0);
    opacity: 0;
}

.chatbot-button svg.close-icon {
    position: absolute;
    transform: rotate(-180deg) scale(0);
    opacity: 0;
}

.chatbot-button.active svg.close-icon {
    transform: rotate(0deg) scale(1);
    opacity: 1;
}

/* Badge de notificación */
.chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: var(--chat-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: #0a0a0f;
    animation: pulse 2s infinite;
}

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

/* -------------------- Ventana del Chat -------------------- */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 400px;
    height: 600px;
    max-height: calc(100vh - 140px);
    background: var(--chat-bg);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    z-index: 998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid var(--chat-border);
}

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

/* -------------------- Header del Chat -------------------- */
.chatbot-header {
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-secondary));
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chatbot-avatar {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.chatbot-info {
    flex: 1;
}

.chatbot-name {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: white;
    margin: 0;
}

.chatbot-status {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

/* -------------------- Cuerpo del Chat -------------------- */
.chatbot-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: var(--chat-bg);
}

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

.chatbot-body::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-body::-webkit-scrollbar-thumb {
    background: var(--chat-border);
    border-radius: 10px;
}

.chatbot-body::-webkit-scrollbar-thumb:hover {
    background: var(--color-border-hover);
}

/* -------------------- Mensajes -------------------- */
.chat-message {
    display: flex;
    gap: 10px;
    animation: messageSlideIn 0.3s ease-out;
}

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

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.message-avatar.bot {
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-secondary));
    color: white;
}

.message-avatar.user {
    background: var(--chat-surface);
    color: var(--chat-text);
    border: 2px solid var(--chat-border);
}

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

.message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-message.bot .message-bubble {
    background: var(--chat-surface);
    color: var(--chat-text);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--chat-border);
}

.chat-message.user .message-bubble {
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-secondary));
    color: white;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: var(--chat-text-secondary);
    margin-top: 4px;
    padding: 0 4px;
}

.chat-message.user .message-time {
    text-align: right;
}

/* -------------------- Mensaje de Escritura -------------------- */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--chat-text-secondary);
    border-radius: 50%;
    animation: typingAnimation 1.4s infinite;
}

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

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

@keyframes typingAnimation {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* -------------------- Sugerencias Rápidas -------------------- */
.quick-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.quick-suggestion {
    background: var(--chat-surface);
    border: 1px solid var(--chat-border);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--chat-text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-suggestion:hover {
    background: var(--chat-primary);
    border-color: var(--chat-primary);
    color: white;
    transform: translateY(-2px);
}

/* -------------------- Input del Chat -------------------- */
.chatbot-footer {
    padding: 16px 20px;
    background: var(--chat-surface);
    border-top: 1px solid var(--chat-border);
}

.chat-input-container {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    background: var(--chat-bg);
    border: 1px solid var(--chat-border);
    border-radius: 24px;
    padding: 12px 16px;
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--chat-text);
    resize: none;
    max-height: 120px;
    transition: all 0.2s ease;
}

.chat-input:focus {
    outline: none;
    border-color: var(--chat-primary);
}

.chat-input::placeholder {
    color: var(--chat-text-secondary);
}

.chat-send-button {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-secondary));
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chat-send-button:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(225, 71, 0, 0.4);
}

.chat-send-button:active:not(:disabled) {
    transform: scale(0.95);
}

.chat-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-send-button svg {
    width: 20px;
    height: 20px;
    color: white;
}

/* -------------------- Mensaje de Bienvenida -------------------- */
.welcome-message {
    text-align: center;
    padding: 20px;
    color: var(--chat-text-secondary);
}

.welcome-message h3 {
    font-family: var(--font-display);
    font-size: 18px;
    color: var(--chat-text);
    margin-bottom: 10px;
}

.welcome-message p {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 8px;
}

.welcome-message .help-text {
    margin-top: 15px;
    font-weight: 500;
    color: var(--chat-text);
}

/* -------------------- Aviso de Privacidad en Chatbot -------------------- */
.privacy-notice {
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-left: 3px solid #eab308;
    border-radius: 8px;
    padding: 12px;
    margin: 15px 0;
    text-align: left;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.privacy-icon {
    font-size: 20px;
    line-height: 1;
    margin: 0;
    flex-shrink: 0;
}

.privacy-text {
    flex: 1;
}

.privacy-text p {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: var(--chat-text);
}

.privacy-text strong {
    color: var(--chat-text);
    font-weight: 600;
}

.privacy-text ul {
    margin: 8px 0 8px 20px;
    padding: 0;
    font-size: 12px;
    color: var(--chat-text-secondary);
}

.privacy-text li {
    margin-bottom: 4px;
    line-height: 1.4;
}

.privacy-link {
    font-size: 11px !important;
    margin: 8px 0 0 0 !important;
    color: var(--chat-text-secondary) !important;
}

.privacy-link a {
    color: var(--chat-primary);
    text-decoration: underline;
    font-weight: 500;
}

.privacy-link a:hover {
    color: var(--chat-secondary);
}

/* -------------------- Responsive -------------------- */
@media (max-width: 768px) {
    .chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 120px);
        right: 10px;
        bottom: 80px;
        border-radius: 16px;
    }

    .chatbot-button {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
    }

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

/* -------------------- Enlaces en mensajes -------------------- */
.message-bubble a {
    color: var(--chat-accent);
    text-decoration: underline;
}

.message-bubble a:hover {
    color: var(--chat-primary);
}

/* -------------------- Estados de carga -------------------- */
.chat-send-button .loading-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
