/* Integrida Life AI Chatbot Widget Styles */
:root {
    --primary-color: #2D5A3D;
    --secondary-color: #FF6B6B;
    --white: #FFFFFF;
    --light-gray: #F5F5F7;
    --medium-gray: #8E8E93;
    --dark-gray: #2C2C2C;
    --text-black: #1A1A1A;
    --border-radius: 12px;
    --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Reset y base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-black);
    overflow: hidden;
}

/* Contenedor principal del chatbot */
.chatbot-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 300px;
    max-height: 100vh;
}

/* Ventana del chat */
.chat-window {
    position: relative;
    width: 100%;
    height: 100%;
    background: var(--white);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header del chat */
.chat-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e3a28 100%);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    color: white;
    min-height: 75px;
}

.chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    flex-shrink: 0;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.chat-title h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
    color: white;
}

.chat-title p {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8)!important;
    font-weight: 400;
}

/* Área de mensajes */
.chat-messages {
    flex: 1;
    padding: 10px 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--white);
    min-height: 220px;
}

/* Mensajes individuales */
.message {
    display: flex;
    gap: 10px;
    max-width: 85%;
    align-items: flex-start;
}

.bot-message {
    align-self: flex-start;
    flex-direction: row;
}

.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e3a28 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 2px solid var(--white);
    box-shadow: var(--shadow-light);
}

.message-avatar svg {
    width: 22px;
    height: 22px;
    fill: white;
}

.message-content {
    background: var(--light-gray);
    padding: 10px 12px;
    border-radius: 20px 20px 20px 6px;
    max-width: min(400px, calc(100vw - 120px));
    word-wrap: break-word;
    position: relative;
}

.user-message .message-content {
    background: var(--primary-color);
    color: white;
    border-radius: 18px 18px 4px 18px;
}

.message-content p {
    font-size: 14px;
    line-height: 1.4;
    margin: 0;
}

/* Estilos para formato markdown en mensajes */
.message-content strong {
    font-weight: 700;
    color: inherit;
}

.message-content em {
    font-style: italic;
}

.message-content code {
    background: rgba(0, 0, 0, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
}

.user-message .message-content code {
    background: rgba(255, 255, 255, 0.25);
}

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

.message-content ul {
    list-style-type: disc;
}

.message-content ol {
    list-style-type: decimal;
}

.message-content li {
    margin: 3px 0;
    line-height: 1.5;
}

.message-content a {
    color: var(--primary-color);
    text-decoration: underline;
    transition: opacity 0.2s ease;
}

.message-content a:hover {
    opacity: 0.8;
}

.user-message .message-content a {
    color: white;
    text-decoration: underline;
}

.message-content h1,
.message-content h2,
.message-content h3 {
    margin: 8px 0 4px 0;
    font-weight: 700;
    line-height: 1.3;
}

.message-content h1 {
    font-size: 18px;
}

.message-content h2 {
    font-size: 16px;
}

.message-content h3 {
    font-size: 14px;
}

.message-content br {
    display: block;
    content: "";
    margin: 4px 0;
}

/* Powered by EnsambleAI */
.powered-by-container {
    padding: 4px 12px 2px;
    background: var(--white);
    text-align: center;
    flex-shrink: 0;
}

.powered-by-link {
    font-size: 11px;
    color: var(--medium-gray);
    text-decoration: none;
    transition: color 0.2s ease;
    font-weight: 500;
    letter-spacing: 0.3px;
    /* display: inline-block; */
    text-align: center;
    line-height: 1.2;
}

.powered-by-link:hover {
    color: var(--primary-color);
}

.powered-by-link:active {
    color: var(--dark-gray);
}

.powered-by-logo {
    height: 24px !important;
    width: auto !important;
    margin-left: -8px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    vertical-align: middle;
    display: inline-block;
}

/* Contenedor de input */
.chat-input-container {
    padding: 8px 12px;
    background: var(--white);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
    min-height: 80px;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--light-gray);
    border-radius: 25px;
    padding: 2px;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.chat-input-wrapper:focus-within {
    border-color: var(--primary-color);
    background: white;
    box-shadow: var(--shadow-light);
}

.chat-input {
    flex: 1;
    border: none;
    background: none;
    padding: 8px 12px;
    font-size: 14px;
    color: var(--text-black);
    outline: none;
    font-family: inherit;
}

.chat-input::placeholder {
    color: var(--medium-gray);
}

.send-button {
    width: 50px;
    height: 50px;
    border: none;
    color: var(--primary-color);
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.send-button:hover {
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    transform: scale(1.05);
}

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

.send-button svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
}

/* Botones de sugerencia */
.suggestion-buttons {
    margin: 12px 0 12px 50px;
    padding: 0;
}

.suggestion-buttons-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.suggestion-button {
    background: var(--light-gray);
    border: 1px solid #e9ecef;
    border-radius: 18px;
    padding: 8px 10px;
    color: var(--text-black);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: fit-content;
    max-width: 280px;
    display: inline-block;
    font-family: inherit;
    white-space: nowrap;
}

.suggestion-button:hover {
    background: #e9ecef;
    color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-light);
    border-color: var(--primary-color);
}

.suggestion-button:active {
    transform: translateY(0) scale(0.98);
}

.suggestion-button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.suggestion-button.disabled:hover {
    background: var(--light-gray);
    color: var(--text-black);
    transform: none;
    box-shadow: none;
}

/* Indicador de escritura */
.typing-indicator {
    animation: slideIn 0.4s ease-out;
}

.typing-indicator .message-content {
    padding: 18px 22px;
    background: var(--light-gray);
    border-radius: 18px 18px 18px 4px;
}

.typing-dots {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 20px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--medium-gray);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

/* Animaciones */
@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.6;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

@keyframes slideIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    animation: slideIn 0.3s ease-out;
}

/* Scrollbar personalizado */
.chat-messages::-webkit-scrollbar {
    width: 4px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--medium-gray);
    border-radius: 2px;
    opacity: 0.3;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    opacity: 0.6;
}

/* Botón de cierre */
.close-button {
    width: 40px;
    height: 40px;
    border: none;
    color: white;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    backdrop-filter: blur(10px);
}

.close-button:hover {
    transform: scale(1.1);
}

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

.close-button svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}