/**
 * PAS Bot Asistente - Chat Widget Styles
 * 
 * Diseño institucional, elegante, con degradado azul FUNDIVEL.
 * Carga ligera y responsive.
 * 
 * @version 1.0.0
 */

/* =============================================
   CONTENEDOR PRINCIPAL
   ============================================= */
#pas-bot-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1a202c;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    z-index: 999999;
}

/* =============================================
   BOTÓN FLOTANTE
   ============================================= */
.pas-bot-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a3a5c 0%, #2563eb 100%);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(26, 58, 92, 0.35);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000000;
    padding: 0;
    outline: none;
}

.pas-bot-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(26, 58, 92, 0.45);
}

.pas-bot-toggle:active {
    transform: scale(0.95);
}

.pas-bot-toggle--active {
    box-shadow: 0 2px 12px rgba(26, 58, 92, 0.25);
}

/* Badge de notificación */
.pas-bot-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
    animation: pas-bot-pulse 2s infinite;
}

@keyframes pas-bot-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* =============================================
   VENTANA DE CHAT
   ============================================= */
.pas-bot-chat {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 580px;
    max-height: calc(100vh - 140px);
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999999;
    overflow: hidden;
}

.pas-bot-chat--open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

/* Cuando el chat está abierto, el botón flotante queda detrás del chat */
.pas-bot-chat--open ~ .pas-bot-toggle {
    z-index: 1;
    pointer-events: none;
    opacity: 0;
}

/* =============================================
   HEADER
   ============================================= */
.pas-bot-header {
    background: linear-gradient(135deg, #1a3a5c 0%, #2563eb 100%);
    color: #ffffff;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.pas-bot-header::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 50%;
    pointer-events: none;
}

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

.pas-bot-header-avatar {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    flex-shrink: 0;
}

.pas-bot-header-text {
    display: flex;
    flex-direction: column;
}

.pas-bot-header-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.pas-bot-header-subtitle {
    font-size: 11px;
    opacity: 0.75;
    font-weight: 400;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.pas-bot-header-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    font-size: 22px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    transition: background 0.2s;
    position: relative;
    z-index: 1;
}

.pas-bot-header-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* =============================================
   ÁREA DE MENSAJES
   ============================================= */
.pas-bot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8fafc;
    scroll-behavior: smooth;
}

.pas-bot-messages::-webkit-scrollbar {
    width: 4px;
}

.pas-bot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.pas-bot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

/* =============================================
   BURBUJAS DE MENSAJE
   ============================================= */
.pas-bot-message {
    display: flex;
    animation: pas-bot-fadeIn 0.3s ease;
}

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

.pas-bot-message--user {
    justify-content: flex-end;
}

.pas-bot-message--bot {
    justify-content: flex-start;
}

.pas-bot-message-text {
    max-width: 85%;
    padding: 11px 15px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.55;
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* Mensaje del usuario */
.pas-bot-message--user .pas-bot-message-text {
    background: linear-gradient(135deg, #1a3a5c 0%, #2563eb 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

/* Mensaje del bot */
.pas-bot-message--bot .pas-bot-message-text {
    background: #ffffff;
    color: #1a202c;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

/* Enlaces dentro de mensajes */
.pas-bot-message--bot .pas-bot-message-text a {
    color: #2563eb;
    text-decoration: underline;
    word-break: break-all;
}

.pas-bot-message--bot .pas-bot-message-text a:hover {
    color: #1d4ed8;
}

/* Negritas e itálicas */
.pas-bot-message--bot .pas-bot-message-text strong {
    color: #1a3a5c;
}

/* =============================================
   INDICADOR DE ESCRITURA (typing)
   ============================================= */
.pas-bot-typing {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 11px 15px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.pas-bot-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    display: inline-block;
    animation: pas-bot-typing 1.4s infinite ease-in-out both;
}

.pas-bot-typing span:nth-child(1) { animation-delay: 0s; }
.pas-bot-typing span:nth-child(2) { animation-delay: 0.16s; }
.pas-bot-typing span:nth-child(3) { animation-delay: 0.32s; }

@keyframes pas-bot-typing {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* =============================================
   FOOTER / INPUT
   ============================================= */
.pas-bot-footer {
    border-top: 1px solid #e2e8f0;
    padding: 12px 16px;
    background: #ffffff;
    flex-shrink: 0;
}

.pas-bot-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    border-radius: 12px;
    padding: 4px;
    border: 1.5px solid transparent;
    transition: border-color 0.2s;
}

.pas-bot-input-wrapper:focus-within {
    border-color: #2563eb;
    background: #ffffff;
}

.pas-bot-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 10px;
    font-size: 13.5px;
    color: #1a202c;
    outline: none;
    font-family: inherit;
    line-height: 1.4;
}

.pas-bot-input::placeholder {
    color: #94a3b8;
}

.pas-bot-send {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #1a3a5c 0%, #2563eb 100%);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    padding: 0;
}

.pas-bot-send:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.pas-bot-send:active {
    transform: scale(0.95);
}

.pas-bot-footer-brand {
    text-align: center;
    margin-top: 8px;
}

.pas-bot-footer-brand span {
    font-size: 9.5px;
    color: #94a3b8;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-weight: 500;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 480px) {
    .pas-bot-toggle {
        bottom: 16px;
        right: 16px;
        width: 54px;
        height: 54px;
    }

    /* En móvil, ocultar el botón flotante cuando el chat está abierto
       (el header ya tiene su propio botón × de cierre) */
    .pas-bot-container--chat-open .pas-bot-toggle {
        display: none;
    }

    .pas-bot-chat {
        bottom: 0;
        right: 0;
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border: none;
        transform: translateY(30px);
    }

    .pas-bot-chat--open {
        transform: translateY(0);
    }

    .pas-bot-header {
        padding: 14px 16px;
        border-radius: 0;
    }

    .pas-bot-messages {
        padding: 12px 14px;
    }

    .pas-bot-footer {
        padding: 10px 12px;
    }
}

    .pas-bot-footer {
        padding: 10px 12px;
    }
}
        padding: 12px 14px;
    }

    .pas-bot-footer {
        padding: 10px 12px;
    }
}

/* =============================================
   OCULTAR TOGGLE FLOTANTE CUANDO EL CHAT ESTÁ ABIERTO
   El header ya tiene su propio botón de cerrar (×).
   ============================================= */
.pas-bot-container--chat-open .pas-bot-toggle {
    display: none;
}

/* =============================================
   ANIMACIONES ADICIONALES
   ============================================= */
@keyframes pas-bot-slideUp {
    from { transform: translateY(10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.pas-bot-chat--open .pas-bot-header {
    animation: pas-bot-slideUp 0.3s ease;
}
