/* 
 * SIAN Chatbot AI - Premium Style 1.6.0
 * Design: SaaS 2026 / Glassmorphism / Premium UI
 */

:root {
    --sian-primary: #a00000;
    --sian-primary-dark: #800000;
    --sian-bg-light: #f8fafc;
    --sian-bg-alt: #eef2f7;
    --sian-glass-bg: rgba(255, 255, 255, 0.65);
    --sian-glass-border: rgba(255, 255, 255, 0.25);
    --sian-shadow-premium: 0 25px 60px rgba(0, 0, 0, 0.18);
    --sian-font: 'Inter', system-ui, -apple-system, sans-serif;
}

#sian-chatbot {
    position: fixed;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    z-index: 9999;
    font-family: var(--sian-font);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#sian-chatbot,
#sian-chatbot * {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

#sian-chatbot svg {
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    display: block;
    margin: 0;
}

/* FAB - Botón Flotante */
.sian-chatbot-fab {
    width: 60px;
    height: 60px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: linear-gradient(135deg, var(--sian-primary) 0%, #000000 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 30px rgba(160, 0, 0, 0.3);
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: sianFloat 4s ease-in-out infinite;
}

.sian-chatbot-fab:hover {
    transform: scale(1.08) translateY(-4px);
    box-shadow: 0 20px 40px rgba(160, 0, 0, 0.4);
}

@keyframes sianFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.sian-chatbot-fab-icon svg {
    width: 28px !important;
    height: 28px !important;
}

/* Indicador Online con Glow Animado */
.sian-chatbot-fab-online {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #10b981;
    border: 3px solid #fff;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.8);
}

.sian-chatbot-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    margin-right: 8px;
    position: relative;
}

.sian-chatbot-dot::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: inherit;
    opacity: 0.4;
    animation: sianGlowPulse 2s infinite;
}

@keyframes sianGlowPulse {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(2.5); opacity: 0; }
}

/* Ventana del Chat */
.sian-chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    display: flex;
    align-items: flex-end;
    gap: 15px;
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

#sian-chatbot.sian-open .sian-chatbot-window {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
    pointer-events: all;
}

.sian-chatbot-panel {
    width: 380px;
    height: 600px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-radius: 24px;
    box-shadow: var(--sian-shadow-premium);
    border: 1px solid var(--sian-glass-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Header Premium */
.sian-chatbot-header {
    padding: 20px 24px;
    background: var(--sian-glass-bg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--sian-glass-border);
    display: flex;
    align-items: center;
    gap: 14px;
}

.sian-chatbot-title {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
}

.sian-chatbot-subtitle {
    font-size: 12px;
    color: #64748b;
    display: flex;
    align-items: center;
    margin-top: 2px;
}

.sian-chatbot-avatar {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0f172a;
    background: rgba(16,185,129,0.14);
    border: 1px solid rgba(16,185,129,0.25);
    flex: 0 0 auto;
}

.sian-chatbot-avatar svg {
    width: 22px !important;
    height: 22px !important;
}

.sian-chatbot-close, .sian-chatbot-minimize, .sian-chatbot-reset {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: none;
    background: rgba(0,0,0,0.05);
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
}

.sian-chatbot-close:hover, .sian-chatbot-minimize:hover {
    background: rgba(0,0,0,0.1);
    color: #0f172a;
}

.sian-chatbot-reset:hover {
    background: #a00000;
    color: #fff;
}

.sian-chatbot-close:hover {
    transform: rotate(90deg);
}

/* Cuerpo del Chat */
#chat-box {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden !important;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: linear-gradient(135deg, var(--sian-bg-light) 0%, var(--sian-bg-alt) 100%);
    position: relative;
}

/* Efectos blur decorativos en esquinas */
#chat-box::before, #chat-box::after {
    content: '';
    position: absolute;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.15;
    pointer-events: none;
    z-index: 0;
}

#chat-box::before {
    top: -50px;
    left: -50px;
    background: var(--sian-primary);
}

#chat-box::after {
    bottom: -50px;
    right: -50px;
    background: #3b82f6;
}

/* Botones de Acción / Enlaces Especiales */
.sian-msg {
    max-width: 85%;
    display: flex;
    flex-direction: column;
    animation: sianFadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
    position: relative;
    z-index: 1;
}

.sian-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none !important;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
    border: none;
    margin-top: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.sian-btn--primary {
    background: linear-gradient(135deg, var(--sian-primary) 0%, #000000 100%);
    color: white !important;
}

.sian-btn--ghost {
    background: #ffffff;
    color: var(--sian-primary) !important;
    border: 1.5px solid var(--sian-primary);
    box-shadow: 0 4px 10px rgba(160, 0, 0, 0.05);
}

.sian-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 20px rgba(160, 0, 0, 0.2);
}

.sian-btn--ghost:hover {
    background: var(--sian-primary);
    color: #ffffff !important;
}

.sian-msg:has(.sian-btn) {
    margin-bottom: 4px;
}

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

