/* ═══════════════════════════════════════════════════════════════
   EduBot Chatbot CSS — v2.0
   Fixes: header btn clickability, mobile launcher z-index overlap,
          enhanced launcher, better info card bold text, typography
   ═══════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=Noto+Sans+Bengali:wght@400;500;600&display=swap');
/* ── Design tokens ─────────────────────────────────────────────────────────── */
:root {
    --pri:          #1a2e5a;
    --pri-dark:     #0f1e3d;
    --pri-mid:      #1e3668;
    --pri-light:    #2a4580;
    --acc:          #d4a017;
    --acc-light:    #f0c040;
    --acc-soft:     #fdf6dc;
    --green:        #22c55e;
    --white:        #ffffff;
    --bg:           #f2f5fb;
    --bg2:          #e8edf8;
    --text:         #1c1c2e;
    --text-muted:   #6b7280;
    --border:       #dde3ef;
    --shadow-xl:    0 24px 64px rgba(15,30,61,0.22), 0 6px 20px rgba(15,30,61,0.12);
    --shadow-md:    0 8px 24px rgba(26,46,90,0.14);
    --shadow-sm:    0 2px 8px rgba(26,46,90,0.10);
    --radius-lg:    20px;
    --radius-md:    14px;
    --radius-sm:    10px;
    --font:         'Sora', sans-serif;
    --transition:   0.22s cubic-bezier(0.4,0,0.2,1);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: var(--font);
    background: linear-gradient(140deg, #dde5f5 0%, #f2f5fb 55%, #eaf0fb 100%);
    min-height: 100vh;
}
/* ══════════════════════════════════════════════════════════════════
   LAUNCHER
   Key fix: z-index hierarchy — launcher > widget so pulse rings
   never overlap the send button on mobile
   ══════════════════════════════════════════════════════════════════ */
#chat-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    cursor: pointer;
    z-index: 10001;          /* ABOVE widget (10000) so it's always tappable */
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
/* Animated ring pulses — contained within launcher bounds */
.launcher-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2.5px solid rgba(212, 160, 23, 0.55);
    animation: launcherPulse 2.8s ease-out infinite;
    pointer-events: none;   /* rings must NEVER intercept taps */
}
.launcher-ring.ring2 { animation-delay: 1.4s; }
@keyframes launcherPulse {
    0%   { transform: scale(1);    opacity: 0.9; }
    100% { transform: scale(1.75); opacity: 0;   }
}
/* The actual clickable button face */
.launcher-inner {
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, #1e3668 0%, #1a2e5a 45%, #2a4580 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 0 0 3px rgba(212,160,23,0.35),
        0 8px 28px rgba(15,30,61,0.45),
        0 2px 8px rgba(15,30,61,0.3);
    transition: transform var(--transition), box-shadow var(--transition);
    overflow: hidden;
    z-index: 1;
}
.launcher-inner::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.18) 0%, transparent 55%);
    pointer-events: none;
}
#chat-launcher:hover .launcher-inner,
#chat-launcher:active .launcher-inner {
    transform: scale(1.08);
    box-shadow:
        0 0 0 4px rgba(212,160,23,0.5),
        0 12px 36px rgba(15,30,61,0.5),
        0 4px 12px rgba(15,30,61,0.35);
}
.launcher-icon {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity var(--transition), transform var(--transition);
}
.launcher-icon.hidden {
    display: none;
}
.launcher-icon svg {
    width: 100%;
    height: 100%;
}
/* Notification badge */
.launcher-badge {
    display: none;
    position: absolute;
    top: -3px;
    right: -3px;
    width: 22px;
    height: 22px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: 2.5px solid white;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    z-index: 2;
    animation: badgePop 0.4s cubic-bezier(.34,1.56,.64,1);
    pointer-events: none;
}
.launcher-badge span {
    color: white;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
}
@keyframes badgePop {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
/* Tooltip bubble */
.launcher-tooltip {
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--pri-dark);
    color: white;
    padding: 7px 13px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
    transform: translateY(-50%) translateX(6px);
    box-shadow: var(--shadow-md);
}
.launcher-tooltip::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: var(--pri-dark);
}
#chat-launcher:hover .launcher-tooltip {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}
/* ══════════════════════════════════════════════════════════════════
   WIDGET
   ══════════════════════════════════════════════════════════════════ */
