/**
 * Diagram-Amposta Chatbot - Estilos principales
 *
 * Estos estilos definen la apariencia del chatbot
 * Diseño adaptado del sitio de Diagram-Amposta
 */

/* Contenedor principal del chatbot */
.diagram-amposta-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 */
.diagram-amposta-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;
}

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

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

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

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

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

/* Ventana principal del chatbot */
.diagram-amposta-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;
}

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

/* Cabecera del chatbot */
.diagram-amposta-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;
}

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

.diagram-amposta-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;
}

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

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

/* Estilos para mensajes */
.diagram-amposta-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); }
}

.diagram-amposta-chatbot-message.bot {
    float: left;
}

.diagram-amposta-chatbot-message.user {
    float: right;
}

.diagram-amposta-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;
}

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

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

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

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

/* Indicador de escritura */
.diagram-amposta-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;
}

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

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

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

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

.diagram-amposta-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 */
.diagram-amposta-chatbot-footer {
    background-color: white;
    padding: 14px 16px;
    border-top: 1px solid #E5E7EB;
    display: flex;
    align-items: flex-end;
}

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

.diagram-amposta-chatbot-input {
    width: 100%;
    resize: none;
    padding: 12px 16px;
    padding-right: calc(50px + 17px);
    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;
}

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

.diagram-amposta-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;
}

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

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

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

/* Selección de zona */
.diagram-amposta-chatbot-zone-selection {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-color: #F9FAFB;
    min-height: 300px;
}

.diagram-amposta-chatbot-zone-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.diagram-amposta-chatbot-zone-loader p {
    margin: 0;
    color: #6B7280;
    font-size: 14px;
}

.diagram-amposta-chatbot-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #E5E7EB;
    border-top-color: #3B82F6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.diagram-amposta-chatbot-zones-list {
    width: 100%;
    max-width: 100%;
}

.diagram-amposta-chatbot-zones-list h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    text-align: center;
}

.diagram-amposta-chatbot-zones-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.diagram-amposta-chatbot-zone-item {
    background-color: white;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-size: 14px;
    color: #111827;
    font-weight: 500;
}

.diagram-amposta-chatbot-zone-item:hover {
    border-color: #3B82F6;
    background-color: #EFF6FF;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.1);
}

.diagram-amposta-chatbot-zone-item:active {
    transform: translateY(0);
}

/* Ocultar mensajes cuando se muestra selección de zona */
.diagram-amposta-chatbot-zone-selection:not([style*="display: none"]) ~ .diagram-amposta-chatbot-messages-container {
    display: none !important;
}

.diagram-amposta-chatbot-zone-selection:not([style*="display: none"]) ~ .diagram-amposta-chatbot-footer {
    display: none !important;
}

@media (max-width: 768px) {
    .diagram-amposta-chatbot-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 100px);
        max-height: 680px;
    }
    
    .diagram-amposta-chatbot-message {
        max-width: 90%;
    }
    
    .diagram-amposta-chatbot-zone-selection {
        padding: 16px;
        min-height: 250px;
    }
    
    .diagram-amposta-chatbot-zones-container {
        max-height: 300px;
    }
}

@media (max-width: 480px) {
    .diagram-amposta-chatbot-window {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 10px;
        height: calc(100vh - 80px);
    }
    
    .diagram-amposta-chatbot-zone-selection {
        padding: 12px;
        min-height: 200px;
    }
    
    .diagram-amposta-chatbot-zones-container {
        max-height: 250px;
    }
}

/* Accesibilidad */
.diagram-amposta-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;
}

