:root {
    --primary-color: #ffffff;
    --secondary-color: #f3f4f6;
    --text-color: #1f2937;
    --border-color: #e5e7eb;
    --success-color: #10b981;
    --shadow: 0 6px 12px rgba(0, 0, 0, 0.33);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Botón flotante */
.chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #191919 !important;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    z-index: 1000;
}

.chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 9px 20px rgba(0, 0, 0, 0.25);
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--success-color);
    color: white;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Ventana del chat */
.chat-window {
    position: fixed;
    bottom: 90px;
    top: 86px;        /* ← reemplaza height y max-height */
    right: 20px;
    width: 380px;
    height: auto;     /* ← se estira entre top y bottom */
    max-height: none; /* ← ya no necesario */
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    z-index: 1001;
    transition: opacity 0.3s ease, transform 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.chat-window.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

/* Header */
.chat-header {
    padding: 20px;
    background: var(--primary-color);
    color: #191919;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-header h3 {
    font-size: 16px;
    font-weight: 700;
	letter-spacing:0.9px;
    margin: 0;
    padding: 0;
}

.status {
    font-size: 12px;
    opacity: 0.9;
}

.chat-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    transition: opacity 0.2s;
}

.chat-close:hover {
    opacity: 0.8;
}

/* Mensajes */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #fafafa;
}

.message {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 80%;
    animation: fadeIn 0.3s ease;
}

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

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

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

.message-content {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.bot-message .message-content {
    background: var(--secondary-color);
    color: var(--text-color);
    border-bottom-left-radius: 4px;
}

.user-message .message-content {
    background: #191919 !important;
    color: white;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: #6b7280;
    padding: 0 4px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--secondary-color);
    border-radius: 16px;
    width: fit-content;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Input */
.chat-input-container {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    background: white;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    border-radius: 0px 0px 10px 10px;
}

.chat-input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: 1px solid var(--border-color);
}

.chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #191919;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.chat-send:hover {
    opacity: 0.9;
}

.chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Footer */
.chat-footer {
    padding: 12px;
    text-align: center;
    font-size: 11px;
    color: #9ca3af;
    border-top: none;
    background: white;
    border-radius: 16px;
}

/* Responsive */
@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 80px;
        top: 86px;    /* ← igual que desktop */
        height: auto; /* ← reemplaza el height fijo */
    }
    
    .chat-toggle {
        bottom: 15px;
        right: 15px;
    }
}

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

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

.chat-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}