.chat-widget {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 396px;
    max-width: calc(100vw - 32px);
    height: 610px;
    max-height: calc(100dvh - 116px);
    background: var(--bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
    border: 1px solid rgba(26,46,90,0.10);
    animation: widgetSlideUp 0.38s cubic-bezier(.34,1.56,.64,1) both;
}
.chat-widget.hidden { display: none; }
@keyframes widgetSlideUp {
    from { opacity: 0; transform: translateY(28px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}
/* ══════════════════════════════════════════════════════════════════
   HEADER — fixed clickability issue:
   overflow:hidden was clipping buttons. Using clip-path instead,
   and giving header-actions a higher z-index.
   ══════════════════════════════════════════════════════════════════ */
.chat-header {
    background: linear-gradient(120deg, var(--pri-dark) 0%, var(--pri) 55%, var(--pri-light) 100%);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 11px;
    position: relative;
    flex-shrink: 0;
    /* Removed overflow:hidden — was blocking button clicks */
}
/* Decorative glow — uses pseudo instead of overflow:hidden child */
.header-glow {
    position: absolute;
    top: -40px; right: -30px;
    width: 140px; height: 140px;
    background: radial-gradient(circle, rgba(212,160,23,0.22) 0%, transparent 65%);
    border-radius: 50%;
    pointer-events: none;
}
.header-glow::after {
    content: '';
    position: absolute;
    bottom: -60px; left: -60px;
    width: 120px; height: 120px;
    background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
    border-radius: 50%;
}
.header-avatar {
    position: relative;
    width: 44px; height: 44px;
    background: linear-gradient(135deg, var(--acc) 0%, var(--acc-light) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.2), 0 3px 10px rgba(212,160,23,0.5);
}
.avatar-emoji { font-size: 22px; line-height: 1; }
.avatar-online-dot {
    position: absolute;
    bottom: 1px; right: 1px;
    width: 11px; height: 11px;
    background: var(--green);
    border: 2px solid var(--pri);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--green);
}
.header-info { flex: 1; min-width: 0; }
.header-name {
    color: white;
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.header-status {
    color: rgba(255,255,255,0.72);
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 3px;
}
.status-dot {
    width: 6px; height: 6px;
    background: var(--green);
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 5px var(--green);
    animation: blink 2.2s ease-in-out infinite;
}
@keyframes blink {
    0%,100% { opacity: 1; }
    50%      { opacity: 0.35; }
}
/* ── Header action buttons — KEY FIX ──────────────────────────────────────── */
.header-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    position: relative;
    z-index: 10;        /* ensure above the glow pseudo-elements */
}
.header-btn {
    background: rgba(255,255,255,0.13);
    border: 1px solid rgba(255,255,255,0.18);
    color: white;
    width: 32px; height: 32px;
    border-radius: 9px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), transform var(--transition), border-color var(--transition);
    -webkit-tap-highlight-color: transparent;
    /* Explicit pointer-events to ensure tappability on iOS */
    pointer-events: auto;
    touch-action: manipulation;
}
.header-btn:hover {
    background: rgba(255,255,255,0.26);
    border-color: rgba(255,255,255,0.35);
    transform: scale(1.06);
}
.header-btn:active {
    transform: scale(0.94);
    background: rgba(255,255,255,0.35);
}
/* ══════════════════════════════════════════════════════════════════
   MESSAGES
   ══════════════════════════════════════════════════════════════════ */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 3px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.msg-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    animation: msgFadeIn 0.28s ease both;
}
.msg-wrap.user { flex-direction: row-reverse; }
@keyframes msgFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.bot-avatar {
    width: 28px; height: 28px;
    background: linear-gradient(135deg, var(--pri) 0%, var(--pri-light) 100%);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}
.msg-bubble {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    line-height: 1.58;
    word-break: break-word;
}
.bot-bubble {
    background: var(--white);
    color: var(--text);
    border-bottom-left-radius: 3px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}
