/* ========================================
   AGENT MODE - MIA Chat Interface
   ======================================== */

/* Agent Mode Button in Toggle — icon-only on dashboard */
.mode-btn.agent-mode-btn {
    max-width: 32px;
    background: linear-gradient(135deg, rgba(45, 184, 76, 0.2), rgba(245, 166, 35, 0.2));
    border: 1px solid rgba(45, 184, 76, 0.3);
}

/* When active (on agent page), let it expand for text */
.mode-btn.agent-mode-btn.active {
    max-width: none;
}

.mode-btn.agent-mode-btn:hover {
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent-gold)) !important;
    transform: scale(1.1);
}

.mode-btn.agent-mode-btn i {
    color: var(--color-primary);
}

.mode-btn.agent-mode-btn:hover i {
    color: white;
}

/* Agent Chat Overlay */
.agent-chat-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.agent-chat-overlay.open {
    display: flex;
    opacity: 1;
}

.agent-chat-container {
    width: 90%;
    max-width: 800px;
    height: 85vh;
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-glass-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.95);
    }

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

/* Chat Header */
.agent-chat-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    border-bottom: 1px solid var(--color-glass-border);
    background: var(--color-glass);
}

.agent-chat-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent-gold));
    box-shadow: 0 0 20px var(--color-primary-glow);
}

.agent-chat-avatar video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    mix-blend-mode: screen;
}

.agent-chat-title {
    flex: 1;
}

.agent-chat-title h2 {
    font-size: 1.3rem;
    margin-bottom: 4px;
}

.agent-chat-title p {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin: 0;
}

.agent-chat-close {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--color-glass);
    border: 1px solid var(--color-glass-border);
    color: var(--color-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.agent-chat-close:hover {
    background: var(--color-error);
    border-color: var(--color-error);
    color: white;
}

.agent-chat-close i {
    font-size: 1.2rem;
}

/* Chat Messages */
.agent-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.agent-message {
    display: flex;
    max-width: 80%;
}

.agent-message.mia {
    align-self: flex-start;
}

.agent-message.user {
    align-self: flex-end;
}

.message-bubble {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-lg);
    font-size: 0.95rem;
    line-height: 1.5;
}

.agent-message.mia .message-bubble {
    background: linear-gradient(135deg, var(--color-primary-glow), transparent);
    border: 1px solid var(--color-primary);
    border-bottom-left-radius: 4px;
}

.agent-message.user .message-bubble {
    background: var(--color-glass);
    border: 1px solid var(--color-glass-border);
    border-bottom-right-radius: 4px;
}

/* Chat Input */
.agent-chat-input {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-lg);
    border-top: 1px solid var(--color-glass-border);
    background: var(--color-glass);
}

.agent-chat-input input {
    flex: 1;
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-glass-border);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.95rem;
    font-family: var(--font-family-primary);
}

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

.agent-send-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--color-primary-glow);
}

.agent-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px var(--color-primary-glow);
}

.agent-send-btn i {
    font-size: 1.3rem;
}

/* ========================================
   AGENT MODE - Full Page Experience (v4.0)
   Clean AI conversation interface
   ======================================== */

/* Hidden by default */
.agent-mode-section {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-bg);
    z-index: 1000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
}

/* Show when agent mode is active */
body.agent-mode .agent-mode-section {
    display: flex;
}

/* Smooth page-exit animation */
body.agent-mode.page-exit .agent-mode-section {
    animation: agentPageExit 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes agentPageExit {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: scale(0.97);
    }
}

/* Hide everything else in agent mode (keep top bar for settings) */
body.agent-mode .sidebar,
body.agent-mode .main-content,
body.agent-mode .mia-fab {
    display: none !important;
}

/* Hide most of top bar but keep settings controls visible */
body.agent-mode .top-bar {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    left: auto;
    background: transparent;
    border: none;
    padding: 0;
    z-index: 1001;
    width: auto;
    display: flex !important;
}

[dir="rtl"] body.agent-mode .top-bar {
    right: auto;
    left: var(--space-lg);
}

