/* Variables CSS */
:root {
    --chatbot-primary-color: #010101;
    --chatbot-primary-hover: #c82333;
}

.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 450px;
    height: 650px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: all 0.3s ease;
    resize: both;
    overflow: hidden;
    min-width: 450px;
    min-height: 650px;
}

.chatbot-container.minimized {
    right: 20px !important;
    bottom: 0 !important;
    left: auto !important;
    top: auto !important;
    width: 450px !important;
    height: 54px !important;
    min-width: 450px !important;
    min-height: 54px !important;
    max-width: 450px !important;
    max-height: 54px !important;
    border-radius: 10px 10px 0 0;
    resize: none !important;
}

.chatbot-container.minimized .chatbot-interface > *:not(.chatbot-header),
.chatbot-container.minimized .chatbot-welcome-screen > *:not(.chatbot-header) {
    display: none;
}

.chatbot-header {
    padding: 15px;
    background: var(--chatbot-primary-color);
    color: white;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    z-index: 10;
    flex-shrink: 0;
}

.chatbot-container.minimized .chatbot-header {
    border-radius: 10px 10px 0 0;
}

.chatbot-header-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chatbot-minimize-button,
.chatbot-close-button {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.chatbot-minimize-button:hover,
.chatbot-close-button:hover {
    opacity: 1;
    text-decoration: none;
}

.chatbot-header span {
    font-size: 16px;
    font-weight: 500;
}

.chatbot-interface {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.chatbot-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    max-height: calc(100% - 150px);
    margin-bottom: 90px;
    padding-bottom: 120px;
}

.message {
    margin: 8px;
    padding: 10px 15px;
    border-radius: 15px;
    max-width: 338px;
    word-wrap: break-word;
    line-height: 1.4;
    font-size: 13px;
}

.user-message {
    background-color: #e9ecef;
    margin-left: auto;
    color: #212529;
}

.bot-message {
    background-color: var(--chatbot-primary-color);
    margin-right: auto;
    color: white;
}

/* Estilos para el texto formateado */
.message strong {
    font-weight: 600;
}

.message em {
    font-style: italic;
}

.message ol, .message ul {
    margin: 8px 0;
    padding-left: 20px;
}

.message li {
    margin: 4px 0;
}

.message br {
    margin: 4px 0;
}

.chatbot-input-container {
    position: absolute;
    bottom: 40px;
    left: 0;
    right: 0;
    padding: 15px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    z-index: 3;
}

.chatbot-input-container input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    outline: none;
    font-size: 13px;
    line-height: 1.4;
    color: #212529;
    font-family: inherit;
}

.chatbot-input-container input::placeholder {
    color: #6c757d;
    font-size: 13px;
}