.bot-msg {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 12px 16px;
    border-radius: 4px 18px 18px 18px;
    color: #334155;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.user-msg {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--sian-primary) 0%, #000000 100%);
    padding: 12px 16px;
    border-radius: 18px 18px 4px 18px;
    color: white;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 8px 20px rgba(160, 0, 0, 0.2);
}

/* Input tipo ChatGPT */
.sian-chatbot-input-row {
    padding: 16px 20px;
    background: var(--sian-glass-bg);
    backdrop-filter: blur(15px);
    border-top: 1px solid var(--sian-glass-border);
    display: flex;
    gap: 12px;
    align-items: center;
}

#chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid rgba(0,0,0,0.08) !important;
    border-radius: 14px;
    padding: 12px 16px;
    font-size: 14px;
    color: #1e293b;
    outline: none !important;
    transition: all 0.3s;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
    margin: 0 !important;
    height: 46px !important;
}

#chat-input:focus {
    border-color: var(--sian-primary) !important;
    background: #fff !important;
    box-shadow: 0 0 0 4px rgba(160, 0, 0, 0.1), inset 0 2px 4px rgba(0,0,0,0.02);
}

#chat-send {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--sian-primary) 0%, #000000 100%);
    color: white;
    border: none !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    box-shadow: 0 8px 15px rgba(160, 0, 0, 0.25);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    flex-shrink: 0;
    padding: 0 !important;
    margin: 0 !important;
}

#chat-send:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 20px rgba(34, 197, 94, 0.35);
}

/* Chips / Pills Modernas */
.sian-chatbot-chipbar {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(5px);
    border-top: 1px solid rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.sian-chatbot-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0;
    scrollbar-width: none;
    -ms-overflow-style: none; /* IE/Edge */
    flex: 1;
    scroll-behavior: smooth;
}

.sian-chatbot-chips::-webkit-scrollbar { 
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

.sian-chip-nav {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.08) !important;
    background: #fff !important;
    color: #64748b !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    padding: 0 !important;
    font-size: 16px;
    line-height: 1;
    z-index: 2;
}

.sian-chip-nav:hover:not(:disabled) {
    background: #f8fafc !important;
    color: var(--sian-primary) !important;
    border-color: var(--sian-primary) !important;
}

.sian-chip-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.sian-chip-nav.sian-hidden {
    display: none !important;
}

.sian-chip {
    background: rgba(255, 255, 255, 0.8) !important;
    border: 1px solid rgba(0,0,0,0.08) !important;
    border-radius: 12px;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    color: #475569 !important;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.sian-chip:hover {
    background: #fff !important;
    border-color: var(--sian-primary) !important;
    color: var(--sian-primary) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* Card de Producto Premium */
.sian-card {
    background: #fff;
    border-radius: 20px;
    border: 1px solid rgba(0,0,0,0.06);
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.04);
    transition: transform 0.3s;
    display: flex;
    flex-direction: column;
}

.sian-card:hover {
    transform: translateY(-4px);
}

.sian-card-img {
    width: 100%;
    height: 160px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.sian-card-img img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Cambiado a contain para evitar recortes */
    padding: 10px;
}

.sian-card-body {
    padding: 12px 16px;
    flex: 1;
}

.sian-card-title {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 6px;
    line-height: 1.4;
}

.sian-card-price-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.sian-price {
    font-size: 16px;
    font-weight: 800;
    color: var(--sian-primary-dark);
}

.sian-price-old {
    font-size: 12px;
    color: #94a3b8;
    text-decoration: line-through;
}

.sian-card-actions {
    padding: 12px 16px;
    background: #f8fafc;
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-add-cart {
    flex: 1;
    background: var(--sian-primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    height: 40px;
    padding: 0 12px;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-add-cart:hover:not(:disabled) {
    background: var(--sian-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
}

.btn-view, .btn-whatsapp {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    text-decoration: none;
}

.btn-view {
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #64748b;
}

.btn-view:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #cbd5e1;
}

.btn-whatsapp {
    background: #25d366;
    color: #fff;
    border: none;
}

.btn-whatsapp:hover {
    background: #22c35e;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.2);
}

/* Scrollbar */
#chat-box::-webkit-scrollbar {
    width: 6px;
}

#chat-box::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 10px;
}

/* Responsive */
@media (max-width: 480px) {
    .sian-chatbot-panel {
        width: calc(100vw - 32px);
        height: 80vh;
        right: 16px;
        bottom: 80px;
    }
}

.sian-chatbot-image {
    width: 102px !important; /* 60px + 70% = 102px */
    height: 102px !important;
    border-radius: 0 !important;
    object-fit: contain !important;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.15));
    border: none !important;
    flex-shrink: 0;
}

.sian-chatbot-image-wrap {
    display: flex;
    align-items: flex-end; /* Cambiado a flex-end para que parezca que sale de la parte inferior */
    justify-content: center;
    padding: 0;
    margin-bottom: -5px; /* Ajuste para que se integre mejor con el botón flotante */
}