body.agent-mode .top-bar .welcome-text,
body.agent-mode .top-bar .search-box,
body.agent-mode .top-bar .notification-btn,
body.agent-mode .top-bar .mode-toggle,
body.agent-mode .top-bar .top-actions-divider {
    display: none !important;
}

body.agent-mode .top-bar .top-bar-actions {
    display: flex !important;
    gap: var(--space-sm);
}

/* Agent mode uses the same settings-group component - positioning via .agent-mode-settings */

/* Centered Mode Toggle in Agent Mode */
.agent-mode-header {
    position: absolute;
    top: var(--space-xl);
    left: 50%;
    transform: translateX(-50%);
}

.agent-mode-toggle {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
}

/* Chat Wrapper - Centered Container */
.agent-chat-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 700px;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* When conversation has started, move up */
body.agent-mode.has-messages .agent-chat-wrapper {
    justify-content: flex-start;
    margin-top: 100px;
}

/* MIA Avatar - Large Centered */
.agent-mia-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(45, 184, 76, 0.4);
    box-shadow: 0 0 20px rgba(45, 184, 76, 0.15);
    margin-bottom: var(--space-lg);
    /* Smooth spring-like animation */
    transition:
        width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
        height 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
        top 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        right 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        left 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        margin 0.4s ease-out,
        box-shadow 0.3s ease;
}

body.agent-mode.has-messages .agent-mia-avatar {
    width: 60px;
    height: 60px;
    position: fixed;
    top: var(--space-xl);
    left: var(--space-xl);
    margin-bottom: 0;
    box-shadow: 0 0 15px rgba(45, 184, 76, 0.1);
}

[dir="rtl"] body.agent-mode.has-messages .agent-mia-avatar {
    right: auto;
    left: var(--space-xl);
}

.agent-mia-avatar video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Welcome Message */
.agent-welcome {
    text-align: center;
    margin-bottom: var(--space-xl);
    transition: all 0.5s ease;
}

.agent-welcome h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
    background: linear-gradient(135deg, var(--color-text) 0%, var(--color-text-muted) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.agent-welcome p {
    font-size: 1.1rem;
    color: var(--color-text-muted);
}

/* Hide welcome when conversation starts */
body.agent-mode.has-messages .agent-welcome {
    display: none;
}

/* Messages Container */
.agent-messages {
    width: 100%;
    max-height: 50vh;
    overflow-y: auto;
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
    display: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(45, 184, 76, 0.3) transparent;
}

.agent-messages::-webkit-scrollbar {
    width: 6px;
}

.agent-messages::-webkit-scrollbar-track {
    background: transparent;
}

.agent-messages::-webkit-scrollbar-thumb {
    background: rgba(45, 184, 76, 0.3);
    border-radius: 3px;
}

.agent-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(45, 184, 76, 0.5);
}

body.agent-mode.has-messages .agent-messages {
    display: block;
}

/* Individual Message */
.agent-msg {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    animation: messageFadeIn 0.3s ease-out;
}

@keyframes messageFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.agent-msg.user {
    flex-direction: row-reverse;
}

[dir="rtl"] .agent-msg.user {
    flex-direction: row;
}

.agent-msg .msg-bubble {
    max-width: 70%;
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-lg);
    line-height: 1.5;
    font-size: 0.95rem;
}

