/* ==========================================================================
   CHATBOT WIDGET — DarakDarika Matrimonial
   Professional floating chat widget with modern glassmorphism design
   ========================================================================== */

:root {
    --chat-primary: var(--primary, #9A3B1F);
    --chat-primary-dark: var(--primary-dark, #7A2D14);
    --chat-secondary: var(--secondary, #C4724B);
    --chat-bg: #FDFAF7;
    --chat-bubble-bot: #FFFFFF;
    --chat-bubble-user: linear-gradient(135deg, var(--chat-primary), var(--chat-secondary));
    --chat-border: #EDE5DF;
    --chat-radius: 18px;
    --chat-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

/* ── Offer Banner (Compact Slim Strip) ────────────────── */
.chatbot-offer-card {
    flex-shrink: 0;
    overflow: hidden;
}

.chatbot-offer-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    position: relative;
    font-size: 12px;
    line-height: 1.3;
}

.chatbot-offer-left {
    flex-shrink: 0;
}

.chatbot-offer-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    animation: chatOfferPulse 2s ease-in-out infinite;
}

@keyframes chatOfferPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.chatbot-offer-content {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbot-offer-discount {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.chatbot-offer-title {
    font-size: 10.5px;
    font-weight: 500;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chatbot-offer-desc {
    display: none;
}

.chatbot-offer-btn {
    flex-shrink: 0;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
    transition: transform 0.2s, opacity 0.2s;
}

.chatbot-offer-btn:hover {
    transform: scale(1.04);
    opacity: 0.9;
}

.chatbot-offer-close {
    position: absolute;
    top: 2px;
    right: 4px;
    background: none;
    border: none;
    font-size: 13px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
    line-height: 1;
    padding: 0;
}

.chatbot-offer-close:hover {
    opacity: 1;
}

/* ── Chat Toggle Button ───────────────────────────────── */
.chatbot-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--chat-bubble-user);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(154, 59, 31, 0.35), 0 0 0 0 rgba(154, 59, 31, 0.3);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: chatToggleAttention 3s ease 4s 2;
}

@keyframes chatToggleAttention {
    0%, 100% { box-shadow: 0 4px 16px rgba(154, 59, 31, 0.35), 0 0 0 0 rgba(154, 59, 31, 0.3); }
    50% { box-shadow: 0 4px 16px rgba(154, 59, 31, 0.35), 0 0 0 10px rgba(154, 59, 31, 0); }
}

.chatbot-toggle:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 24px rgba(154, 59, 31, 0.45);
}

.chatbot-toggle i {
    font-size: 24px;
    transition: transform 0.3s ease;
}

.chatbot-toggle.active {
    animation: none;
}

.chatbot-toggle.active i {
    transform: rotate(90deg);
}

/* Badge */
.chatbot-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e53935;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: scale(0.5);
}

.chatbot-badge.visible {
    opacity: 1;
    transform: scale(1);
    animation: chatBadgePop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes chatBadgePop {
    0% { transform: scale(0); }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ── Chat Window ──────────────────────────────────────── */
.chatbot-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 370px;
    max-height: 560px;
    background: var(--chat-bg);
    border-radius: var(--chat-radius);
    box-shadow: var(--chat-shadow);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0,0,0,0.06);
}

.chatbot-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ── Header ───────────────────────────────────────────── */
.chatbot-header {
    background: var(--chat-bubble-user);
    color: #fff;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    position: relative;
}

.chatbot-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.chatbot-header-info {
    flex: 1;
    min-width: 0;
}

.chatbot-header-info h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    letter-spacing: 0.2px;
}

.chatbot-header-info span {
    font-size: 10.5px;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chatbot-status-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #4caf50;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(76, 175, 80, 0.5);
    animation: chatbot-blink 2s infinite;
}

@keyframes chatbot-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.chatbot-close {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 13px;
    flex-shrink: 0;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ── Messages Area ────────────────────────────────────── */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 220px;
    max-height: 320px;
    background: var(--chat-bg);
    scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}
.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}
.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 10px;
}
.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.18);
}

/* ── Message Bubbles ──────────────────────────────────── */
.chatbot-msg {
    display: flex;
    gap: 8px;
    max-width: 88%;
    animation: chatMsgIn 0.3s ease;
}

@keyframes chatMsgIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.chatbot-msg.bot {
    align-self: flex-start;
}

.chatbot-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chatbot-msg-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
    margin-top: 2px;
}

