/* ==========================================================================
   SAHIL SCHOOLS AI COUNSELOR & 24/7 VIRTUAL ASSISTANT
   High-Level Educational AI Widget & Lead Capture Engine
   ========================================================================== */

:root {
    --cb-primary: #0b2545;
    --cb-primary-light: #1e3a8a;
    --cb-accent: #ffc107;
    --cb-accent-hover: #e0a800;
    --cb-wa: #25d366;
    --cb-wa-dark: #128c7e;
    --cb-surface: #ffffff;
    --cb-bg: #f8fafc;
    --cb-text: #0f172a;
    --cb-muted: #64748b;
    --cb-border: #e2e8f0;
    --cb-radius: 20px;
}

.chatbot-wrapper {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9995;
    font-family: inherit;
}

/* ─── 1. FLOATING TEASER INVITATION BUBBLE ─── */
.chatbot-teaser {
    position: absolute;
    bottom: 68px;
    right: 0;
    width: 290px;
    background: #ffffff;
    border: 1px solid rgba(11, 37, 69, 0.12);
    border-radius: 18px 18px 4px 18px;
    padding: 12px 14px;
    box-shadow: 0 14px 35px -5px rgba(11, 37, 69, 0.22);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    animation: cb-teaser-slide 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.chatbot-teaser:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 40px -5px rgba(11, 37, 69, 0.28);
}

.chatbot-teaser-close {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 20px;
    height: 20px;
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    color: #94a3b8;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.chatbot-teaser-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.chatbot-teaser-content {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.chatbot-teaser-avatar {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #ffc107;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

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

.chatbot-teaser-body {
    line-height: 1.25;
}

.chatbot-teaser-author {
    font-size: 11.5px;
    font-weight: 800;
    color: #0b2545;
    display: block;
    letter-spacing: -0.2px;
}

.chatbot-teaser-text {
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    margin: 3px 0 0;
    line-height: 1.35;
}

@keyframes cb-teaser-slide {
    0% { opacity: 0; transform: translateY(15px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ─── 2. FLOATING LAUNCHER BUTTON ─── */
.chatbot-launcher {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #0b2545 0%, #173868 100%);
    color: #ffffff;
    border: 1.5px solid rgba(255, 193, 7, 0.65);
    border-radius: 50px;
    padding: 8px 18px 8px 10px;
    box-shadow: 0 10px 30px rgba(11, 37, 69, 0.38);
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(8px);
}

.chatbot-launcher:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 38px rgba(11, 37, 69, 0.48);
    border-color: #ffc107;
    color: #ffffff;
}

.chatbot-launcher-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 3px;
}

.chatbot-launcher-crest {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 50%;
}

.chatbot-pulse-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid #10b981;
    animation: cb-ring 2s infinite ease-out;
}

@keyframes cb-ring {
    0% { transform: scale(0.9); opacity: 0.9; }
    70% { transform: scale(1.3); opacity: 0; }
    100% { transform: scale(1.3); opacity: 0; }
}

.chatbot-online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 13px;
    height: 13px;
    background: #10b981;
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.chatbot-launcher-text {
    text-align: left;
    line-height: 1.25;
}

.chatbot-launcher-title {
    font-size: 0.92rem;
    font-weight: 800;
    display: block;
    color: #ffffff;
    letter-spacing: -0.2px;
}

.chatbot-launcher-sub {
    font-size: 0.72rem;
    color: #a5b4fc;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    margin-top: 1px;
}

.chatbot-launcher-live-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.9);
}

