/* AT Associate Delhi - Mobile-Responsive Chatbot Stylesheet */

:root {
    --at-bot-primary: #993737;
    --at-bot-primary-dark: #7a2626;
    --at-bot-primary-light: #b34a4a;
    --at-bot-accent: #ff6b35;
    --at-bot-bg: #f8fafc;
    --at-bot-surface: #ffffff;
    --at-bot-text: #1e293b;
    --at-bot-muted: #64748b;
    --at-bot-border: #e2e8f0;
    --at-bot-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.2), 0 4px 16px -2px rgba(153, 55, 55, 0.12);
    --at-bot-radius: 20px;
}

.at-chatbot-root {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

.at-chatbot-root *,
.at-chatbot-root *::before,
.at-chatbot-root *::after {
    box-sizing: border-box;
}

/* Floating Launcher */
.at-chatbot-launcher {
    position: fixed;
    bottom: 125px;
    right: 25px;
    z-index: 9998;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.at-chatbot-launcher:hover {
    transform: translateY(-3px) scale(1.04);
}

.at-chatbot-launcher:active {
    transform: scale(0.96);
}

.at-chatbot-launcher-btn {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--at-bot-primary) 0%, var(--at-bot-primary-dark) 100%);
    border: 3px solid #ffffff;
    box-shadow: 0 8px 24px rgba(153, 55, 55, 0.35), 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    position: relative;
    padding: 0;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.at-chatbot-launcher-btn img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    transition: transform 0.3s ease;
}

.at-chatbot-launcher-btn .at-icon-close {
    display: none;
    width: 28px;
    height: 28px;
    fill: #ffffff;
}

.at-chatbot-launcher.is-open .at-chatbot-launcher-btn img {
    display: none;
}

.at-chatbot-launcher.is-open .at-chatbot-launcher-btn .at-icon-close {
    display: block;
}

/* Badge */
.at-chatbot-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    background: #ef4444;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    animation: at-badge-pulse 2s infinite;
}

@keyframes at-badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Teaser Bubble */
.at-chatbot-teaser {
    background: #ffffff;
    color: var(--at-bot-text);
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    border: 1px solid var(--at-bot-border);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: at-teaser-float 3s ease-in-out infinite;
    cursor: pointer;
}

.at-chatbot-teaser-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    display: inline-block;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
}

@keyframes at-teaser-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* Chat Window (Desktop) */
.at-chatbot-window {
    position: fixed;
    bottom: 125px;
    right: 25px;
    width: 390px;
    height: 600px;
    max-height: calc(100vh - 150px);
    background: var(--at-bot-surface);
    border-radius: var(--at-bot-radius);
    box-shadow: var(--at-bot-shadow);
    border: 1px solid var(--at-bot-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(24px) scale(0.95);
    transform-origin: bottom right;
    transition: opacity 0.25s ease, transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
    pointer-events: none;
}

.at-chatbot-window.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Chat Header */
.at-chatbot-header {
    background: linear-gradient(135deg, var(--at-bot-primary) 0%, var(--at-bot-primary-dark) 100%);
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.at-chatbot-header-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.at-chatbot-avatar-wrap {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ffffff;
    padding: 2px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.at-chatbot-avatar-wrap img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: contain;
}

.at-chatbot-status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid #ffffff;
}

.at-chatbot-header-text h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.2px;
}

.at-chatbot-header-text p {
    margin: 2px 0 0 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    gap: 5px;
}

.at-chatbot-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.at-chatbot-action-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    text-decoration: none;
    padding: 0;
}