.send-button {
    padding: 8px 15px;
    background: var(--chatbot-primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s ease;
    transition: all 0.2s ease;
}

.send-button:hover {
    background: var(--chatbot-primary-hover);
    transform: translateY(-1px);
    text-decoration: none;
}

/* Estilos para el spinner de carga */
.spinner-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.spinner {
    display: none;
}

.chatbot-welcome-screen {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.welcome-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    padding-bottom: 60px;
}

.chatbot-container.minimized .welcome-content,
.chatbot-container.minimized .chatbot-messages,
.chatbot-container.minimized .chatbot-input-container,
.chatbot-container.minimized .chatbot-powered-by,
.chatbot-container.minimized .chatbot-privacy-policy {
    display: none;
}

.chatbot-container.minimized .welcome-content {
    display: none !important;
    height: 0 !important;
    overflow: hidden !important;
}

.chatbot-welcome-image {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 20px;
    border: 3px solid var(--chatbot-primary-color);
}

.chatbot-welcome-text {
    font-size: 18px;
    color: #333;
    margin-bottom: 20px;
    line-height: 1.4;
    text-align: center;
    max-width: 400px;
}

.chatbot-start-button {
    padding: 10px 20px;
    background: var(--chatbot-primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}



.chatbot-start-button:hover {
    background: var(--chatbot-primary-hover);
    text-decoration: none;
    transform: translateY(-1px);
}

.chatbot-welcome-screen.hidden {
    display: none;
}

.chatbot-powered-by {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background: white;
    border-top: 1px solid #eee;
    text-align: center;
    font-size: 12px;
    color: #666;
    z-index: 2;
    
}

.chatbot-powered-by a {
    color: var(--chatbot-primary-color);
    text-decoration: none;
    font-weight: bold;
    transition: all 0.2s ease;
}

.chatbot-powered-by a:hover {
    text-decoration:underline;
}

.chatbot-privacy-policy {
    font-size: 12px;
    color: #666;
    text-align: center;
    margin: 10px 20px;
    line-height: 1.4;
    font-style: italic;
}

.chatbot-interface .chatbot-messages {
    padding-bottom: 100px;
}

.hidden {
    display: none !important;
}

/* Efecto de partículas al enviar */
@keyframes particle {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

.particle {
    position: fixed;
    pointer-events: none;
    width: 8px;
    height: 8px;
    background: #ffffff;
    border-radius: 50%;
    animation: particle 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
    z-index: 1001;
}

/* Estilo para el botón de enviar cuando está activo */
.send-button:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

.resize-indicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    background: var(--chatbot-primary-color);
    border-radius: 10px 0 10px 0;
    cursor: se-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.3s ease;
    z-index: 1002;
}

.resize-indicator:hover {
    opacity: 1;
}

.resize-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    border-left: 2px solid white;
    border-top: 2px solid white;
    transform: rotate(45deg);
    margin-top: 4px;
    margin-left: 4px;
}

.resize-indicator:hover::before {
    display: none;
}

.resize-indicator::after {
    content: '↔';
    position: absolute;
    color: white;
    font-size: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
    transform: rotate(45deg);
}

.resize-indicator:hover::after {
    opacity: 1;
}

/* Eliminar el indicador de redimensionamiento nativo */
.chatbot-container::-webkit-resizer {
    display: none;
}

/* Eliminar cualquier indicador de redimensionamiento adicional */
.chatbot-container::after,
.chatbot-container::before {
    display: none;
}

/* Asegurarnos de que el indicador no se muestre cuando el chat está minimizado */
.chatbot-container.minimized .resize-indicator {
    display: none;
}

.quick-options-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px 8px;
    max-width: 338px;
}

.quick-option-button {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 10px 15px;
    color: #212529;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-size: 13px;
    line-height: 1.4;
}

.quick-option-button:hover {
    background-color: #e9ecef;
    border-color: #ced4da;
    text-decoration: none;
    transform: translateY(-1px);
    
}

.quick-option-button:active {
    transform: translateY(0);
    background-color: #dee2e6;
}

.typing-indicator {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    margin: 10px;
    background: #f0f0f0;
    border-radius: 20px;
    width: fit-content;
    position: absolute;
    left: 10px;
    bottom: 130px;
    z-index: 4;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.typing-indicator.hidden {
    display: none;
}

.typing-dot {
    width: 8px;
    height: 8px;
    margin: 0 2px;
    background-color: #666;
    border-radius: 50%;
    animation: typing-animation 1.4s infinite ease-in-out;
}

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

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

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

@keyframes typing-animation {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* --- Responsive para móviles --- */
@media (max-width: 600px) {
    .chatbot-container {
        width: 100vw !important;
        min-width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh !important;
        min-height: 100vh !important;
        max-height: 100vh !important;
        right: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        top: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        position: fixed !important;
        z-index: 10000;
    }
    .chatbot-header {
        border-radius: 0 !important;
        font-size: 15px;
        padding: 12px;
    }
    .chatbot-messages {
        padding: 10px;
        max-height: calc(100% - 170px);
        margin-bottom: 80px;
        padding-bottom: 100px;
    }
    .chatbot-input-container {
        padding: 10px;
        bottom: 30px;
    }
    .chatbot-welcome-image {
        width: 90px;
        height: 90px;
        margin-bottom: 10px;
    }
    .welcome-content {
        padding: 10px;
    }
    .chatbot-welcome-text {
        font-size: 15px;
        max-width: 95vw;
    }
    .chatbot-powered-by {
        font-size: 11px;
        padding: 7px;
    }
    .resize-indicator {
        display: none !important;
    }
    .quick-options-container {
        max-width: 95vw;
        margin: 8px 2vw;
    }
    .message {
        max-width: 90vw;
        font-size: 12px;
        padding: 8px 10px;
    }
    .chatbot-container.minimized {
        width: 100vw !important;
        min-width: 100vw !important;
        max-width: 100vw !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        border-radius: 0 !important;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.10) !important;
        height: 54px !important;
        min-height: 54px !important;
        max-height: 54px !important;
        z-index: 10001;
        transition: all 0.3s cubic-bezier(.4,0,.2,1);
        position: fixed !important;
        resize: none !important;
    }
}