/* ==========================================================
   AOTTAR AI CHATBOT - PREMIUM MODERN THEME (v1.0.8)
   Matching Aottar Website Brand Colors:
   Orange: #FF6A13, Blue: #1D3D8F
   ========================================================== */

:root {
    /* Color Palette */
    --primary-orange: #FF6A13;
    --primary-orange-hover: #e05307;
    --secondary-blue: #1D3D8F;
    --secondary-blue-hover: #132b69;
    --bg-white: #ffffff;
    --bg-light: #f8fafc;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --text-white: #ffffff;
    
    /* UI Structure (Desktop defaults) */
    --chat-width: 420px;
    --chat-height: 520px;
    --launcher-bottom: 24px;
    --launcher-bottom-mobile: 16px;
    --border-radius: 20px;
    --border-subtle: rgba(29, 61, 143, 0.08);
    --success-green: #00d084;
}

/* Base resets inside the chatbot */
#aottar-chat-launcher,
#aottar-chat-window {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    box-sizing: border-box;
}

#aottar-chat-launcher *,
#aottar-chat-window * {
    box-sizing: border-box;
}

/* ==========================================================
   FLOATING BUTTONS STACK POSITION, SIZE, & Z-INDEX
   ========================================================== */

/* 1. Ask Aottar Launcher (Bottom-most) */
#aottar-chat-launcher {
    position: fixed;
    right: 24px !important;
    left: auto !important;
    bottom: var(--launcher-bottom) !important;
    z-index: 999997 !important;
}

/* 2. WhatsApp Joinchat Button (Middle) */
html body .joinchat,
html body #joinchat {
    position: fixed !important;
    right: 24px !important;
    left: auto !important;
    bottom: 90px !important; /* Launcher bottom (24px) + height (48px) + gap (18px) */
    width: 58px !important;
    height: 58px !important;
    z-index: 999998 !important;
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1) !important;
}

html body .joinchat__button {
    width: 58px !important;
    height: 58px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15) !important;
    border-radius: 50% !important;
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1) !important;
}

html body .joinchat__button img,
html body .joinchat__button svg {
    width: 28px !important;
    height: 28px !important;
}

html body .joinchat__button:hover {
    transform: scale(1.03) !important;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2) !important;
}

/* 3. Woodmart Scroll-To-Top Button (Top-most) */
html body .wd-scroll-top,
html body .scrollToTop,
html body #wd-scroll-top {
    position: fixed !important;
    right: 30px !important; /* Centered exactly above WhatsApp (which is 58px wide, right: 24px -> center is 53px. This is 46px wide -> right: 30px yields center 53px) */
    left: auto !important;
    bottom: 166px !important; /* WhatsApp bottom (90px) + height (58px) + gap (18px) */
    z-index: 999999 !important;
    background-color: var(--bg-white) !important;
    color: var(--secondary-blue) !important;
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    min-height: 46px !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1) !important;
    border: 1px solid var(--border-subtle) !important;
    opacity: 0;
    visibility: hidden;
}

/* Woodmart scroll top visibility states */
html body .wd-scroll-top.wd-show,
html body .scrollToTop.wd-show,
html body .scrollToTop.active {
    opacity: 1 !important;
    visibility: visible !important;
}

html body .wd-scroll-top svg,
html body .scrollToTop svg {
    width: 18px !important;
    height: 18px !important;
}

html body .wd-scroll-top::after,
html body .scrollToTop::after {
    font-size: 18px !important;
    line-height: 46px !important;
}

html body .wd-scroll-top:hover,
html body .scrollToTop:hover {
    transform: scale(1.03) !important;
    background-color: var(--bg-light) !important;
    color: var(--primary-orange) !important;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.16) !important;
}

/* ==========================================================
   PREMIUM LAUNCHER PILL BUTTON
   ========================================================== */
#aottar-chat-btn {
    height: 48px !important;
    width: 176px !important;
    min-width: 176px !important;
    border: none !important;
    outline: none !important;
    cursor: pointer;
    border-radius: 999px !important;
    background: linear-gradient(135deg, var(--primary-orange), #ff843f) !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 0 16px 0 12px !important; /* Left padding 12px */
    box-shadow: 0 6px 20px rgba(255, 106, 19, 0.28);
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

#aottar-chat-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 24px rgba(255, 106, 19, 0.4);
}

#aottar-chat-btn:active {
    transform: scale(0.97);
}

/* Launcher Content Wrap */
.launcher-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px; /* Gap between icon and text: 8px */
    width: 100%;
}

.icon-closed-group {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    width: 100%;
}

/* Icon container 30px x 30px */
.icon-closed-group::before {
    content: "";
    display: none;
}

.launcher-icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

.launcher-bubble-icon {
    width: 18px !important; /* Chat icon: 18px */
    height: 18px !important;
    fill: none;
    flex-shrink: 0;
}

.launcher-label {
    color: var(--text-white);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.2px;
    text-transform: uppercase;
    white-space: nowrap !important;
    overflow: hidden;
}

/* Active Launcher State (Turns to Close X circle) */
#aottar-chat-btn.active {
    width: 48px !important;
    min-width: 48px !important;
    height: 48px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    background: var(--secondary-blue) !important;
    box-shadow: 0 6px 20px rgba(29, 61, 143, 0.25) !important;
    justify-content: center !important;
}

#aottar-chat-btn.active:hover {
    background: var(--secondary-blue-hover) !important;
    transform: scale(1.03);
}

#aottar-chat-btn.active .icon-closed-group {
    display: none !important;
}

.icon-active-group {
    display: none !important;
}