.chatbot-msg.bot .chatbot-msg-icon {
    background: var(--chat-bubble-user);
    color: #fff;
}

.chatbot-msg.user .chatbot-msg-icon {
    background: #F0DDD5;
    color: var(--chat-primary);
}

.chatbot-bubble {
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.55;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.chatbot-msg.bot .chatbot-bubble {
    background: var(--chat-bubble-bot);
    color: #333;
    border: 1px solid var(--chat-border);
    border-top-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.chatbot-msg.user .chatbot-bubble {
    background: var(--chat-bubble-user);
    color: #fff;
    border-top-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(154, 59, 31, 0.15);
}

.chatbot-bubble a {
    color: var(--chat-primary);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px dashed var(--chat-primary);
    transition: opacity 0.2s;
}

.chatbot-bubble a:hover {
    opacity: 0.75;
}

.chatbot-msg.user .chatbot-bubble a {
    color: #fff;
    border-bottom-color: rgba(255,255,255,0.5);
}

.chatbot-bubble strong {
    font-weight: 600;
}

.chatbot-bubble s {
    opacity: 0.55;
}

.chatbot-msg-time {
    font-size: 9.5px;
    color: #aaa;
    margin-top: 3px;
    text-align: right;
    font-weight: 400;
}

.chatbot-msg.bot .chatbot-msg-time {
    text-align: left;
}

/* ── Typing Indicator ─────────────────────────────────── */
.chatbot-typing {
    display: none;
    padding: 8px 14px;
    background: #fff;
    border-radius: 14px;
    border-top-left-radius: 4px;
    border: 1px solid var(--chat-border);
    gap: 4px;
    align-items: center;
    width: fit-content;
    margin: 0 14px 8px;
}

.chatbot-typing.active {
    display: flex;
}

.chatbot-typing-dot {
    width: 6px;
    height: 6px;
    background: #bbb;
    border-radius: 50%;
    animation: chatbot-bounce 1.4s infinite;
}

.chatbot-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatbot-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* ── Quick Replies ────────────────────────────────────── */
.chatbot-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 6px 14px 10px;
    background: var(--chat-bg);
}

.chatbot-qr-btn {
    padding: 5px 12px;
    border: 1.5px solid var(--chat-border);
    background: #fff;
    color: var(--chat-primary);
    border-radius: 18px;
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Poppins', sans-serif;
    white-space: nowrap;
    line-height: 1.3;
}

.chatbot-qr-btn:hover {
    background: var(--chat-primary);
    border-color: var(--chat-primary);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(154, 59, 31, 0.2);
}

/* ── Input Area ───────────────────────────────────────── */
.chatbot-input-area {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-top: 1px solid #f0ebe6;
    background: #fff;
    gap: 8px;
    flex-shrink: 0;
}

.chatbot-input {
    flex: 1;
    border: 1.5px solid #E8DDD5;
    border-radius: 22px;
    padding: 8px 14px;
    font-size: 13px;
    outline: none;
    font-family: 'Poppins', sans-serif;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #FFFAF5;
}

.chatbot-input:focus {
    border-color: var(--chat-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(154, 59, 31, 0.08);
}

.chatbot-input::placeholder {
    color: #b5a99e;
    font-size: 12.5px;
}

.chatbot-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--chat-bubble-user);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chatbot-send:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(154, 59, 31, 0.3);
}

.chatbot-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ── Powered-by footer ────────────────────────────────── */
.chatbot-powered {
    text-align: center;
    padding: 4px 0;
    font-size: 9.5px;
    color: #c5b8ae;
    background: #fff;
    border-top: 1px solid #f5f0ec;
    letter-spacing: 0.2px;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    .chatbot-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
        border: none;
    }

    .chatbot-messages {
        max-height: none;
        flex: 1;
    }

    .chatbot-toggle {
        bottom: 16px;
        right: 16px;
        width: 50px;
        height: 50px;
    }

    .chatbot-toggle i {
        font-size: 20px;
    }
}

@media (max-width: 768px) and (min-width: 481px) {
    .chatbot-window {
        width: 340px;
        bottom: 88px;
        right: 16px;
    }

    .chatbot-toggle {
        bottom: 18px;
        right: 18px;
        width: 52px;
        height: 52px;
    }
}

/* ── Inner bubble formatting ──────────────────────────── */
.chatbot-bubble div {
    margin-top: 3px;
}

.chatbot-bubble p {
    margin: 0 0 3px;
}
