/* =========================================================
   ACHARYA CODING SCHOOL — Chatbot Widget
   ========================================================= */

/* ===== Chatbot FAB Button ===== */
.fab--chatbot {
    bottom: 20px;
    background: linear-gradient(135deg, #E8400A, #C93608);
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(232, 64, 10, 0.45);
    animation: chatbot-pulse 2.8s ease-in-out infinite;
    overflow: hidden;
    padding: 0;
    border: none;
}

.fab--chatbot:hover {
    transform: translateY(-3px) scale(1.06);
    box-shadow: 0 12px 32px rgba(232, 64, 10, 0.55);
}

.fab--chatbot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    border-radius: 50%;
    display: block;
    image-rendering: -webkit-optimize-contrast;
}

@keyframes chatbot-pulse {

    0%,
    100% {
        box-shadow: 0 8px 24px rgba(232, 64, 10, .45), 0 0 0 0 rgba(232, 64, 10, .35);
    }

    50% {
        box-shadow: 0 8px 24px rgba(232, 64, 10, .45), 0 0 0 10px rgba(232, 64, 10, 0);
    }
}

/* Online dot on FAB */
.fab--chatbot .chatbot-online-dot {
    position: absolute;
    bottom: 3px;
    right: 3px;
    width: 13px;
    height: 13px;
    background: #28C840;
    border: 2.5px solid #fff;
    border-radius: 50%;
}

/* ===== Chat Window ===== */
.chatbot-window {
    position: fixed;
    bottom: 84px;
    right: 20px;
    width: 360px;
    /* Fixed height - content change pe window kabhi shrink/jump nahi karegi */
    height: min(560px, calc(100vh - 110px));
    max-height: min(560px, calc(100vh - 110px));
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 24px 72px rgba(10, 17, 40, 0.22), 0 4px 16px rgba(10, 17, 40, .1);
    display: flex;
    flex-direction: column;
    z-index: 400;
    overflow: hidden;
    transform: scale(0.85) translateY(24px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.28s cubic-bezier(.22, 1, .36, 1), opacity 0.24s ease;
    border: 1px solid rgba(232, 64, 10, .12);
}

.chatbot-window.is-open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* ===== Header ===== */
.chatbot-header {
    background: linear-gradient(135deg, #E8400A 0%, #C93608 100%);
    padding: 14px 16px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    position: relative;
}

.chatbot-header__avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2.5px solid rgba(255, 255, 255, .5);
    object-fit: cover;
    object-position: top center;
    flex-shrink: 0;
    image-rendering: -webkit-optimize-contrast;
}

.chatbot-header__info {
    flex: 1;
}

.chatbot-header__name {
    color: #fff;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: .95rem;
    line-height: 1.2;
}

.chatbot-header__status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .72rem;
    color: rgba(255, 255, 255, .82);
    margin-top: 3px;
}

.chatbot-header__status .dot {
    width: 7px;
    height: 7px;
    background: #28C840;
    border-radius: 50%;
    flex-shrink: 0;
}

.chatbot-header__actions {
    display: flex;
    gap: 4px;
}

.chatbot-header__btn {
    background: rgba(255, 255, 255, .18);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    font-size: .95rem;
    transition: background .15s;
}

.chatbot-header__btn:hover {
    background: rgba(255, 255, 255, .32);
}

/* ===== View Course Banner ===== */
.chatbot-banner {
    background: #E8400A;
    color: #fff;
    text-align: center;
    padding: 11px 16px;
    font-weight: 700;
    font-size: .9rem;
    cursor: pointer;
    flex-shrink: 0;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background .15s;
}

.chatbot-banner:hover {
    background: #C93608;
}

/* ===== Messages Area ===== */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}

/* Bot message row */
.chat-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.chat-row--bot {
    justify-content: flex-start;
}

.chat-row--user {
    justify-content: flex-end;
}

.chat-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    object-position: top center;
    flex-shrink: 0;
    border: 2px solid #f0f0f0;
    image-rendering: -webkit-optimize-contrast;
}

.chat-bubble-wrap {
    display: flex;
    flex-direction: column;
    max-width: 82%;
}