.chatbot-unread-badge {
    position: absolute;
    top: -4px;
    right: 0;
    background: #ef4444;
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ─── 3. MAIN CHATBOT WINDOW DIALOG ─── */
.chatbot-box {
    position: fixed;
    bottom: 88px;
    right: 24px;
    width: 400px;
    height: 580px;
    max-height: calc(100vh - 110px);
    background: #ffffff;
    border-radius: var(--cb-radius);
    box-shadow: 0 20px 60px -10px rgba(11, 37, 69, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    border: 1px solid rgba(11, 37, 69, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(24px) scale(0.96);
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.chatbot-box.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.chatbot-header {
    background: linear-gradient(135deg, #0b2545 0%, #173868 100%);
    color: #ffffff;
    padding: 13px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid rgba(255, 193, 7, 0.3);
    position: relative;
    z-index: 2;
}

.chatbot-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.chatbot-header-avatar-wrap {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    background: #ffffff;
    padding: 2px;
    border: 1.5px solid #ffc107;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.chatbot-header-status-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 11px;
    height: 11px;
    background: #10b981;
    border: 2px solid #0b2545;
    border-radius: 50%;
}

.chatbot-header-title {
    font-size: 0.95rem;
    font-weight: 800;
    margin: 0;
    color: #ffffff;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chatbot-header-sub {
    font-size: 0.72rem;
    color: #93c5fd;
    font-weight: 500;
    line-height: 1.2;
}

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

.cb-h-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.cb-h-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    transform: scale(1.05);
}

.cb-h-wa {
    background: #25d366;
    color: #ffffff !important;
}

.cb-h-wa:hover {
    background: #1ebe5d;
}

.cb-h-phone {
    background: rgba(255, 193, 7, 0.25);
    color: #ffc107 !important;
}

.cb-h-phone:hover {
    background: #ffc107;
    color: #0b2545 !important;
}

.cb-h-close {
    background: rgba(239, 68, 68, 0.25);
}

.cb-h-close:hover {
    background: #ef4444;
}

/* ─── 4. CHAT BODY & STREAM ─── */
.chatbot-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
.chatbot-body::-webkit-scrollbar {
    width: 5px;
}
.chatbot-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* Hero Trust Banner inside chat with Official Logo */
.cb-hero-banner {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 4px 14px rgba(11, 37, 69, 0.05);
}

.cb-hero-top-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 8px;
    border-bottom: 1px dashed rgba(11, 37, 69, 0.1);
}

.cb-official-logo {
    max-height: 44px;
    max-width: 220px;
    width: auto;
    object-fit: contain;
}

.cb-hero-bottom-row {
    display: flex;
    align-items: center;
    gap: 11px;
}

.cb-hero-crest {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 50%;
    background: #ffffff;
    border: 1.5px solid #ffc107;
    padding: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.cb-hero-crest img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.cb-hero-details strong {
    font-size: 13.5px;
    color: #0b2545;
    font-weight: 800;
    line-height: 1.2;
}

.cb-hero-details small {
    font-size: 11px;
    color: #64748b;
    line-height: 1.35;
}
    color: #64748b;
    line-height: 1.35;
}

/* Message Bubbles */
.cb-msg {
    display: flex;
    flex-direction: column;
    max-width: 88%;
    font-size: 0.88rem;
    line-height: 1.5;
    animation: cb-bubble-in 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cb-bubble-in {
    0% { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

.cb-msg-bot {
    align-self: flex-start;
}

.cb-msg-bot .cb-bubble {
    background: #ffffff;
    color: #1e293b;
    border-radius: 18px 18px 18px 4px;
    padding: 12px 16px;
    box-shadow: 0 4px 15px rgba(11, 37, 69, 0.06);
    border: 1px solid #e2e8f0;
    word-break: break-word;
}

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

.cb-msg-user .cb-bubble {
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
    color: #ffffff;
    border-radius: 18px 18px 4px 18px;
    padding: 10px 16px;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.3);
    word-break: break-word;
}

.cb-msg-time {
    font-size: 0.68rem;
    color: #94a3b8;
    margin-top: 4px;
    padding: 0 4px;
    font-weight: 500;
}

.cb-msg-user .cb-msg-time {
    text-align: right;
}

/* Markdown formatting inside bubbles */
.cb-bubble strong, .cb-bubble b {
    color: #0b2545;
    font-weight: 700;
}

.cb-msg-user .cb-bubble strong, .cb-msg-user .cb-bubble b {
    color: #ffffff;
}

.cb-bubble ul, .cb-bubble ol {
    margin: 6px 0;
    padding-left: 18px;
}

.cb-bubble li {
    margin-bottom: 4px;
}

/* Action CTA Box inside Bot Reply */
.cb-action-box {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.cb-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #0b2545 0%, #1e3a8a 100%);
    color: #ffffff !important;
    padding: 8px 14px;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(11, 37, 69, 0.2);
    transition: all 0.2s ease;
}

.cb-action-btn:hover {
    background: #ffc107;
    color: #0b2545 !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 193, 7, 0.35);
}

.cb-action-wa {
    background: #25d366;
    color: #ffffff !important;
}

.cb-action-wa:hover {
    background: #1ebe5d;
    color: #ffffff !important;
}

/* Quick Chips */
.chatbot-chips-title {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    margin: 10px 0 4px;
    display: flex;
    align-items: center;
}

.chatbot-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cb-chip {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #1e3a8a;
    border-radius: 50px;
    padding: 5px 12px;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
}

.cb-chip:hover {
    background: #1e3a8a;
    color: #ffffff;
    border-color: #1e3a8a;
    transform: translateY(-1.5px);
    box-shadow: 0 4px 10px rgba(30, 58, 138, 0.25);
}

/* ─── 5. TYPING INDICATOR ─── */
.cb-typing {
    display: none;
    align-self: flex-start;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 10px 16px;
    gap: 5px;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.cb-dot {
    width: 7px;
    height: 7px;
    background: #3b82f6;
    border-radius: 50%;
    animation: cb-dot-pulse 1.4s infinite ease-in-out both;
}

.cb-dot:nth-child(1) { animation-delay: -0.32s; }
.cb-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes cb-dot-pulse {
    0%, 80%, 100% { transform: scale(0.4); opacity: 0.5; }
    40% { transform: scale(1.1); opacity: 1; }
}

/* ─── 6. INTERACTIVE LEAD CAPTURE DRAWER ─── */
.cb-lead-drawer {
    display: none;
    padding: 0 14px 10px;
    animation: cb-drawer-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cb-drawer-in {
    0% { opacity: 0; transform: translateY(15px); }
    100% { opacity: 1; transform: translateY(0); }
}

.cb-lead-card {
    background: #ffffff;
    border: 1.5px solid #bfdbfe;
    border-radius: 16px;
    padding: 12px 14px;
    box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.15);
}

.cb-lead-close {
    background: transparent;
    border: none;
    font-size: 18px;
    color: #94a3b8;
    line-height: 1;
    cursor: pointer;
}

.cb-lead-close:hover {
    color: #0f172a;
}

/* ─── 7. FOOTER & INPUT ─── */
.chatbot-footer {
    padding: 12px 14px 10px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
}

.chatbot-input-group {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border-radius: 50px;
    padding: 4px 6px 4px 16px;
    border: 1.5px solid #cbd5e1;
    transition: all 0.2s ease;
}

.chatbot-input-group:focus-within {
    border-color: #2563eb;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.chatbot-input {
    flex-grow: 1;
    border: none;
    background: transparent;
    font-size: 0.85rem;
    outline: none;
    color: #0f172a;
    font-weight: 500;
}

.chatbot-input::placeholder {
    color: #94a3b8;
}

.chatbot-send-btn {
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    transition: all 0.2s ease;
}

.chatbot-send-btn:hover {
    background: #1e40af;
    transform: scale(1.05);
}

.chatbot-footer-sub {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
    padding: 0 4px;
    font-size: 10.5px;
    color: #94a3b8;
}

.cb-lead-trigger-link {
    background: transparent;
    border: none;
    color: #2563eb;
    font-weight: 700;
    font-size: 10.5px;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}

.cb-lead-trigger-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* ─── 8. RESPONSIVE MOBILE ADAPTATION ─── */
@media (max-width: 480px) {
    .chatbot-box {
        right: 10px;
        left: 10px;
        width: calc(100% - 20px);
        bottom: 80px;
        height: 82vh;
        border-radius: 18px;
    }
    .chatbot-launcher {
        right: 15px;
        bottom: 15px;
        padding: 8px 14px 8px 8px;
    }
    .chatbot-launcher-icon {
        width: 38px;
        height: 38px;
        min-width: 38px;
    }
    .chatbot-launcher-crest {
        width: 30px;
        height: 30px;
    }
    .chatbot-teaser {
        right: 5px;
        left: 5px;
        width: calc(100% - 10px);
        bottom: 72px;
    }
}
