/* ============================================
   DR360 Store AI — estilos del widget de tienda
   Usa --dr360-primary / --dr360-secondary que el
   branding de cada tienda inyecta en :root. Si no
   existen, cae a un azul DR360 por defecto.
   ============================================ */
:root {
    --dsai-primary: var(--dr360-primary, #0D2C4D);
    --dsai-secondary: var(--dr360-secondary, #F7931E);
}

.dsai-toggle {
    position: fixed;
    bottom: 22px;
    right: 22px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    background: var(--dsai-primary);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(13, 44, 77, 0.32);
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}
.dsai-toggle:hover { transform: translateY(-2px) scale(1.04); }
.dsai-toggle.hidden { opacity: 0; pointer-events: none; transform: scale(0.8); }
.dsai-toggle svg { width: 26px; height: 26px; fill: currentColor; }

.dsai-chat {
    position: fixed;
    bottom: 22px;
    right: 22px;
    width: 370px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 44px);
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
    z-index: 2147483001;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px) scale(0.98);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.dsai-chat.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.dsai-header {
    background: var(--dsai-primary);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.dsai-header-info h4 { margin: 0; font-size: 15px; font-weight: 700; }
.dsai-header-info span { font-size: 11.5px; opacity: 0.85; }
.dsai-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dsai-close svg { width: 18px; height: 18px; fill: currentColor; }

.dsai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f6f8fb;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.dsai-msg { display: flex; }
.dsai-msg.user { justify-content: flex-end; }
.dsai-bubble {
    max-width: 80%;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}
.dsai-msg.bot .dsai-bubble {
    background: #fff;
    color: #1f2937;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
.dsai-msg.user .dsai-bubble {
    background: var(--dsai-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.dsai-typing {
    display: none;
    gap: 4px;
    padding: 4px 20px 8px;
    background: #f6f8fb;
}
.dsai-typing.show { display: flex; }
.dsai-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #c2cad6;
    animation: dsai-bounce 1.2s infinite ease-in-out;
}
.dsai-typing span:nth-child(2) { animation-delay: 0.15s; }
.dsai-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes dsai-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-5px); opacity: 1; }
}

.dsai-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #eceff3;
    background: #fff;
}
.dsai-input {
    flex: 1;
    border: 1px solid #dfe3ea;
    border-radius: 12px;
    padding: 9px 12px;
    font-size: 14px;
    resize: none;
    max-height: 96px;
    outline: none;
    font-family: inherit;
}
.dsai-input:focus { border-color: var(--dsai-primary); }
.dsai-send {
    background: var(--dsai-primary);
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.dsai-send svg { width: 20px; height: 20px; fill: currentColor; }

/* ── IA Upsell: tarjetas "Te puede interesar" ── */
.dr360-upsell-title {
    font-weight: 800;
    color: var(--dsai-primary);
}
.dr360-upsell-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 14px;
    overflow: hidden;
    text-decoration: none !important;
    height: 100%;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.dr360-upsell-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
    border-color: var(--dsai-primary);
}
.dr360-upsell-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: #f3f4f6;
}
.dr360-upsell-card-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
}
.dr360-upsell-card-name {
    font-size: 13.5px;
    font-weight: 600;
    color: #111827;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.dr360-upsell-card-price {
    font-size: 14px;
    font-weight: 800;
    color: var(--dsai-primary);
}

@media (max-width: 480px) {
    .dsai-chat {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
}