.chat-row--user .chat-bubble-wrap {
    align-items: flex-end;
}

.chat-bubble {
    padding: 11px 15px;
    border-radius: 18px;
    font-size: .89rem;
    line-height: 1.5;
    word-break: break-word;
}

.chat-row--bot .chat-bubble {
    background: #F2F2F2;
    color: #1a1a1a;
    border-bottom-left-radius: 5px;
}

.chat-row--user .chat-bubble {
    background: linear-gradient(135deg, #E8400A, #C93608);
    color: #fff;
    border-bottom-right-radius: 5px;
}

.chat-time {
    font-size: .68rem;
    color: #aaa;
    margin-top: 4px;
    padding: 0 4px;
}

/* Radio options */
.chat-options {
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin-top: 4px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 4px;
}

.chat-options::-webkit-scrollbar {
    width: 3px;
}

.chat-options::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.chat-option {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1.5px solid #E8400A;
    border-radius: 999px;
    padding: 9px 16px;
    cursor: pointer;
    font-size: .86rem;
    font-weight: 600;
    color: #1a1a1a;
    background: #fff;
    transition: background .15s, color .15s;
    font-family: var(--font-body);
    text-align: left;
}

.chat-option:hover,
.chat-option.selected {
    background: #E8400A;
    color: #fff;
}

.chat-option .radio-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid currentColor;
    flex-shrink: 0;
    display: grid;
    place-items: center;
}

.chat-option.selected .radio-dot::after,
.chat-option:hover .radio-dot::after {
    content: '';
    width: 6px;
    height: 6px;
    background: currentColor;
    border-radius: 50%;
    display: block;
}

/* Typing indicator */
.chat-typing {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-typing-dots {
    background: #F2F2F2;
    border-radius: 18px;
    border-bottom-left-radius: 5px;
    padding: 12px 16px;
    display: flex;
    gap: 5px;
    align-items: center;
}

.chat-typing-dots span {
    width: 7px;
    height: 7px;
    background: #bbb;
    border-radius: 50%;
    animation: typing-bounce 1.2s infinite ease-in-out;
}

.chat-typing-dots span:nth-child(2) {
    animation-delay: .2s;
}

.chat-typing-dots span:nth-child(3) {
    animation-delay: .4s;
}

@keyframes typing-bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-6px);
    }
}

/* ===== Input Area ===== */
.chatbot-input-area {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
    background: #fff;
}

.chatbot-flag {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .82rem;
    font-weight: 700;
    color: #333;
    flex-shrink: 0;
}

.chatbot-flag img {
    width: 22px;
    border-radius: 3px;
}

.chatbot-input {
    flex: 1;
    border: none;
    outline: none;
    font-family: var(--font-body);
    font-size: .9rem;
    color: #1a1a1a;
    background: transparent;
    min-width: 0;
}

.chatbot-input::placeholder {
    color: #bbb;
}

.chatbot-send {
    background: none;
    border: none;
    cursor: pointer;
    color: #E8400A;
    padding: 4px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    transition: transform .15s;
}

.chatbot-send:hover {
    transform: scale(1.2);
}

.chatbot-send svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

/* Phone mode - flag+code visible, text input */
.chatbot-input-area.mode-text .chatbot-flag {
    display: none;
}

.chatbot-input-area.mode-phone .chatbot-flag {
    display: flex;
}

/* ===== Success state ===== */
.chatbot-success {
    text-align: center;
    padding: 28px 20px;
}

.chatbot-success__icon {
    font-size: 2.4rem;
    display: block;
    margin-bottom: 12px;
}

.chatbot-success h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: #E8400A;
    margin-bottom: 8px;
}

.chatbot-success p {
    font-size: .86rem;
    color: #666;
    line-height: 1.6;
}

/* ===== Mobile ===== */
@media (max-width: 480px) {
    .chatbot-window {
        right: 0;
        left: 0;
        bottom: 0;
        width: 100%;
        height: 85vh;
        max-height: 85vh;
        border-radius: 20px 20px 0 0;
        border-bottom: none;
    }
}