/* ============================================================
   AJ MBBS ARCHIVE — AI Consultant + Theme Switcher Styles
   ============================================================ */

/* ── Expandable Theme Switcher (Subpages) ── */
.theme-switcher-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 2px;
    box-shadow: var(--neu-shadow);
    transition: width 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.2);
    width: 44px;
    height: 44px;
    overflow: hidden;
}
.theme-switcher-wrapper.expanded {
    width: 130px;
    border-color: var(--primary);
}
.main-toggle-btn {
    min-width: 38px;
    width: 38px;
    height: 38px;
    border: none !important;
    background: none !important;
    box-shadow: none !important;
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}
.theme-options {
    display: flex;
    gap: 6px;
    margin-left: 6px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}
.theme-switcher-wrapper.expanded .theme-options {
    opacity: 1;
    pointer-events: auto;
}
.mode-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-sub);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    flex-shrink: 0;
}
.mode-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ── AI Floating Action Button ── */
.ai-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(108, 92, 231, 0.4);
    cursor: pointer;
    z-index: 10000;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(255, 255, 255, 0.2);
}
.ai-fab:hover { transform: scale(1.1) rotate(5deg); }
.ai-fab svg  { color: white; margin-bottom: 2px; }
.ai-fab span { color: white; font-size: 0.5rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }

/* ── Chat Window ── */
.ai-chat-window {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 330px;
    max-width: 90vw;
    height: 580px;
    display: none;
    flex-direction: column;
    background: var(--card-bg);
    border-radius: 24px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    z-index: 10001;
    overflow: hidden;
    transition: 0.3s ease;
}
.ai-chat-window.active {
    display: flex;
    animation: aiSlideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes aiSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* ── Chat Header ── */
.chat-header {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    padding: 14px 18px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.chat-header h4 {
    margin: 0;
    font-size: 0.88rem;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.chat-header .pulse-dot {
    width: 8px;
    height: 8px;
    background: #55efc4;
    border-radius: 50%;
    display: inline-block;
    animation: pulseDot 1.5s infinite;
}
@keyframes pulseDot {
    0%   { box-shadow: 0 0 0 0 rgba(85,239,196,0.7); }
    70%  { box-shadow: 0 0 0 8px rgba(85,239,196,0); }
    100% { box-shadow: 0 0 0 0 rgba(85,239,196,0); }
}
.chat-header button {
    background: none;
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    opacity: 0.85;
    transition: opacity 0.2s;
}
.chat-header button:hover { opacity: 1; }

/* ── Chat Body (scrollable message area) ── */
.chat-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--bg);
    position: relative;
}

/* ── Scroll to Bottom Button ── */
.scroll-to-bottom {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.35);
    transition: opacity 0.3s, transform 0.3s;
    opacity: 0;
    pointer-events: none;
    z-index: 5;
}
.scroll-to-bottom:hover { transform: scale(1.1); }

/* ── Messages ── */
.msg {
    padding: 10px 14px;
    border-radius: 16px;
    max-width: 82%;
    line-height: 1.55;
    font-size: 0.85rem;
    word-wrap: break-word;
}
.ai-msg {
    background: var(--card-bg);
    color: var(--text-main);
    align-self: flex-start;
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}
.ai-msg b { color: var(--primary); }
.user-msg {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* ── Chat Footer ── */
.chat-footer {
    flex-shrink: 0;
    padding: 12px 14px;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    align-items: center;
}
.chat-input {
    flex: 1;
    border: 1px solid var(--border);
    background: var(--bg);
    padding: 9px 14px;
    border-radius: 50px;
    color: var(--text-main);
    outline: none;
    font-size: 0.85rem;
    font-family: inherit;
    transition: border-color 0.2s;
}
.chat-input:focus { border-color: var(--primary); }
.chat-send {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    border: none;
    color: white;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.chat-send:hover { transform: scale(1.08); }
