/* Erudite AI Chatbot - Dedicated Plugin CSS */
:root {
    --primary: rgb(255, 0, 0); /* Erudite Red */
    --primary-hover: rgb(210, 0, 0);
    --primary-glow: rgba(255, 0, 0, 0.15);
    --bg-gradient: radial-gradient(circle at 10% 20%, rgb(255, 255, 255) 0%, rgb(238, 239, 242) 100%);
    --bg-accent-glow: radial-gradient(circle at 50% -20%, rgba(255, 0, 0, 0.12), transparent 85%);
    --card-bg: rgba(255, 255, 255, 0.95);
    --card-border: rgba(220, 224, 230, 0.8);
    --card-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.18), 0 0 1px rgba(0, 0, 0, 0.05);
    --text-primary: #0f0f10;
    --text-secondary: #3f3f46;
    --text-muted: #71717a;
    --input-bg: #ffffff;
    --input-border: #d4d4d8;
    --input-focus-border: rgb(255, 0, 0);
    --input-focus-ring: rgba(255, 0, 0, 0.12);
    --error: #dc2626;
    --error-bg: #fff5f5;
    --error-border: #feb2b2;
    --success: #16a34a;
    --success-bg: #f0fdf4;
    --success-border: #bbf7d0;
    --bot-bubble-bg: rgba(244, 244, 245, 0.95);
    --bot-bubble-border: rgba(228, 228, 231, 0.9);
    --user-bubble-bg: linear-gradient(135deg, rgb(255, 30, 30) 0%, rgb(190, 0, 0) 100%);
    --user-bubble-color: #ffffff;
    --pill-bg: #ffffff;
    --pill-border: #e4e4e7;
    --pill-hover-border: #a1a1aa;
    --pill-checked-bg: rgba(255, 0, 0, 0.04);
    --pill-checked-border: rgb(255, 0, 0);
    --ticket-bg: #fafafa;
    --ticket-border: #e4e4e7;
    --scroll-thumb: #d4d4d8;
}

body.erudite-dark-theme,
.erudite-chat-modal-wrapper.dark-theme {
    --primary: rgb(255, 30, 30);
    --primary-hover: rgb(255, 70, 70);
    --primary-glow: rgba(255, 30, 30, 0.25);
    --bg-gradient: radial-gradient(circle at 10% 20%, rgb(24, 24, 28) 0%, rgb(8, 8, 10) 100%);
    --bg-accent-glow: radial-gradient(circle at 50% -20%, rgba(255, 30, 30, 0.1), transparent 80%);
    --card-bg: rgba(24, 24, 28, 0.96);
    --card-border: rgba(255, 255, 255, 0.1);
    --card-shadow: 0 35px 70px -15px rgba(0, 0, 0, 0.6);
    --text-primary: #f4f4f5;
    --text-secondary: #d4d4d8;
    --text-muted: #91919c;
    --input-bg: #141417;
    --input-border: #27272a;
    --input-focus-border: rgb(255, 30, 30);
    --input-focus-ring: rgba(255, 30, 30, 0.2);
    --error: #f87171;
    --error-bg: rgba(239, 68, 68, 0.08);
    --error-border: rgba(239, 68, 68, 0.25);
    --success: #4ade80;
    --success-bg: rgba(74, 222, 128, 0.08);
    --success-border: rgba(74, 222, 128, 0.25);
    --bot-bubble-bg: rgba(39, 39, 42, 0.95);
    --bot-bubble-border: rgba(255, 255, 255, 0.06);
    --user-bubble-bg: linear-gradient(135deg, rgb(255, 50, 50) 0%, rgb(200, 0, 0) 100%);
    --user-bubble-color: #ffffff;
    --pill-bg: #1e1e24;
    --pill-border: #2d2d34;
    --pill-hover-border: #52525b;
    --pill-checked-bg: rgba(255, 30, 30, 0.08);
    --pill-checked-border: rgb(255, 30, 30);
    --ticket-bg: rgba(18, 18, 20, 0.6);
    --ticket-border: rgba(255, 255, 255, 0.06);
    --scroll-thumb: #3f3f46;
}

/* Floating Launcher Button & Positions */
.erudite-chatbot-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999990;
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, rgb(255, 0, 0) 0%, rgb(190, 0, 0) 100%);
    color: #ffffff;
    padding: 12px 20px 12px 14px;
    border-radius: 50px;
    box-shadow: 0 10px 25px rgba(255, 0, 0, 0.35);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    user-select: none;
}

.erudite-chatbot-launcher.pos-bottom-left {
    right: auto;
    left: 24px;
}

.erudite-chatbot-launcher.pos-hidden {
    display: none !important;
}

.erudite-chatbot-launcher:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 15px 30px rgba(255, 0, 0, 0.45);
}

.launcher-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.launcher-icon svg {
    width: 24px;
    height: 24px;
}

.launcher-text {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: -0.2px;
}

.launcher-pulse {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background: #4ade80;
    border: 2px solid #ffffff;
    border-radius: 50%;
    animation: launcherPulse 2s infinite;
}

@keyframes launcherPulse {
    0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(74, 222, 128, 0); }
    100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

/* Modal Backdrop & Wrapper */
.erudite-chat-modal-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

.erudite-chat-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 15, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeInBackdrop 0.3s ease;
}

@keyframes fadeInBackdrop {
    from { opacity: 0; }
    to { opacity: 1; }
}

.erudite-chat-modal-container {
    position: relative;
    width: 100%;
    max-width: 980px;
    height: 85vh;
    max-height: 720px;
    z-index: 2;
    animation: modalSlideUp 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.125);
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.erudite-chat-close-btn {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 36px;
    height: 36px;
    background: #000000;
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.erudite-chat-close-btn:hover {
    background: var(--primary);
    transform: scale(1.1);
}

/* Ambient BG Modal Orbs */
.ambient-bg-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    border-radius: 24px;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    animation: floatOrb 25s infinite ease-in-out;
}