.agent-msg.mia .msg-bubble {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 3px solid rgba(45, 184, 76, 0.5);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

[dir="rtl"] .agent-msg.mia .msg-bubble {
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    border-right: 3px solid rgba(45, 184, 76, 0.5);
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: 4px;
}

.agent-msg.user .msg-bubble {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 12px var(--color-primary-glow);
}

/* Navigation links in MIA responses */
.agent-msg.mia .msg-bubble a {
    color: var(--color-primary);
    text-decoration: underline;
    text-decoration-color: rgba(45, 184, 76, 0.4);
    text-underline-offset: 2px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.agent-msg.mia .msg-bubble a:hover {
    color: var(--color-primary-hover);
    text-decoration-color: var(--color-primary);
}

[dir="rtl"] .agent-msg.user .msg-bubble {
    border-bottom-right-radius: var(--radius-lg);
    border-bottom-left-radius: 4px;
}

/* Input Wrapper */
.agent-input-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.agent-input-container {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--color-glass);
    border: 1px solid var(--color-glass-border);
    border-radius: 60px;
    transition: all 0.3s ease;
}

.agent-input-container:focus-within {
    border-color: rgba(45, 184, 76, 0.5);
    outline: none;
}

.agent-input-container:focus,
.agent-input-container *:focus {
    outline: none;
}

.agent-input {
    flex: 1;
    padding: var(--space-md) var(--space-lg);
    background: transparent;
    border: none;
    color: var(--color-text);
    font-size: 1rem;
    font-family: var(--font-family-primary);
}

.agent-input:focus {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

.agent-input::placeholder {
    color: var(--color-text-dim);
}

/* Suggestions */
.agent-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    justify-content: center;
}

/* Hide suggestions when conversation starts */
body.agent-mode.has-messages .agent-suggestions {
    display: none;
}

.suggestion-chip {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-glass);
    border: 1px solid var(--color-glass-border);
    border-radius: 50px;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.suggestion-chip:hover {
    background: var(--color-glass-hover);
    color: var(--color-text);
    border-color: var(--color-primary);
    transform: translateY(-2px);
}

.suggestion-chip i {
    font-size: 1rem;
    color: var(--color-primary);
}

/* Light Mode Overrides */
html[data-theme="light"] .agent-mode-section {
    background: var(--color-bg);
}

html[data-theme="light"] .agent-input-container {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .suggestion-chip {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.08);
}

/* ==========================================
   AGENT MODE SIDEBAR
   ========================================== */

.agent-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: rgba(18, 18, 22, 0.4);
    border-right: 1px solid rgba(255, 255, 255, 0.04);
    padding: var(--space-lg) var(--space-md);
    display: none;
    flex-direction: column;
    gap: var(--space-sm);
    z-index: 1000;
    backdrop-filter: blur(40px) saturate(1.2);
    -webkit-backdrop-filter: blur(40px) saturate(1.2);
    font-family: var(--font-family-primary);
    transform: translateX(0);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity 0.3s ease;
}

[dir="rtl"] .agent-sidebar {
    left: auto;
    right: 0;
    border-right: none;
    border-left: 1px solid rgba(255, 255, 255, 0.04);
    transform: translateX(0);
}

body.agent-mode .agent-sidebar {
    display: flex;
}

/* Hide sidebar on mobile by default */
@media (max-width: 768px) {
    .agent-sidebar {
        transform: translateX(-100%);
    }

    [dir="rtl"] .agent-sidebar {
        transform: translateX(100%);
    }

    body.agent-mode.sidebar-open .agent-sidebar {
        transform: translateX(0);
    }
}

/* ========================================
   AGENT MODE - POSITIONING ONLY
   (Reuses existing .notification-btn, .mode-btn, .settings-group)
   ======================================== */

/* Sidebar Toggle - position only, reuses .notification-btn */
.agent-sidebar-toggle {
    position: fixed;
    top: var(--space-lg);
    left: var(--space-lg);
    z-index: 1001;
    display: none;
}

[dir="rtl"] .agent-sidebar-toggle {
    left: auto;
    right: var(--space-lg);
}

body.agent-mode .agent-sidebar-toggle {
    display: flex;
}

/* Hide toggle on desktop */
@media (min-width: 769px) {
    body.agent-mode .agent-sidebar-toggle {
        display: none;
    }
}

/* Hide toggle when sidebar is open */
body.agent-mode.sidebar-open .agent-sidebar-toggle {
    opacity: 0;
    pointer-events: none;
}

/* Settings - position only, reuses .settings-group + .notification-btn */
.agent-mode-settings {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: 1002;
    display: none;
}

[dir="rtl"] .agent-mode-settings {
    right: auto;
    left: var(--space-lg);
}

body.agent-mode .agent-mode-settings {
    display: flex;
}

/* Sidebar Header - flex row */
.agent-sidebar-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

/* Close button in sidebar - mobile only */
.agent-sidebar-header .notification-btn {
    display: none;
}

@media (max-width: 768px) {
    .agent-sidebar-header .notification-btn {
        display: flex;
    }
}

/* New Chat button extends mode-btn */
.agent-new-chat {
    flex: 1;
    justify-content: center;
}


