/* ==========================================================================
   Shiv Naresh Storefront AI Chatbot - Modern Glassmorphic Styles
   ========================================================================== */

:root {
    --sn-chat-primary: #ff5722;
    --sn-chat-primary-dark: #e64a19;
    --sn-chat-bg: rgba(255, 255, 255, 0.96);
    --sn-chat-bg-dark: rgba(17, 24, 39, 0.96);
    --sn-chat-border: rgba(0, 0, 0, 0.08);
    --sn-chat-border-dark: rgba(255, 255, 255, 0.12);
    --sn-chat-text: #1f2937;
    --sn-chat-text-dark: #f3f4f6;
    --sn-chat-muted: #6b7280;
    --sn-chat-bubble-bot: #f3f4f6;
    --sn-chat-bubble-bot-dark: #1f2937;
    --sn-chat-shadow: 0 16px 48px -8px rgba(0, 0, 0, 0.22), 0 4px 16px -2px rgba(0, 0, 0, 0.1);
}

/* --- Floating Launcher Button --- */
.shiv-chat-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #111827 0%, #000000 100%);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    z-index: 1050;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
    outline: none;
}

.shiv-chat-launcher:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.shiv-chat-launcher.active {
    transform: scale(0.92);
}

.shiv-chat-launcher-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg, #ff5722 0%, #ff9800 100%);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 10px;
    letter-spacing: 0.5px;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(255, 87, 34, 0.5);
}

.shiv-chat-pulse {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--sn-chat-primary);
    opacity: 0.8;
    animation: shiv-chat-pulse-anim 2.5s infinite;
    pointer-events: none;
}

@keyframes shiv-chat-pulse-anim {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    70% {
        transform: scale(1.35);
        opacity: 0;
    }
    100% {
        transform: scale(1.35);
        opacity: 0;
    }
}