.orb-1 { width: 350px; height: 350px; background: var(--primary); top: -10%; left: -10%; }
.orb-2 { width: 400px; height: 400px; background: #b91c1c; bottom: -10%; right: -10%; }

@keyframes floatOrb {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, -30px) scale(1.07); }
    100% { transform: translate(0, 0) scale(1); }
}

/* Dashboard Layout */
.dashboard-wrapper {
    width: 100%;
    height: 100%;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    overflow: hidden;
    position: relative;
}

/* Sidebar Panel */
.sidebar {
    width: 280px;
    min-width: 280px;
    border-right: 1px solid var(--card-border);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed {
    width: 0;
    min-width: 0;
    padding: 24px 0;
    overflow: hidden;
    border-right: none;
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 768px) {
    .sidebar { display: none; }
    .hide-on-mobile { display: none; }
}

.sidebar-section h3 {
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--primary);
    margin-bottom: 10px;
}

.counselor-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 0, 0, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 12px 14px;
}

.profile-pic {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-info { display: flex; flex-direction: column; gap: 2px; }
.profile-name { font-weight: 700; font-size: 0.92rem; color: var(--text-primary); }
.profile-status { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; display: flex; align-items: center; gap: 4px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); animation: pulse 1.8s infinite ease-in-out; }

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.15); }
}

/* Ticket Bubble in Sidebar */
.ticket-bubble {
    padding: 10px;
    font-size: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--ticket-bg);
    border: 1px solid var(--ticket-border);
    border-radius: 10px;
}

.ticket-row {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 3px;
    color: var(--text-primary);
}

.ticket-row span { color: var(--text-muted); font-weight: 600; }

/* FAQ Search & List */
.faq-search-wrapper { position: relative; }
.faq-search-input {
    width: 100%;
    padding: 9px 12px 9px 34px;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    outline: none;
    color: var(--text-primary);
    box-sizing: border-box;
}

.faq-search-input:focus { border-color: var(--primary); }
.faq-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    stroke: var(--text-muted);
    pointer-events: none;
}

.faq-list { list-style: none; display: flex; flex-direction: column; gap: 6px; margin-top: 8px; padding: 0; }
.faq-item {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.faq-item:hover {
    border-color: var(--card-border);
    color: var(--primary);
    background: var(--input-bg);
    transform: translateX(2px);
}

/* Chat Panel */
.chat-panel {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
}

.chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-toggle-btn {
    background: transparent;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    outline: none;
}

.sidebar-toggle-btn:hover { border-color: var(--primary); color: var(--primary); }
.chat-header-info h2 { font-size: 1.05rem; font-weight: 800; color: var(--text-primary); margin: 0; }
.chat-header-info p { font-size: 0.75rem; color: var(--text-muted); margin: 0; }

.theme-toggle-btn {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.theme-toggle-btn:hover { border-color: var(--primary); transform: scale(1.05); }

/* Message Log Area */
.message-log {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

.message-row {
    display: flex;
    width: 100%;
    animation: bubbleEntrance 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.125) forwards;
    opacity: 0;
    transform: scale(0.96) translateY(5px);
}

@keyframes bubbleEntrance {
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.message-row.bot { justify-content: flex-start; }
.message-row.user { justify-content: flex-end; }

.bubble {
    max-width: 82%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.45;
    word-break: break-word;
}

.bot .bubble {
    background: var(--bot-bubble-bg);
    border: 1px solid var(--bot-bubble-border);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.user .bubble {
    background: var(--user-bubble-bg);
    color: var(--user-bubble-color);
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 14px rgba(255, 0, 0, 0.15);
}

/* Quick-reply button container */
.options-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.pill-button {
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    background: var(--pill-bg);
    border: 1.5px solid var(--pill-border);
    border-radius: 20px;
    padding: 7px 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.pill-button:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.pill-button.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.pill-button.primary:hover {
    background: var(--primary-hover);
}

/* Typing Bubble */
.typing-bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    border-radius: 16px;
    background: var(--bot-bubble-bg);
    border: 1px solid var(--bot-bubble-border);
    width: fit-content;
    border-bottom-left-radius: 4px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: bounceDot 1.4s infinite ease-in-out;
}

.dot-1 { animation-delay: -0.32s; }
.dot-2 { animation-delay: -0.16s; }

@keyframes bounceDot {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Footer Chat Input */
.chat-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-bar {
    display: flex;
    gap: 10px;
    position: relative;
    align-items: center;
}

.chat-input {
    flex-grow: 1;
    padding: 12px 40px 12px 16px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    border-radius: 10px;
    outline: none;
    box-sizing: border-box;
}

.chat-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn-send {
    position: absolute;
    right: 10px;
    background: transparent;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
}

.btn-send:hover { color: var(--primary-hover); transform: scale(1.08); }
.btn-send svg { width: 18px; height: 18px; fill: currentColor; }

/* Review Panel */
.review-panel {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 12px;
    background: var(--input-bg);
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
    margin-top: 8px;
}

.review-section h4 {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
    margin-bottom: 4px;
    font-weight: 800;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 2px;
}

.review-grid {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 4px 8px;
    font-size: 0.8rem;
}

.review-grid dt { font-weight: 700; color: var(--text-muted); }
.review-grid dd { color: var(--text-primary); font-weight: 500; margin: 0; }

.pill-box-inline { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.pill-box-inline input { accent-color: var(--primary); margin: 0; }