#aottar-chat-btn.active .icon-active-group {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.close-badge {
    color: var(--text-white);
    font-size: 22px;
    font-weight: 500;
    line-height: 1;
}

/* Hide deprecated active labels */
.launcher-active-label {
    display: none !important;
}

/* Notification dot */
.notification-dot {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    background: #ff3b30;
    border-radius: 50%;
    border: 1.5px solid var(--bg-white);
    z-index: 10;
}

/* ==========================================================
   CHAT WINDOW CONTAINER
   ========================================================== */
#aottar-chat-window {
    position: fixed;
    right: 24px !important;
    left: auto !important;
    bottom: calc(var(--launcher-bottom) + 60px); /* sitting exactly above Ask Aottar */
    width: var(--chat-width);
    height: var(--chat-height);
    max-width: calc(100vw - 48px);
    max-height: calc(90vh - var(--launcher-bottom) - 70px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-white) !important;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.16);
    z-index: 10000000 !important;
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px) scale(0.97);
    transition: opacity 200ms cubic-bezier(0.4, 0, 0.2, 1), transform 200ms cubic-bezier(0.4, 0, 0.2, 1), visibility 200ms;
}

#aottar-chat-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ==========================================================
   HEADER (FIXED 72px)
   ========================================================== */
.chat-header {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-dark);
    flex-shrink: 0;
}

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

.ai-logo {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(29, 61, 143, 0.15);
}

.header-text h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--secondary-blue);
}

.header-text p {
    margin: 2px 0 0;
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success-green);
    display: inline-block;
}

.chat-close-btn {
    background: none !important;
    border: none !important;
    color: var(--text-muted) !important;
    font-size: 28px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    transition: color 200ms;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px !important;
}

.chat-close-btn:hover {
    color: var(--primary-orange) !important;
}

/* ==========================================================
   CHAT BODY & MESSAGE SCROLL AREA
   ========================================================== */
#chat-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    background: var(--bg-light);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#chat-body::-webkit-scrollbar {
    width: 6px;
}

#chat-body::-webkit-scrollbar-track {
    background: transparent;
}

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

#chat-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.15);
}

#chat-messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ==========================================================
   CHAT BUBBLE STYLING & WORD WRAP
   ========================================================== */
.message {
    display: flex;
    width: 100%;
}

.message.bot {
    justify-content: flex-start;
}

.message.user {
    justify-content: flex-end;
}

.content {
    display: flex;
    flex-direction: column;
    max-width: 75%;
}

.bubble {
    padding: 12px 16px;
    font-size: 14.5px;
    line-height: 1.5;
    word-wrap: break-word;
    word-break: break-word;
    border-radius: 18px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

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

.message.user .bubble {
    background: var(--primary-orange);
    color: var(--text-white);
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(255, 106, 19, 0.12);
}

.time {
    margin-top: 4px;
    font-size: 10px;
    color: var(--text-muted);
}

.message.bot .time {
    align-self: flex-start;
    padding-left: 4px;
}

.message.user .time {
    align-self: flex-end;
    padding-right: 4px;
}

.chat-date {
    align-self: center;
    margin: 8px 0;
    padding: 4px 12px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ==========================================================
   INPUT AREA FOOTER (FIXED)
   ========================================================== */
.chat-input-wrapper {
    background: var(--bg-white);
    padding: 16px 20px;
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.chat-input {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border-radius: 28px;
    padding: 4px 4px 4px 18px;
    gap: 10px;
    border: 1px solid transparent;
    transition: all 200ms;
}

.chat-input:focus-within {
    border-color: rgba(29, 61, 143, 0.15);
    box-shadow: 0 0 0 3px rgba(29, 61, 143, 0.05);
    background: var(--bg-white);
}

.chat-input input {
    flex: 1;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    font-size: 14px;
    color: var(--text-dark);
    height: 40px;
    padding: 0 !important;
    box-shadow: none !important;
}

.chat-input input::placeholder {
    color: var(--text-muted);
}

#aottar-send {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: var(--primary-orange);
    color: var(--text-white);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 200ms, transform 200ms;
    flex-shrink: 0;
}

#aottar-send:hover {
    background: var(--primary-orange-hover);
    transform: scale(1.05);
}

#aottar-send:active {
    transform: scale(0.95);
}

#aottar-send:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
}

/* ==========================================================
   PRODUCT RESULTS OVERFLOW FIXES
   ========================================================== */
#product-results {
    max-height: 180px;
    overflow-y: auto;
    background: var(--bg-white);
    border-top: 1px solid var(--border-subtle);
    transition: max-height 200ms;
}

#product-results:empty {
    border-top: none;
    max-height: 0;
}

.product-card {
    display: flex;
    padding: 12px;
    margin: 8px 16px;
    background: var(--bg-light);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    gap: 12px;
    transition: border-color 200ms, box-shadow 200ms;
}

.product-card:hover {
    border-color: rgba(29, 61, 143, 0.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.product-image {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-white);
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}

.product-info h4 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary-orange);
}

.product-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.view-product {
    flex: 1;
    font-size: 11px;
    font-weight: 600;
    padding: 6px 12px;
    background: var(--primary-orange);
    color: var(--text-white);
    text-align: center;
    border-radius: 6px;
    text-decoration: none;
    transition: background-color 200ms;
}

.view-product:hover {
    background: var(--primary-orange-hover);
}

/* ==========================================================
   TYPING INDICATOR
   ========================================================== */
#typing-indicator {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: var(--secondary-blue);
    width: fit-content;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

#typing-indicator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-white);
    animation: typingPulse 1.2s infinite ease-in-out;
}

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

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

@keyframes typingPulse {
    0%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    50% {
        transform: translateY(-4px);
        opacity: 1;
    }
}