/* Bold text inside bot bubbles (for DB data highlights) */
.bot-bubble strong,
.bot-bubble b {
    color: var(--pri);
    font-weight: 700;
}
.user-bubble {
    background: linear-gradient(135deg, var(--pri) 0%, var(--pri-light) 100%);
    color: white;
    border-bottom-right-radius: 3px;
    box-shadow: 0 3px 10px rgba(26,46,90,0.28);
}
/* ══════════════════════════════════════════════════════════════════
   INFO CARD — enhanced with bold labels
   ══════════════════════════════════════════════════════════════════ */
.info-card {
    background: white;
    border: 1px solid var(--border);
    border-left: 4px solid var(--acc);
    border-radius: var(--radius-md);
    padding: 16px 15px;
    max-width: 94%;
    box-shadow: var(--shadow-md);
    font-size: 13px;
    animation: msgFadeIn 0.28s ease both;
}
.card-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--pri);
    margin-bottom: 3px;
    letter-spacing: -0.01em;
}
.card-desc {
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 12px;
    line-height: 1.5;
}
.card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    margin-bottom: 10px;
}
.card-item {
    background: var(--bg);
    border-radius: 9px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border: 1px solid var(--border);
}
.ci-label {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ci-val {
    font-size: 13.5px;
    color: var(--pri);
    font-weight: 800;
}
.card-fees {
    background: var(--acc-soft);
    border: 1px solid rgba(212,160,23,0.28);
    border-radius: 9px;
    padding: 9px 12px;
    font-size: 12.5px;
    color: #7a5200;
    font-weight: 500;
    margin-bottom: 8px;
}
.card-fees strong { font-weight: 800; color: #5a3c00; }
.card-section {
    font-size: 12.5px;
    color: var(--text);
    margin: 5px 0;
    line-height: 1.55;
}
.card-section strong { color: var(--pri); font-weight: 700; }
.card-note {
    background: #f0f6ff;
    border: 1px solid #c5dbff;
    border-radius: 9px;
    padding: 8px 11px;
    color: #1a3e80;
    font-size: 12px;
}
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.tag {
    background: linear-gradient(135deg, var(--pri) 0%, var(--pri-light) 100%);
    color: white;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
}
/* ══════════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════════ */
.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 2px 0 2px 36px;
    animation: msgFadeIn 0.28s ease both;
}
.btn-group.used {
    pointer-events: none;
    opacity: 0.45;
}
.chat-btn {
    background: linear-gradient(135deg, var(--pri) 0%, var(--pri-light) 100%);
    color: white;
    border: none;
    padding: 9px 16px;
    border-radius: 22px;
    font-size: 12.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(26,46,90,0.22);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(26,46,90,0.34);
    filter: brightness(1.08);
}
.chat-btn:active { transform: scale(0.96); }
.chat-btn.secondary {
    background: white;
    color: var(--pri);
    border: 1.5px solid var(--border);
    box-shadow: none;
}
.chat-btn.secondary:hover {
    background: var(--bg);
    border-color: var(--pri);
    box-shadow: var(--shadow-sm);
}
/* ══════════════════════════════════════════════════════════════════
   TYPING INDICATOR
   ══════════════════════════════════════════════════════════════════ */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px 8px 14px;
}
.typing-indicator.hidden { display: none; }
.typing-avatar {
    width: 28px; height: 28px;
    background: linear-gradient(135deg, var(--pri) 0%, var(--pri-light) 100%);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}
.typing-dots {
    background: white;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px 14px;
    display: flex;
    gap: 5px;
    align-items: center;
    box-shadow: var(--shadow-sm);
}
.typing-dots span {
    width: 7px; height: 7px;
    background: var(--pri-light);
    border-radius: 50%;
    opacity: 0.4;
    animation: typingBounce 1.3s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.18s; }
.typing-dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes typingBounce {
    0%,100% { transform: translateY(0);   opacity: 0.35; }
    40%      { transform: translateY(-5px); opacity: 1; }
}
/* ══════════════════════════════════════════════════════════════════
   INPUT AREA
   ══════════════════════════════════════════════════════════════════ */