/* Chat Actions (rename/delete) */
.chat-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.chat-history-item:hover .chat-actions {
    opacity: 1;
}

.chat-action-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--color-text-dim);
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text);
}

.chat-action-btn.delete:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.chat-history-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    scrollbar-width: thin;
    scrollbar-color: rgba(45, 184, 76, 0.3) transparent;
}

.chat-history-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.chat-history-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--color-glass-border);
}

.chat-history-item.active {
    background: rgba(45, 184, 76, 0.1);
    border-color: rgba(45, 184, 76, 0.3);
}

.chat-history-item i.chat-icon {
    color: var(--color-text-dim);
    font-size: 1rem;
    flex-shrink: 0;
}

.chat-history-item .chat-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-history-item .chat-title {
    font-size: 0.9rem;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--font-family-primary);
}

.chat-history-item .chat-time {
    font-size: 0.75rem;
    color: var(--color-text-dim);
}

/* Sidebar overlays content - doesn't push */
body.agent-mode .agent-chat-wrapper {
    margin-left: 0;
}

[dir="rtl"] body.agent-mode .agent-chat-wrapper {
    margin-right: 0;
}

/* ==========================================
   MIA CONTENT CARDS — Rich Interactive Style
   ========================================== */

.mia-cards-container {
    display: flex;
    flex-wrap: nowrap;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    overflow-x: auto;
    padding-bottom: var(--space-xs);
    scrollbar-width: thin;
    scrollbar-color: rgba(45, 184, 76, 0.3) transparent;
    max-width: 70%;
}

/* Rich interactive card */
.mia-card {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 3px solid var(--color-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 180px;
}

[dir="rtl"] .mia-card {
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-right: 3px solid var(--color-primary);
}

.mia-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* Card type color accents */
.mia-card[data-type="assessment"] {
    border-left-color: #3b82f6;
}

[dir="rtl"] .mia-card[data-type="assessment"] {
    border-left-color: rgba(255, 255, 255, 0.08);
    border-right-color: #3b82f6;
}

.mia-card[data-type="recommendation"] {
    border-left-color: var(--color-accent-gold);
}

[dir="rtl"] .mia-card[data-type="recommendation"] {
    border-left-color: rgba(255, 255, 255, 0.08);
    border-right-color: var(--color-accent-gold);
}

.mia-card[data-type="live"] {
    border-left-color: #ef4444;
}

[dir="rtl"] .mia-card[data-type="live"] {
    border-left-color: rgba(255, 255, 255, 0.08);
    border-right-color: #ef4444;
}

.mia-card-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mia-card[data-type="assessment"] .mia-card-icon {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.mia-card[data-type="recommendation"] .mia-card-icon {
    background: linear-gradient(135deg, var(--color-accent-gold), #e6a817);
}

.mia-card[data-type="live"] .mia-card-icon {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.mia-card-icon i {
    font-size: 1rem;
    color: white;
}

.mia-card-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.mia-card-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text);
}

.mia-card-subtitle {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.mia-card-action {
    margin-left: auto;
    padding: 4px 12px;
    background: rgba(45, 184, 76, 0.15);
    color: var(--color-primary);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

[dir="rtl"] .mia-card-action {
    margin-left: 0;
    margin-right: auto;
}

.mia-card:hover .mia-card-action {
    background: var(--color-primary);
    color: white;
}

/* ==========================================
   SPECIALIZED MIA RESPONSE CARDS
   ========================================== */

/* Shared response base */
.mia-response {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 220px;
    flex-shrink: 0;
}

.mia-response:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.mia-response-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

.mia-response-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mia-response-meta {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.mia-response-meta i {
    font-size: 0.85rem;
}

/* ── Course Preview Card ──────────────────── */
.mia-response-course {
    border-left: 3px solid var(--color-primary);
    min-width: 280px;
}

[dir="rtl"] .mia-response-course {
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-right: 3px solid var(--color-primary);
}

.mia-response-thumb {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(45, 184, 76, 0.2), rgba(45, 184, 76, 0.05));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mia-response-thumb i {
    font-size: 1.8rem;
    color: var(--color-primary);
}

.mia-progress-bar {
    position: relative;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    overflow: hidden;
    margin-top: 6px;
    width: 100%;
}

.mia-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), #4ade80);
    border-radius: 6px;
    transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[dir="rtl"] .mia-progress-fill {
    left: auto;
    right: 0;
}

.mia-progress-label {
    position: absolute;
    right: 0;
    top: -16px;
    font-size: 0.7rem;
    color: var(--color-primary);
    font-weight: 600;
}

[dir="rtl"] .mia-progress-label {
    right: auto;
    left: 0;
}

/* ── Instructor Profile Card ─────────────── */
.mia-response-instructor {
    border-left: 3px solid var(--color-accent-gold);
    min-width: 260px;
}

[dir="rtl"] .mia-response-instructor {
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-right: 3px solid var(--color-accent-gold);
}

.mia-response-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.25), rgba(251, 191, 36, 0.05));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.mia-response-avatar i {
    font-size: 1.4rem;
    color: var(--color-accent-gold);
}

.mia-response-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    margin-top: 2px;
}

.rating-stars {
    color: var(--color-accent-gold);
    font-size: 0.7rem;
    letter-spacing: -1px;
}

.rating-value {
    color: var(--color-text);
    font-weight: 600;
}

.rating-divider {
    color: var(--color-text-dim);
}

.rating-students {
    color: var(--color-text-muted);
}

/* ── Friend Chat Card ────────────────────── */
.mia-response-friend {
    border-left: 3px solid #8b5cf6;
    min-width: 220px;
}

[dir="rtl"] .mia-response-friend {
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-right: 3px solid #8b5cf6;
}

.mia-response-friend .mia-response-avatar {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(139, 92, 246, 0.05));
}

