/* =========================
   SupremosAI Chatbot UI (2026)
   ========================= */

/* Botón Flotante */
.supremos-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Accesibilidad básica */
.supremos-chat-widget button:focus,
.supremos-chat-widget a:focus,
.supremos-chat-widget input:focus {
    outline: none;
}

.supremos-chat-toggle {
    background: var(--supremos-chat-color, #000000);
    color: #fff;
    border: none;
    border-radius: 9999px;
    width: 60px;
    height: 60px;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.18s ease, filter 0.18s ease;
}

.supremos-chat-toggle:hover {
    transform: translateY(-1px) scale(1.06);
    filter: brightness(1.05);
}

.supremos-chat-toggle:active {
    transform: translateY(0) scale(1.02);
}

/* Ventana de Chat - Glassmorphism */
.supremos-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 360px;
    height: 520px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.10);
    border-radius: 18px;
    box-shadow: 0 14px 50px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 1;
    transform: translateY(0);
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.supremos-chat-window.hidden {
    display: none;
}

/* Utilidad: se usa en el plugin para ocultar/mostrar elementos */
.hidden {
    display: none !important;
}

/* Contenedor principal para scroll correcto */
.supremos-chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* clave para overflow */
}

/* (Opcional) que el formulario de lead también pueda scrollear si crece */
.supremos-lead-form {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

/* Header */
.supremos-chat-header {
    background: var(--supremos-chat-color, #000000);
    color: #fff;
    padding: 10px 12px 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.supremos-chat-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .2px;
    color: #fff;
}

.supremos-chat-header button {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    transition: filter 0.18s ease, transform 0.18s ease;
}

.supremos-chat-header button:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
}

/* Mensajes */
.supremos-chat-messages {
    flex: 1;
    min-height: 0;
    padding: 14px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: linear-gradient(180deg, #f8fafc 0%, #f7f7f7 100%);
    font-size: 14px;
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: rgba(0, 0, 0, 0.22) transparent;
}

/* Custom Scrollbar Webkit */
.supremos-chat-messages::-webkit-scrollbar {
    width: 6px;
}
.supremos-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
.supremos-chat-messages::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.22);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
}
.supremos-chat-messages::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.38);
}

/* Burbuja base */
.supremos-message {
    margin-bottom: 12px;
    padding: 11px 14px;
    border-radius: 14px;
    max-width: 88%;
    line-height: 1.5;
    word-wrap: break-word;
    font-size: 14px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.bot-message {
    background: #fff;
    color: #2b2b2b;
    border-bottom-left-radius: 6px;
    align-self: flex-start;
    border: 1px solid #eef1f5;
}

.user-message {
    background: var(--supremos-chat-color, #000000);
    color: #fff;
    border-bottom-right-radius: 6px;
    margin-left: auto;
}

/* Ya no dependemos de links en texto, pero por si el theme mete anchors */
.user-message a {
    color: #fff;
    text-decoration: underline;
}

/* Error */
.bot-message.error {
    background: #ffebee;
    color: #c62828;
    border-color: #ffcdd2;
}

/* Typing */
.supremos-typing {
    opacity: 0.9;
    font-style: italic;
}

/* Input Area */
.supremos-chat-input-area {
    padding: 12px;
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid #eef1f5;
    display: flex;
    gap: 8px;
    align-items: center;
}

.supremos-chat-input-area input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e6e8ee;
    border-radius: 9999px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
    background: #fff;
}

.supremos-chat-input-area input:focus {
    border-color: rgba(0, 0, 0, 0.20);
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.06);
}

.supremos-chat-input-area button {
    background: var(--supremos-chat-color, #000000);
    color: #fff;
    border: none;
    border-radius: 9999px;
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    transition: transform 0.12s ease, filter 0.12s ease;
    box-sizing: border-box;
}

.supremos-chat-input-area button:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.supremos-chat-input-area button:active {
    transform: translateY(0);
}

/* Evitar que el theme inyecte iconos/pseudo-elementos en el botón */
#supremos-chat-send::before,
#supremos-chat-send::after {
    content: none !important;
}

/* =========================
   Product card (imagen + ver + comprar)
   ========================= */

.supremos-product-card {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px;
    cursor: pointer;
    max-width: 100%;
    border-radius: 14px;
    border: 1px solid #eef1f5;
    background: #fff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.supremos-product-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.10);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.supremos-product-card-image {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 12px;
    flex: 0 0 auto;
    border: 1px solid #eef1f5;
    background: #fff;
}

.supremos-product-card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    flex: 1 1 auto;
}

.supremos-product-card-title {
    font-weight: 800;
    font-size: 13px;
    line-height: 1.2;
    color: #121826;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.supremos-product-card-price {
    font-size: 13px;
    color: #1f2937;
}

.supremos-product-card-price del,
.supremos-product-card-price ins {
    font-size: 13px;
}

/* row de botones: Ver + Comprar */
.supremos-product-card-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
    flex-wrap: wrap;
}

.supremos-product-card-view {
    display: none !important;
    align-items: center;
    justify-content: center;
    height: 34px;
    padding: 0 12px;
    border-radius: 9999px;
    border: 1px solid #e6e8ee;
    background: #fff;
    color: #111827;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.12s ease, filter 0.12s ease;
}

.supremos-product-card-view:hover {
    filter: brightness(0.98);
    transform: translateY(-1px);
}

.supremos-product-card-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    padding: 0 14px;
    border-radius: 9999px;
    background: var(--supremos-chat-color, #000000);
    color: #fff;
    border: none;
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
    transition: transform 0.12s ease, filter 0.12s ease, opacity 0.12s ease;
}

.supremos-product-card-cta:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
}

.supremos-product-card-cta:active {
    transform: translateY(0);
}

.supremos-product-card-cta:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    filter: grayscale(0.2);
    transform: none;
}

/* =========================
   (Legacy) Typing indicator dots
   Si luego quieres usar dots, ya está listo.
   ========================= */
.typing-indicator span {
    display: inline-block;
    width: 5px;
    height: 5px;
    background-color: #999;
    border-radius: 50%;
    margin: 0 2px;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* =========================
   Responsive Mobile
   ========================= */
@media (max-width: 480px) {
    .supremos-chat-widget {
        right: 14px;
        bottom: 14px;
    }

    .supremos-chat-window {
        position: fixed;
        width: auto;
        left: 14px;
        right: 14px;
        bottom: 86px;
        height: auto;
        max-height: 70vh;
        border-radius: 16px;
    }

    .supremos-chat-messages {
        padding: 12px;
    }

    .supremos-product-card-image {
        width: 60px;
        height: 60px;
    }
}