.at-chatbot-action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.at-chatbot-action-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Message Body */
.at-chatbot-body {
    flex: 1;
    background: var(--at-bot-bg);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.at-msg-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 88%;
    animation: at-msg-in 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes at-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.at-msg-row.bot { align-self: flex-start; }
.at-msg-row.user { align-self: flex-end; flex-direction: row-reverse; }

.at-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid var(--at-bot-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.at-msg-avatar img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.at-msg-bubble {
    padding: 12px 15px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.at-msg-row.bot .at-msg-bubble {
    background: #ffffff;
    color: var(--at-bot-text);
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.at-msg-row.user .at-msg-bubble {
    background: linear-gradient(135deg, var(--at-bot-primary) 0%, var(--at-bot-primary-light) 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 3px 12px rgba(153, 55, 55, 0.25);
}

.at-msg-time {
    font-size: 10px;
    margin-top: 4px;
    opacity: 0.65;
    text-align: right;
}

/* Quick Replies */
.at-quick-replies-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
    align-self: flex-start;
    max-width: 100%;
}

.at-quick-chip {
    background: #ffffff;
    border: 1.5px solid var(--at-bot-primary);
    color: var(--at-bot-primary);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 6px rgba(153, 55, 55, 0.08);
}

.at-quick-chip:hover {
    background: var(--at-bot-primary);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(153, 55, 55, 0.2);
}

.at-quick-chip:active {
    transform: scale(0.96);
}

/* Card Boxes */
.at-card-box {
    background: #ffffff;
    border: 1px solid var(--at-bot-border);
    border-radius: 14px;
    padding: 14px;
    margin-top: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.at-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--at-bot-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.at-card-row {
    font-size: 12.5px;
    color: var(--at-bot-muted);
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
}

.at-card-row strong {
    color: var(--at-bot-text);
}

.at-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.at-card-btn {
    flex: 1;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.at-card-btn-primary {
    background: var(--at-bot-primary);
    color: #ffffff;
}

.at-card-btn-wa {
    background: #25d366;
    color: #ffffff;
}

/* Typing Indicator */
.at-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid var(--at-bot-border);
    width: fit-content;
}

.at-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--at-bot-primary);
    opacity: 0.4;
    animation: at-dot-bounce 1.4s infinite ease-in-out;
}

.at-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.at-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes at-dot-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-6px); opacity: 1; }
}

/* Footer / Input Area */
.at-chatbot-footer {
    background: #ffffff;
    border-top: 1px solid var(--at-bot-border);
    padding: 12px 16px;
    flex-shrink: 0;
}

.at-chatbot-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.at-chatbot-input {
    flex: 1;
    height: 44px;
    border-radius: 22px;
    border: 1.5px solid #cbd5e1;
    background: #f8fafc;
    padding: 0 16px;
    font-size: 15px;
    color: var(--at-bot-text);
    outline: none;
    transition: border-color 0.2s, background 0.2s;
    font-family: inherit;
}

.at-chatbot-input:focus {
    border-color: var(--at-bot-primary);
    background: #ffffff;
}

.at-chatbot-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--at-bot-primary) 0%, var(--at-bot-primary-dark) 100%);
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    outline: none;
    box-shadow: 0 4px 12px rgba(153, 55, 55, 0.3);
    transition: transform 0.2s;
}

.at-chatbot-send-btn:hover {
    transform: scale(1.06);
}

.at-chatbot-send-btn:active {
    transform: scale(0.95);
}

.at-chatbot-send-btn svg {
    width: 18px;
    height: 18px;
    fill: #ffffff;
    margin-left: 2px;
}

.at-chatbot-brand-note {
    text-align: center;
    font-size: 11px;
    color: var(--at-bot-muted);
    margin-top: 6px;
}

/* ======================================================== */
/* MOBILE RESPONSIVENESS (Screens <= 768px)                */
/* ======================================================== */
@media (max-width: 768px) {
    .at-chatbot-launcher {
        bottom: 95px !important;
        right: 18px !important;
    }

    .at-chatbot-launcher-btn {
        width: 58px !important;
        height: 58px !important;
    }

    .at-chatbot-launcher-btn img {
        width: 34px !important;
        height: 34px !important;
    }

    .at-chatbot-teaser {
        display: none !important;
    }

    .at-chatbot-window {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100% !important;
        height: 100dvh !important;
        max-width: 100vw !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        border: none !important;
        box-shadow: none !important;
        z-index: 100001 !important;
        transform: translateY(100%) !important;
        transform-origin: bottom center !important;
        transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease !important;
        padding-top: env(safe-area-inset-top, 0);
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .at-chatbot-window.is-open {
        transform: translateY(0) !important;
        opacity: 1 !important;
    }

    .at-chatbot-header {
        padding: 14px 16px !important;
        border-radius: 0 !important;
    }

    .at-chatbot-header-text h3 {
        font-size: 15px !important;
    }

    .at-msg-row {
        max-width: 92% !important;
    }

    .at-msg-bubble {
        padding: 10px 14px !important;
        font-size: 14.5px !important;
    }

    .at-chatbot-input {
        font-size: 16px !important;
        height: 46px !important;
    }

    .at-quick-replies-wrap {
        overflow-x: auto;
        flex-wrap: nowrap !important;
        padding-bottom: 6px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .at-quick-replies-wrap::-webkit-scrollbar {
        display: none;
    }

    .at-quick-chip {
        white-space: nowrap !important;
        padding: 9px 14px !important;
        font-size: 13.5px !important;
        min-height: 38px !important;
    }
}