.mia-response-friend .mia-response-avatar i {
    color: #8b5cf6;
}

.mia-response-friend .mia-card-action {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

.mia-response-friend:hover .mia-card-action {
    background: #8b5cf6;
    color: white;
}

.online-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid rgba(18, 18, 22, 0.9);
    animation: onlinePulse 2s infinite;
}

@keyframes onlinePulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
    }

    50% {
        box-shadow: 0 0 0 4px rgba(34, 197, 94, 0);
    }
}

/* ── Live Session Card ───────────────────── */
.mia-response-live {
    border-left: 3px solid #ef4444;
    min-width: 260px;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
}

[dir="rtl"] .mia-response-live {
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-right: 3px solid #ef4444;
    align-items: flex-end;
}

.mia-live-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    background: rgba(239, 68, 68, 0.15);
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    color: #ef4444;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.live-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    animation: livePulse 1.5s infinite;
}

@keyframes livePulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.4;
        transform: scale(0.8);
    }
}

.mia-response-live .mia-response-body {
    width: 100%;
}

.mia-card-action-live {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444 !important;
    align-self: flex-end;
}

.mia-response-live:hover .mia-card-action-live {
    background: #ef4444 !important;
    color: white !important;
}

/* ── Course List Card ────────────────────── */
.mia-response-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--space-xs);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-lg);
    min-width: 240px;
    max-width: 300px;
}

.mia-list-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.mia-list-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.mia-list-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
}

.mia-list-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.mia-list-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mia-list-sub {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* ── Quick Action Grid ───────────────────── */
.mia-response-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xs);
    padding: var(--space-xs);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-lg);
    min-width: 240px;
    max-width: 280px;
}

.mia-action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--space-md) var(--space-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.mia-action-item:hover {
    background: color-mix(in srgb, var(--action-color) 10%, transparent);
    border-color: color-mix(in srgb, var(--action-color) 30%, transparent);
    transform: translateY(-2px);
}

.mia-action-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--action-color) 15%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mia-action-icon i {
    font-size: 1.2rem;
    color: var(--action-color);
}

.mia-action-label {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--color-text);
}

.mia-action-sublabel {
    font-size: 0.7rem;
    color: var(--color-text-muted);
}

/* ==========================================
   TYPING INDICATOR
   ========================================== */

.typing-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-md) var(--space-lg);
    background: var(--color-glass);
    border-radius: var(--radius-lg);
    width: fit-content;
}