.chat-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: white;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.chat-input-area input {
    flex: 1;
    border: 1.5px solid var(--border);
    border-radius: 22px;
    padding: 10px 16px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    min-width: 0;
}
.chat-input-area input:focus {
    border-color: var(--pri);
    box-shadow: 0 0 0 3px rgba(26,46,90,0.10);
    background: white;
}
.chat-input-area input:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.chat-input-area input::placeholder { color: #aab4c8; }
#send-btn {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--acc) 0%, var(--acc-light) 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition);
    box-shadow: 0 3px 8px rgba(212,160,23,0.4);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    color: var(--pri-dark);
}
#send-btn:hover {
    transform: scale(1.08) rotate(-5deg);
    box-shadow: 0 5px 14px rgba(212,160,23,0.5);
}
#send-btn:active { transform: scale(0.94); }
#send-btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }
/* ══════════════════════════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════════════════════════ */
.chat-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 12px;
    font-size: 10.5px;
    color: var(--text-muted);
    background: white;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.chat-footer strong { color: var(--pri); }
.footer-sep { opacity: 0.4; }
.footer-link {
    background: none;
    border: none;
    color: var(--pri);
    font-size: 10.5px;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    -webkit-tap-highlight-color: transparent;
}
.footer-link:hover { color: var(--pri-light); }
/* ══════════════════════════════════════════════════════════════════
   WHATSAPP BUTTON
   ══════════════════════════════════════════════════════════════════ */
.wa-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: linear-gradient(135deg, #25d366 0%, #1db954 100%);
    color: white;
    padding: 10px 20px;
    border-radius: 22px;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
    margin-top: 10px;
    box-shadow: 0 3px 10px rgba(37,211,102,0.38);
    transition: all var(--transition);
}
.wa-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37,211,102,0.48);
    filter: brightness(1.05);
}
/* ══════════════════════════════════════════════════════════════════
   COUNSELLOR NUDGE CARD
   ══════════════════════════════════════════════════════════════════ */
.info-card .nudge-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.info-card .nudge-icon {
    font-size: 22px;
    line-height: 1;
}
.info-card .nudge-title {
    font-size: 14.5px;
    font-weight: 800;
    color: var(--pri);
}
.info-card .nudge-body {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
}
.info-card .nudge-body strong {
    color: var(--pri);
    font-weight: 700;
}
/* ══════════════════════════════════════════════════════════════════
   SEARCH BADGE (Tavily indicator)
   ══════════════════════════════════════════════════════════════════ */
.search-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    font-size: 10.5px;
    color: #1a56a0;
    background: #e8f0fe;
    border: 1px solid #b8d0f8;
    border-radius: 20px;
    padding: 3px 10px;
    font-weight: 600;
}
/* ══════════════════════════════════════════════════════════════════
   MOBILE — Full screen widget, launcher always accessible
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    .chat-widget {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        /* Leave 80px at bottom so launcher remains tappable */
        bottom: 80px;
        width: 100%;
        height: auto;
        max-width: 100%;
        max-height: calc(100dvh - 80px);
        border-radius: 0;
        z-index: 10000;
    }
    /* Launcher sits in the 80px gap at the bottom, always above widget */
    #chat-launcher {
        bottom: 12px;
        right: 16px;
        width: 56px;
        height: 56px;
        z-index: 10002;   /* above widget (10000) and its overlay */
    }
    /* Hide hover tooltip on touch devices */
    .launcher-tooltip { display: none !important; }
    /* Tighter chat buttons */
    .chat-btn { padding: 9px 13px; font-size: 12px; }
    /* Header slightly shorter */
    .chat-header { padding: 11px 13px; }
    /* Bigger tap targets for header action buttons */
    .header-btn { width: 36px; height: 36px; border-radius: 10px; }
}
/* ── iPhone notch / home bar safe area ──────────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    @media (max-width: 480px) {
        .chat-input-area {
            padding-bottom: max(10px, env(safe-area-inset-bottom));
        }
        #chat-launcher {
            bottom: max(12px, env(safe-area-inset-bottom));
        }
    }
}