/* Reset y variables globales */
:root {
    --primary-color: #ff6f61;
    --primary-dark: #e85750;
    --bg-light: #fdf5f4;
    --bg-white: #ffffff;
    --shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
}

body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f9;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Layout principal */
#chat-widget {
    display: flex;
    flex-direction: column;
    height: 90vh;
    width: 90%;
    max-width: 500px;
    background-color: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    position: relative;
}

/* Header */
.chat-header {
    background-color: var(--primary-color);
    color: white;
    padding: 15px 20px;
    border-bottom: 2px solid var(--primary-dark);
    z-index: 10;
}

.chat-header__info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.chat-header__logo {
    font-size: 24px;
}

.chat-header__title {
    text-align: left;
}

.chat-header__title h3 {
    margin: 0;
    font-size: 18px;
}

.chat-header__title span {
    font-size: 14px;
    opacity: 0.9;
}

/* Área de mensajes */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: var(--bg-light);
    display: flex;
    flex-direction: column;
    height: calc(100% - 70px); /* Resta el header */
    margin-bottom: 70px; /* Espacio para el input */
    padding-bottom: 20px;
}

/* Estilos de mensajes */
.message {
    max-width: 75%;
    padding: 12px 18px;
    border-radius: 15px;
    line-height: 1.5;
    font-size: 14px;
    margin-bottom: 10px;
    word-wrap: break-word;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.message.user {
    align-self: flex-end;
    background-color: var(--primary-color);
    color: white;
    border-top-right-radius: 4px;
    margin-left: auto;
}

.message.bot {
    align-self: flex-start;
    background-color: var(--bg-white);
    color: #333;
    border-top-left-radius: 4px;
    margin-right: auto;
}

/* Área de input */
.chat-input {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    background-color: var(--bg-white);
    border-top: 2px solid var(--primary-dark);
    z-index: 10;
}

.chat-input__container {
    display: flex;
    gap: 10px;
    position: relative;
}

.chat-input__field {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease;
}

.chat-input__field:focus {
    border-color: var(--primary-color);
}

.chat-input__button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.chat-input__button:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.chat-input__button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Scrollbar personalizado */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Media queries */
@media (max-width: 768px) {
    body {
        align-items: stretch;
        background-color: var(--bg-white);
    }

    #chat-widget {
        height: 100vh;
        width: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }

    .chat-messages {
        height: calc(100vh - 140px);
        padding-bottom: 90px;
    }

    .chat-input {
        padding: 10px;
    }

    .chat-input__field {
        font-size: 16px; /* Mejor tamaño para móviles */
    }
}

/* Fix para iOS */
@supports (-webkit-touch-callout: none) {
    .chat-messages {
        height: calc(100vh - 140px - 44px);
    }
}