.typing-indicator .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary);
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-indicator .dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator .dot:nth-child(2) {
    animation-delay: -0.16s;
}

.typing-indicator .dot:nth-child(3) {
    animation-delay: 0s;
}

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ==========================================
   LIGHT MODE — Premium Overrides
   ========================================== */

html[data-theme="light"] .agent-sidebar {
    background: rgba(255, 255, 255, 0.75);
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.04);
}

html[data-theme="light"] .chat-history-item {
    background: transparent;
}

html[data-theme="light"] .chat-history-item:hover {
    background: rgba(0, 0, 0, 0.03);
}

html[data-theme="light"] .chat-history-item .chat-title {
    color: rgba(0, 0, 0, 0.55);
}

html[data-theme="light"] .chat-history-item:hover .chat-title {
    color: rgba(0, 0, 0, 0.7);
}

html[data-theme="light"] .chat-history-item.active {
    background: rgba(45, 184, 76, 0.06);
}

html[data-theme="light"] .chat-history-item.active .chat-title {
    color: rgba(0, 0, 0, 0.9);
}

html[data-theme="light"] .chat-action-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

/* Light mode — Chat Bubbles */
html[data-theme="light"] .agent-msg.mia .msg-bubble {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-left: 3px solid rgba(45, 184, 76, 0.4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

[dir="rtl"] html[data-theme="light"] .agent-msg.mia .msg-bubble,
html[data-theme="light"] [dir="rtl"] .agent-msg.mia .msg-bubble {
    border-left: 1px solid rgba(0, 0, 0, 0.06);
    border-right: 3px solid rgba(45, 184, 76, 0.4);
}

html[data-theme="light"] .agent-msg.user .msg-bubble {
    box-shadow: 0 2px 10px rgba(45, 184, 76, 0.2);
}

/* Light mode — MIA Cards */
html[data-theme="light"] .mia-card {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-left: 3px solid var(--color-primary);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
}

[dir="rtl"] html[data-theme="light"] .mia-card,
html[data-theme="light"] [dir="rtl"] .mia-card {
    border-left: 1px solid rgba(0, 0, 0, 0.06);
    border-right: 3px solid var(--color-primary);
}

html[data-theme="light"] .mia-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .mia-card[data-type="assessment"] {
    border-left-color: #3b82f6;
}

[dir="rtl"] html[data-theme="light"] .mia-card[data-type="assessment"],
html[data-theme="light"] [dir="rtl"] .mia-card[data-type="assessment"] {
    border-left-color: rgba(0, 0, 0, 0.06);
    border-right-color: #3b82f6;
}

html[data-theme="light"] .mia-card[data-type="recommendation"] {
    border-left-color: var(--color-accent-gold);
}

[dir="rtl"] html[data-theme="light"] .mia-card[data-type="recommendation"],
html[data-theme="light"] [dir="rtl"] .mia-card[data-type="recommendation"] {
    border-left-color: rgba(0, 0, 0, 0.06);
    border-right-color: var(--color-accent-gold);
}

html[data-theme="light"] .mia-card[data-type="live"] {
    border-left-color: #ef4444;
}

[dir="rtl"] html[data-theme="light"] .mia-card[data-type="live"],
html[data-theme="light"] [dir="rtl"] .mia-card[data-type="live"] {
    border-left-color: rgba(0, 0, 0, 0.06);
    border-right-color: #ef4444;
}

/* Light mode — Input & Suggestions */
html[data-theme="light"] .agent-input-container {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

html[data-theme="light"] .suggestion-chip {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

html[data-theme="light"] .typing-indicator {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* ==========================================
   RIGHT-SIDE SHOWCASE PANEL
   ========================================== */

.agent-showcase {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    background: rgba(18, 18, 22, 0.3);
    border-left: 1px solid rgba(255, 255, 255, 0.04);
    padding: var(--space-xl) var(--space-md);
    padding-top: 90px;
    display: none;
    flex-direction: column;
    gap: var(--space-lg);
    z-index: 999;
    backdrop-filter: blur(40px) saturate(1.2);
    -webkit-backdrop-filter: blur(40px) saturate(1.2);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(45, 184, 76, 0.2) transparent;
}

[dir="rtl"] .agent-showcase {
    right: auto;
    left: 0;
    border-left: none;
    border-right: 1px solid rgba(255, 255, 255, 0.04);
}

body.agent-mode .agent-showcase {
    display: flex;
}

/* Hide showcase when conversation starts */
body.agent-mode.has-messages .agent-showcase {
    display: none;
}

/* Override — keep showcase when guide is pinned */
body.agent-mode.has-messages.guide-pinned .agent-showcase {
    display: flex;
}

/* Showcase Pin Toggle */
.showcase-pin-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
}

.pin-toggle-label {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.8rem;
    color: var(--color-text-muted);
    cursor: pointer;
    user-select: none;
}

.pin-toggle-label i {
    font-size: 1rem;
    color: var(--color-text-dim);
    transition: color 0.3s ease;
}

.pin-toggle-btn {
    position: relative;
    width: 40px;
    height: 22px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    padding: 0;
}

.pin-toggle-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-text-dim);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[dir="rtl"] .pin-toggle-knob {
    left: auto;
    right: 2px;
}

/* Active (pinned) state */
body.guide-pinned .pin-toggle-btn {
    background: rgba(45, 184, 76, 0.25);
    border-color: rgba(45, 184, 76, 0.4);
}

body.guide-pinned .pin-toggle-knob {
    left: 20px;
    background: var(--color-primary);
}

[dir="rtl"] body.guide-pinned .pin-toggle-knob {
    left: auto;
    right: 20px;
}

body.guide-pinned .pin-toggle-label i {
    color: var(--color-primary);
}

/* Light mode pin toggle */
html[data-theme="light"] .showcase-pin-toggle {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .pin-toggle-btn {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.1);
}

/* Hide on mobile */
@media (max-width: 1024px) {
    .agent-showcase {
        display: none !important;
    }
}

/* MIA Animation Container */
.showcase-mia-animation {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto;
    border: 2px solid rgba(45, 184, 76, 0.3);
    box-shadow:
        0 0 30px rgba(45, 184, 76, 0.1),
        0 0 60px rgba(45, 184, 76, 0.05);
    transition: all 0.5s ease;
}

.showcase-mia-animation:hover {
    box-shadow:
        0 0 40px rgba(45, 184, 76, 0.2),
        0 0 80px rgba(45, 184, 76, 0.1);
    transform: scale(1.05);
}

.showcase-mia-animation video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Showcase Sections */
.showcase-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.showcase-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin: 0;
}

/* Getting Started Suggestion Chips */
.showcase-suggestions {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.showcase-chip {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    font-size: 0.85rem;
    font-family: var(--font-family-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: start;
}

.showcase-chip:hover {
    background: rgba(45, 184, 76, 0.1);
    border-color: rgba(45, 184, 76, 0.3);
    color: var(--color-text);
    transform: translateX(-4px);
}

[dir="rtl"] .showcase-chip:hover {
    transform: translateX(4px);
}

.showcase-chip i {
    font-size: 1.1rem;
    color: var(--color-primary);
    flex-shrink: 0;
}

/* Response Style Previews */
.showcase-styles {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.style-preview {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.style-preview:hover {
    background: rgba(255, 255, 255, 0.06);
}

.style-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.style-icon i {
    font-size: 0.9rem;
    color: white;
}

.style-icon.accent-blue {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.style-icon.accent-gold {
    background: linear-gradient(135deg, var(--color-accent-gold), #e6a817);
}

.style-info {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

/* Showcase — Light Mode */
html[data-theme="light"] .agent-showcase {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow: -2px 0 20px rgba(0, 0, 0, 0.04);
}

[dir="rtl"] html[data-theme="light"] .agent-showcase,
html[data-theme="light"] [dir="rtl"] .agent-showcase {
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.04);
}

html[data-theme="light"] .showcase-title {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .showcase-chip {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .showcase-chip:hover {
    background: rgba(45, 184, 76, 0.06);
    border-color: rgba(45, 184, 76, 0.2);
}

html[data-theme="light"] .style-preview {
    background: rgba(0, 0, 0, 0.02);
}

html[data-theme="light"] .style-preview:hover {
    background: rgba(0, 0, 0, 0.04);
}