/* --- Slide-up Chat Drawer --- */
.shiv-chat-drawer {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 390px;
    max-width: calc(100vw - 32px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: var(--sn-chat-bg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--sn-chat-border);
    border-radius: 20px;
    box-shadow: var(--sn-chat-shadow);
    display: flex;
    flex-direction: column;
    z-index: 1050;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.shiv-chat-drawer.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Dark theme support */
[data-bs-theme="dark"] .shiv-chat-drawer,
[data-theme="dark"] .shiv-chat-drawer {
    background: var(--sn-chat-bg-dark);
    border-color: var(--sn-chat-border-dark);
    color: var(--sn-chat-text-dark);
}

/* --- Header --- */
.shiv-chat-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #ffffff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

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

.shiv-chat-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.shiv-chat-avatar img {
    width: 26px;
    height: 26px;
    object-fit: contain;
}

.shiv-chat-title {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.2;
    color: #ffffff;
}

.shiv-chat-subtitle {
    font-size: 0.72rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.shiv-chat-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    display: inline-block;
    box-shadow: 0 0 6px #10b981;
}

.shiv-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.shiv-chat-btn-icon {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #cbd5e1;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.shiv-chat-btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* --- Body Messages Stream --- */
.shiv-chat-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.shiv-chat-welcome {
    text-align: center;
    padding: 24px 12px 16px;
    background: linear-gradient(180deg, rgba(255, 87, 34, 0.05) 0%, transparent 100%);
    border-radius: 12px;
    margin-bottom: 8px;
}

.shiv-chat-welcome-avatar {
    width: 48px;
    height: 48px;
    margin: 0 auto 10px;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.shiv-chat-welcome-avatar img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.shiv-chat-welcome-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.shiv-chat-welcome-desc {
    font-size: 0.8rem;
    color: var(--sn-chat-muted);
    margin-bottom: 0;
    line-height: 1.4;
}

/* --- Message Rows & Bubbles --- */
.shiv-chat-msg-row {
    display: flex;
    flex-direction: column;
    max-width: 86%;
}

.shiv-chat-msg-user {
    align-self: flex-end;
}

.shiv-chat-msg-assistant {
    align-self: flex-start;
}

.shiv-chat-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.86rem;
    line-height: 1.45;
    word-break: break-word;
}

.shiv-chat-bubble-user {
    background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.shiv-chat-bubble-assistant {
    background: var(--sn-chat-bubble-bot);
    color: var(--sn-chat-text);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--sn-chat-border);
}

[data-bs-theme="dark"] .shiv-chat-bubble-assistant,
[data-theme="dark"] .shiv-chat-bubble-assistant {
    background: var(--sn-chat-bubble-bot-dark);
    color: var(--sn-chat-text-dark);
    border-color: var(--sn-chat-border-dark);
}

.shiv-chat-bubble a {
    color: var(--sn-chat-primary);
    text-decoration: underline;
    font-weight: 600;
}

.shiv-chat-code {
    background: rgba(0, 0, 0, 0.08);
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: monospace;
}

/* --- Product Cards Carousel --- */
.shiv-chat-products-carousel {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 6px 2px 8px;
    margin-top: 6px;
    scrollbar-width: thin;
}

.shiv-chat-prod-card {
    flex: 0 0 150px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

[data-bs-theme="dark"] .shiv-chat-prod-card,
[data-theme="dark"] .shiv-chat-prod-card {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.08);
}

.shiv-chat-prod-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.shiv-chat-prod-img-wrap {
    position: relative;
    width: 100%;
    height: 120px;
    background: #f8fafc;
    overflow: hidden;
}

.shiv-chat-prod-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.shiv-chat-prod-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: #ef4444;
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 4px;
}

.shiv-chat-prod-info {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.shiv-chat-prod-name {
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shiv-chat-prod-cat {
    font-size: 0.68rem;
    color: var(--sn-chat-muted);
}

.shiv-chat-prod-pricing {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.shiv-chat-prod-price {
    font-size: 0.82rem;
    font-weight: 700;
    color: #10b981;
}

.shiv-chat-prod-mrp {
    font-size: 0.7rem;
    text-decoration: line-through;
    color: var(--sn-chat-muted);
}

/* --- Typing Dots Animation --- */
.shiv-chat-typing-bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
}

.shiv-chat-typing-bubble span {
    width: 6px;
    height: 6px;
    background: var(--sn-chat-muted);
    border-radius: 50%;
    animation: shiv-chat-typing 1.4s infinite ease-in-out both;
}

.shiv-chat-typing-bubble span:nth-child(1) { animation-delay: -0.32s; }
.shiv-chat-typing-bubble span:nth-child(2) { animation-delay: -0.16s; }

@keyframes shiv-chat-typing {
    0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* --- Suggestion Chips Bar --- */
.shiv-chat-chips-bar {
    display: flex;
    gap: 6px;
    padding: 6px 14px 10px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.shiv-chat-chips-bar::-webkit-scrollbar {
    display: none;
}

.shiv-chat-chip {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid var(--sn-chat-border);
    color: var(--sn-chat-text);
    padding: 5px 11px;
    border-radius: 16px;
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, transform 0.18s;
}

[data-bs-theme="dark"] .shiv-chat-chip,
[data-theme="dark"] .shiv-chat-chip {
    background: rgba(255, 255, 255, 0.06);
    color: var(--sn-chat-text-dark);
    border-color: var(--sn-chat-border-dark);
}

.shiv-chat-chip:hover {
    background: var(--sn-chat-primary);
    color: #ffffff;
    border-color: var(--sn-chat-primary);
    transform: translateY(-1px);
}

/* --- Footer & Input --- */
.shiv-chat-footer {
    padding: 10px 14px 12px;
    background: rgba(255, 255, 255, 0.9);
    border-top: 1px solid var(--sn-chat-border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

[data-bs-theme="dark"] .shiv-chat-footer,
[data-theme="dark"] .shiv-chat-footer {
    background: rgba(17, 24, 39, 0.9);
    border-color: var(--sn-chat-border-dark);
}

.shiv-chat-form {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--sn-chat-bubble-bot);
    border: 1px solid var(--sn-chat-border);
    border-radius: 24px;
    padding: 4px 6px 4px 14px;
}

[data-bs-theme="dark"] .shiv-chat-form,
[data-theme="dark"] .shiv-chat-form {
    background: var(--sn-chat-bubble-bot-dark);
    border-color: var(--sn-chat-border-dark);
}

.shiv-chat-input {
    flex: 1;
    border: none;
    background: transparent;
    color: inherit;
    font-size: 0.86rem;
    outline: none;
    padding: 6px 0;
}

.shiv-chat-send-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--sn-chat-primary);
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    font-size: 0.82rem;
}

.shiv-chat-send-btn:hover:not(:disabled) {
    background: var(--sn-chat-primary-dark);
    transform: scale(1.06);
}

.shiv-chat-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.shiv-chat-footer-note {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.68rem;
    color: var(--sn-chat-muted);
    padding: 0 4px;
}

.shiv-chat-wa-link {
    color: #25D366;
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.shiv-chat-wa-link:hover {
    text-decoration: underline;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 576px) {
    .shiv-chat-launcher {
        bottom: 18px;
        right: 18px;
        width: 52px;
        height: 52px;
        font-size: 1.4rem;
    }

    .shiv-chat-drawer {
        bottom: 0;
        right: 0;
        width: 100vw;
        max-width: 100vw;
        height: 85vh;
        max-height: 85vh;
        border-radius: 20px 20px 0 0;
    }
}
