/**
 * TIC Place Chatbot - Estilos principales
 *
 * Estos estilos definen la apariencia del chatbot en el frontend de WordPress
 * Diseño adaptado del frontend de TIC PLACE
 */

/* Contenedor principal del chatbot */
.ticplace-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.5;
    color: #111827;
    box-sizing: border-box;
    display: block !important;
    visibility: visible !important;
}

/* Botón de activación del chatbot */
.ticplace-chatbot-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #3B82F6;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    border: none;
    outline: none;
    transition: transform 0.3s ease, background-color 0.3s ease;
    z-index: 1001;
}

.ticplace-chatbot-toggle:hover {
    background-color: #2563EB;
    transform: scale(1.05);
}

.ticplace-chatbot-toggle:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.4);
}

.ticplace-chatbot-toggle-active {
    background-color: #2563EB;
}

.ticplace-chatbot-toggle-active:hover {
    background-color: #1D4ED8;
}

.ticplace-chatbot-toggle i,
.ticplace-chatbot-toggle svg {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

/* Ventana principal del chatbot */
.ticplace-chatbot-window {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 420px;
    height: 680px;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.9);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    z-index: 1000;
}

.ticplace-chatbot-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Cabecera del chatbot */
.ticplace-chatbot-header {
    background-color: #3B82F6;
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.ticplace-chatbot-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.ticplace-chatbot-close {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    outline: none;
    transition: transform 0.2s ease;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.ticplace-chatbot-close:hover {
    background-color: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

/* Contenedor de mensajes */
.ticplace-chatbot-messages-container {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background-color: #F9FAFB;
    scroll-behavior: smooth;
    min-height: 500px;
}

/* Estilos para mensajes */
.ticplace-chatbot-message {
    margin-bottom: 16px;
    max-width: 85%;
    clear: both;
    position: relative;
    animation: fadeIn 0.3s ease;
}

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

.ticplace-chatbot-message.bot {
    float: left;
}

.ticplace-chatbot-message.user {
    float: right;
}

.ticplace-chatbot-message-content {
    padding: 12px 16px;
    border-radius: 16px;
    margin: 0 0 4px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    word-wrap: break-word;
    white-space: pre-wrap;
    font-size: 14px;
}

.ticplace-chatbot-message.bot .ticplace-chatbot-message-content {
    background-color: white;
    border-bottom-left-radius: 6px;
    color: #111827;
}

.ticplace-chatbot-message.user .ticplace-chatbot-message-content {
    background-color: #3B82F6;
    color: white;
    border-bottom-right-radius: 6px;
}

.ticplace-chatbot-message-sender {
    font-size: 12px;
    color: #6B7280;
    margin-left: 6px;
    margin-top: 2px;
}

.ticplace-chatbot-message.user .ticplace-chatbot-message-sender {
    text-align: right;
    margin-right: 6px;
}

/* Indicador de escritura */
.ticplace-chatbot-typing {
    display: none;
    margin-bottom: 16px;
    clear: both;
    padding: 12px 16px;
    background-color: white;
    border-radius: 16px;
    border-bottom-left-radius: 6px;
    max-width: 65px;
    animation: fadeIn 0.3s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    float: left;
}

.ticplace-chatbot-typing-dots {
    display: flex;
    align-items: center;
    height: 16px;
}

.ticplace-chatbot-dot {
    height: 8px;
    width: 8px;
    margin-right: 4px;
    border-radius: 50%;
    background-color: #9CA3AF;
    animation: typingAnimation 1.5s infinite ease-in-out;
}

.ticplace-chatbot-dot:nth-child(1) {
    animation-delay: 0s;
}

.ticplace-chatbot-dot:nth-child(2) {
    animation-delay: 0.3s;
}

.ticplace-chatbot-dot:nth-child(3) {
    animation-delay: 0.6s;
    margin-right: 0;
}

@keyframes typingAnimation {
    0% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0); }
}

/* Área de entrada de mensajes */
.ticplace-chatbot-footer {
    background-color: white;
    padding: 14px 16px;
    border-top: 1px solid #E5E7EB;
    display: flex;
    align-items: flex-end;
}

.ticplace-chatbot-input-wrapper {
    flex: 1;
    position: relative;
}

.ticplace-chatbot-input {
    width: 100%;
    resize: none;
    padding: 12px 16px;
    padding-right: 50px;
    border: 1px solid #E5E7EB;
    border-radius: 24px;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    max-height: 150px;
    min-height: 46px;
    transition: border-color 0.3s;
    background-color: #F9FAFB;
    color: #111827;
}

.ticplace-chatbot-input:focus {
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    background-color: white;
}

.ticplace-chatbot-send {
    background-color: #3B82F6;
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    position: absolute;
    right: 6px;
    bottom: 11px;
    outline: none;
}

.ticplace-chatbot-send:hover {
    background-color: #2563EB;
}

.ticplace-chatbot-send:disabled {
    background-color: #9CA3AF;
    cursor: not-allowed;
}

.ticplace-chatbot-messages-container::after {
    content: "";
    display: table;
    clear: both;
}

@media (max-width: 768px) {
    .ticplace-chatbot-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 100px);
        max-height: 680px;
    }
    
    .ticplace-chatbot-message {
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    .ticplace-chatbot-window {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 10px;
        height: calc(100vh - 80px);
    }
}

/* Accesibilidad */
.ticplace-chatbot-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
} 