/* ============================================
   MLTutor AI Assistant - Neo-Academic Cyberpunk
   "深夜实验室" 美学
   ============================================ */

/* Import distinctive fonts */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&display=swap');

/* CSS Variables - Dark Academic Theme */
:root {
    /* Core palette - Night lab */
    --ai-bg-deep: #030712;
    --ai-bg-base: #0f172a;
    --ai-bg-elevated: #1e293b;
    --ai-bg-card: #1e293b;
    --ai-bg-surface: #334155;

    /* Electric accents */
    --ai-cyan: #06b6d4;
    --ai-cyan-glow: rgba(6, 182, 212, 0.4);
    --ai-cyan-dim: #0891b2;
    --ai-amber: #f59e0b;
    --ai-amber-glow: rgba(245, 158, 11, 0.4);
    --ai-emerald: #10b981;
    --ai-emerald-glow: rgba(16, 185, 129, 0.4);
    --ai-rose: #f43f5e;
    --ai-rose-glow: rgba(244, 63, 94, 0.4);

    /* Text hierarchy */
    --ai-text-bright: #f8fafc;
    --ai-text-primary: #e2e8f0;
    --ai-text-secondary: #94a3b8;
    --ai-text-muted: #64748b;
    --ai-text-dim: #475569;

    /* Borders & effects */
    --ai-border: rgba(148, 163, 184, 0.1);
    --ai-border-bright: rgba(6, 182, 212, 0.3);
    --ai-glow: 0 0 40px var(--ai-cyan-glow);
    --ai-glow-amber: 0 0 40px var(--ai-amber-glow);
    --ai-glow-sm: 0 0 20px var(--ai-cyan-glow);

    /* Typography */
    --ai-font-mono: 'JetBrains Mono', 'Consolas', monospace;
    --ai-font-sans: 'IBM Plex Sans', 'Noto Sans SC', sans-serif;

    /* Animation curves */
    --ai-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ai-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================
   AI Toggle Button - The Power Core
   ============================================ */
.ai-toggle-btn {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--ai-bg-elevated) 0%, var(--ai-bg-base) 100%);
    border: 1px solid var(--ai-border-bright);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s var(--ai-ease-out);
    box-shadow:
        var(--ai-glow-sm),
        inset 0 1px 0 rgba(255,255,255,0.05);
    overflow: hidden;
}

.ai-toggle-btn::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, var(--ai-cyan) 0%, var(--ai-amber) 100%);
    border-radius: 18px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.4s;
}

.ai-toggle-btn::after {
    content: '';
    position: absolute;
    inset: 1px;
    background: var(--ai-bg-elevated);
    border-radius: 15px;
    z-index: -1;
}

.ai-toggle-btn:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: var(--ai-glow);
}

.ai-toggle-btn:hover::before {
    opacity: 1;
}

.ai-toggle-btn svg {
    width: 28px;
    height: 28px;
    fill: var(--ai-cyan);
    transition: all 0.3s;
    filter: drop-shadow(0 0 8px var(--ai-cyan-glow));
}

.ai-toggle-btn:hover svg {
    fill: var(--ai-text-bright);
    transform: scale(1.1);
}

.ai-toggle-btn.active {
    border-color: var(--ai-emerald);
    box-shadow: 0 0 30px var(--ai-emerald-glow);
}

.ai-toggle-btn.active svg {
    fill: var(--ai-emerald);
    filter: drop-shadow(0 0 8px var(--ai-emerald-glow));
}

/* Notification badge - Status indicator */
.ai-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 22px;
    height: 22px;
    background: var(--ai-rose);
    color: white;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--ai-font-mono);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: 0 0 20px var(--ai-rose-glow);
    animation: badge-pulse 2s infinite;
}

@keyframes badge-pulse {
    0%, 100% {
        box-shadow: 0 0 20px var(--ai-rose-glow);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 30px var(--ai-rose-glow);
        transform: scale(1.05);
    }
}

/* ============================================
   AI Chat Panel - The Terminal Window
   ============================================ */
.ai-chat-panel {
    position: fixed;
    bottom: 104px;
    right: 28px;
    width: 420px;
    height: 560px;  /* 固定高度 */
    min-height: 400px;
    max-height: 560px;
    background: var(--ai-bg-base);
    border-radius: 20px;
    border: 1px solid var(--ai-border-bright);
    z-index: 9998;
    display: none;
    flex-direction: column;
    overflow: hidden;
    box-shadow:
        var(--ai-glow),
        0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: panel-appear 0.5s var(--ai-ease-spring);
    resize: both;  /* 允许用户调整大小 */
}

@keyframes panel-appear {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ai-chat-panel.active {
    display: flex;
}

/* Terminal-style header */
.ai-chat-header {
    background: var(--ai-bg-elevated);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--ai-border);
    position: relative;
}

/* macOS-style window buttons */
.ai-chat-header::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 16px;
    transform: translateY(-50%);
    display: flex;
    gap: 8px;
    width: 12px;
    height: 12px;
    background: var(--ai-rose);
    border-radius: 50%;
    box-shadow:
        20px 0 0 var(--ai-amber),
        40px 0 0 var(--ai-emerald);
    opacity: 0.8;
}

.ai-chat-header h3 {
    margin: 0;
    margin-left: 56px;
    font-family: var(--ai-font-mono);
    font-size: 13px;
    font-weight: 500;
    color: var(--ai-text-secondary);
    letter-spacing: 0.5px;
}

.ai-chat-header h3::before {
    content: '>';
    color: var(--ai-cyan);
    margin-right: 8px;
}

.ai-chat-header-actions {
    display: flex;
    gap: 6px;
}

.ai-header-btn {
    background: transparent;
    border: 1px solid var(--ai-border);
    color: var(--ai-text-muted);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.ai-header-btn:hover {
    background: var(--ai-bg-surface);
    color: var(--ai-cyan);
    border-color: var(--ai-cyan);
}

.ai-header-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Chat messages area */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background:
        linear-gradient(180deg, var(--ai-bg-base) 0%, var(--ai-bg-elevated) 100%);
    /* Subtle grid pattern */
    background-image:
        linear-gradient(var(--ai-border) 1px, transparent 1px),
        linear-gradient(90deg, var(--ai-border) 1px, transparent 1px),
        linear-gradient(180deg, var(--ai-bg-base) 0%, var(--ai-bg-elevated) 100%);
    background-size: 20px 20px, 20px 20px, 100% 100%;
}

/* Custom scrollbar for dark theme */
.ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: var(--ai-bg-surface);
    border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--ai-cyan-dim);
}

/* Message bubbles */
.ai-message {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
    font-family: var(--ai-font-sans);
    animation: message-in 0.4s var(--ai-ease-out);
}

@keyframes message-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--ai-cyan-dim) 0%, var(--ai-cyan) 100%);
    color: var(--ai-bg-deep);
    font-weight: 500;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 20px var(--ai-cyan-glow);
}

.ai-message.assistant {
    align-self: flex-start;
    background: var(--ai-bg-elevated);
    color: var(--ai-text-primary);
    border: 1px solid var(--ai-border);
    border-bottom-left-radius: 4px;
    position: relative;
}

/* Terminal prompt style for assistant */
.ai-message.assistant::before {
    content: '$';
    position: absolute;
    top: 14px;
    left: -24px;
    font-family: var(--ai-font-mono);
    font-size: 12px;
    color: var(--ai-cyan);
    opacity: 0.5;
}

.ai-message .timestamp {
    font-size: 10px;
    font-family: var(--ai-font-mono);
    color: var(--ai-text-muted);
    margin-top: 8px;
    opacity: 0.7;
}

.ai-message .message-content {
    word-break: break-word;
}

/* KaTeX styling for dark theme */
.ai-message .message-content .katex {
    font-size: 1.1em;
}

.ai-message .message-content .katex-display {
    margin: 12px 0;
    overflow-x: auto;
    padding: 8px;
    background: var(--ai-bg-base);
    border-radius: 8px;
    border: 1px solid var(--ai-border);
}

/* Typing indicator */
.ai-typing {
    display: flex;
    gap: 6px;
    padding: 16px 20px;
    background: var(--ai-bg-elevated);
    border: 1px solid var(--ai-border);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

.ai-typing span {
    width: 8px;
    height: 8px;
    background: var(--ai-cyan);
    border-radius: 50%;
    animation: typing-bounce 1.2s infinite;
    box-shadow: 0 0 10px var(--ai-cyan-glow);
}

.ai-typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        background: var(--ai-cyan);
    }
    30% {
        transform: translateY(-10px);
        background: var(--ai-amber);
    }
}

/* Chat input */
.ai-chat-input {
    padding: 16px 20px;
    background: var(--ai-bg-elevated);
    border-top: 1px solid var(--ai-border);
    display: flex;
    gap: 12px;
    align-items: center;
}

.ai-chat-input input {
    flex: 1;
    background: var(--ai-bg-base);
    border: 1px solid var(--ai-border);
    border-radius: 12px;
    padding: 12px 18px;
    font-size: 14px;
    font-family: var(--ai-font-mono);
    color: var(--ai-text-primary);
    outline: none;
    transition: all 0.2s;
}

.ai-chat-input input::placeholder {
    color: var(--ai-text-dim);
    font-style: italic;
}

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

.ai-chat-input button {
    background: linear-gradient(135deg, var(--ai-cyan-dim) 0%, var(--ai-cyan) 100%);
    color: var(--ai-bg-deep);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    font-weight: 600;
}

.ai-chat-input button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px var(--ai-cyan-glow);
}

.ai-chat-input button:disabled {
    background: var(--ai-bg-surface);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ai-chat-input button svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* ============================================
   Bubble Component - Simple Question Bubble
   ============================================ */
.ai-bubble {
    position: fixed;
    bottom: 110px;
    left: 28px;
    max-width: 340px;
    background: var(--ai-bg-base);
    border-radius: 16px;
    border: 1px solid var(--ai-border-bright);
    padding: 20px;
    z-index: 9997;
    display: none;
    box-shadow: var(--ai-glow-sm);
    animation: bubble-in 0.3s var(--ai-ease-spring);
}

@keyframes bubble-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-bubble.active {
    display: block;
}

.ai-bubble-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: 1px solid var(--ai-border);
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--ai-text-muted);
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.ai-bubble-close:hover {
    background: var(--ai-rose);
    border-color: var(--ai-rose);
    color: white;
}

.ai-bubble-content {
    padding-right: 4px;
}

.ai-bubble-question {
    font-size: 14px;
    color: #f8fafc;
    line-height: 1.6;
    margin-bottom: 16px;
}

.ai-bubble-btn.primary {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-family: var(--ai-font-mono);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    background: #06b6d4;
    color: #0f172a;
    border: none;
}

.ai-bubble-btn.primary:hover {
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.4);
}

/* ============================================
   Learning Report Panel - The Dashboard
   ============================================ */
.ai-report-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 7, 18, 0.85);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: overlay-fade 0.3s ease;
}

@keyframes overlay-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.ai-report-overlay.active {
    display: flex;
}

.ai-report-panel {
    background: var(--ai-bg-base);
    width: 92%;
    max-width: 880px;
    max-height: 90vh;
    border-radius: 24px;
    border: 1px solid var(--ai-border-bright);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--ai-glow);
    animation: panel-scale 0.4s var(--ai-ease-spring);
}

@keyframes panel-scale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Report header - Terminal title bar */
.ai-report-header {
    background: var(--ai-bg-elevated);
    padding: 20px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--ai-border);
    position: relative;
}

/* Window dots */
.ai-report-header::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 24px;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: var(--ai-emerald);
    border-radius: 50%;
    box-shadow:
        20px 0 0 var(--ai-amber),
        40px 0 0 var(--ai-rose);
    opacity: 0.9;
}

.ai-report-header h2 {
    margin: 0;
    margin-left: 64px;
    font-family: var(--ai-font-mono);
    font-size: 16px;
    font-weight: 500;
    color: var(--ai-text-secondary);
    letter-spacing: 0.5px;
}

.ai-report-header h2::before {
    content: '$ ./report --format=visual';
    display: block;
    font-size: 11px;
    color: var(--ai-cyan);
    margin-bottom: 4px;
}

.ai-report-close {
    background: transparent;
    border: 1px solid var(--ai-border);
    color: var(--ai-text-muted);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
}

.ai-report-close:hover {
    background: var(--ai-rose);
    border-color: var(--ai-rose);
    color: white;
    transform: rotate(90deg);
}

/* Report body */
.ai-report-body {
    padding: 28px;
    overflow-y: auto;
    background:
        linear-gradient(var(--ai-border) 1px, transparent 1px),
        linear-gradient(90deg, var(--ai-border) 1px, transparent 1px),
        linear-gradient(180deg, var(--ai-bg-base) 0%, var(--ai-bg-elevated) 100%);
    background-size: 24px 24px, 24px 24px, 100% 100%;
}

/* Report Stats - Terminal cards */
.ai-report-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.ai-stat-card {
    background: var(--ai-bg-elevated);
    border: 1px solid var(--ai-border);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
}

/* Top accent bar */
.ai-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--ai-cyan);
    transform: scaleX(0);
    transition: transform 0.3s;
}

/* Corner bracket decoration */
.ai-stat-card::after {
    content: '[]';
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-family: var(--ai-font-mono);
    font-size: 10px;
    color: var(--ai-text-dim);
    opacity: 0.5;
}

.ai-stat-card:hover {
    border-color: var(--ai-cyan);
    transform: translateY(-4px);
    box-shadow: var(--ai-glow-sm);
}

.ai-stat-card:hover::before {
    transform: scaleX(1);
}

.ai-stat-value {
    font-family: var(--ai-font-mono);
    font-size: 32px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
    margin-bottom: 6px;
}

.ai-stat-label {
    font-family: var(--ai-font-mono);
    font-size: 13px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Report Chart Section */
.ai-report-chart {
    background: var(--ai-bg-elevated);
    border: 1px solid var(--ai-border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
}

.ai-report-chart h4 {
    margin: 0 0 20px 0;
    font-family: var(--ai-font-mono);
    font-size: 13px;
    color: var(--ai-text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-report-chart h4::before {
    content: '>';
    color: var(--ai-cyan);
}

/* Progress bars */
.ai-progress-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-progress-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 4px 0;
}

.ai-progress-label {
    width: 120px;
    font-family: var(--ai-font-mono);
    font-size: 12px;
    color: var(--ai-text-primary);
}

.ai-progress-bar {
    flex: 1;
    height: 8px;
    background: var(--ai-bg-surface);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

/* Animated scan line */
.ai-progress-bar::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(6, 182, 212, 0.2) 50%,
        transparent 100%
    );
    animation: scan 2s linear infinite;
}

@keyframes scan {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}

.ai-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1s var(--ai-ease-out);
    position: relative;
    box-shadow: 0 0 12px currentColor;
}

/* Color variations for progress */
.ai-progress-fill[data-level="high"] {
    background: linear-gradient(90deg, var(--ai-emerald) 0%, var(--ai-cyan) 100%);
}

.ai-progress-fill[data-level="mid"] {
    background: linear-gradient(90deg, var(--ai-amber) 0%, var(--ai-cyan) 100%);
}

.ai-progress-fill[data-level="low"] {
    background: linear-gradient(90deg, var(--ai-rose) 0%, var(--ai-amber) 100%);
}

.ai-progress-value {
    width: 50px;
    font-family: var(--ai-font-mono);
    font-size: 12px;
    color: var(--ai-cyan);
    text-align: right;
}

/* Recommendations section */
.ai-report-recommendations {
    background: var(--ai-bg-elevated);
    border: 1px solid var(--ai-border);
    border-radius: 16px;
    padding: 24px;
}

.ai-report-recommendations h4 {
    margin: 0 0 20px 0;
    font-family: var(--ai-font-mono);
    font-size: 13px;
    color: var(--ai-text-secondary);
}

.ai-report-recommendations h4::before {
    content: '# ';
    color: var(--ai-cyan);
}

.ai-recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-recommendation-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    background: var(--ai-bg-base);
    border: 1px solid var(--ai-border);
    border-radius: 12px;
    transition: all 0.2s;
}

.ai-recommendation-item:hover {
    border-color: var(--ai-cyan);
    transform: translateX(8px);
    box-shadow: var(--ai-glow-sm);
}

.ai-recommendation-item div {
    flex: 1;
    font-size: 14px;
    color: var(--ai-text-primary);
}

.ai-recommendation-item a {
    color: var(--ai-cyan);
    text-decoration: none;
    font-family: var(--ai-font-mono);
    font-size: 12px;
    transition: color 0.2s;
}

.ai-recommendation-item a:hover {
    color: var(--ai-amber);
}

/* ============================================
   API Key Modal
   ============================================ */
.ai-api-modal {
    position: fixed;
    inset: 0;
    background: rgba(3, 7, 18, 0.9);
    backdrop-filter: blur(8px);
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
}

.ai-api-modal.active {
    display: flex;
}

.ai-api-modal-content {
    background: var(--ai-bg-base);
    padding: 32px;
    border-radius: 20px;
    border: 1px solid var(--ai-border-bright);
    width: 90%;
    max-width: 420px;
    box-shadow: var(--ai-glow);
}

.ai-api-modal h3 {
    margin: 0 0 8px 0;
    font-family: var(--ai-font-mono);
    font-size: 18px;
    color: var(--ai-text-bright);
}

.ai-api-modal h3::before {
    content: '> ';
    color: var(--ai-cyan);
}

.ai-api-modal p {
    margin: 0 0 24px 0;
    font-size: 14px;
    color: var(--ai-text-secondary);
    line-height: 1.6;
}

.ai-api-modal select,
.ai-api-modal input {
    width: 100%;
    padding: 14px 18px;
    background: var(--ai-bg-elevated);
    border: 1px solid var(--ai-border);
    border-radius: 12px;
    font-size: 14px;
    font-family: var(--ai-font-mono);
    color: var(--ai-text-primary);
    margin-bottom: 14px;
    outline: none;
    transition: all 0.2s;
}

.ai-api-modal select:focus,
.ai-api-modal input:focus {
    border-color: var(--ai-cyan);
    box-shadow: 0 0 0 3px var(--ai-cyan-glow);
}

.ai-api-modal input::placeholder {
    color: var(--ai-text-dim);
}

.ai-api-modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.ai-api-modal-actions button {
    flex: 1;
    padding: 14px;
    border-radius: 12px;
    font-size: 14px;
    font-family: var(--ai-font-mono);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-api-modal-actions .primary {
    background: linear-gradient(135deg, var(--ai-cyan-dim) 0%, var(--ai-cyan) 100%);
    color: var(--ai-bg-deep);
    border: none;
}

.ai-api-modal-actions .primary:hover {
    box-shadow: 0 4px 20px var(--ai-cyan-glow);
}

.ai-api-modal-actions .secondary {
    background: transparent;
    color: var(--ai-text-secondary);
    border: 1px solid var(--ai-border);
}

.ai-api-modal-actions .secondary:hover {
    border-color: var(--ai-text-secondary);
}

/* ============================================
   Settings Panel
   ============================================ */
.ai-settings-section {
    margin-bottom: 24px;
}

.ai-settings-section h4 {
    margin: 0 0 16px 0;
    font-family: var(--ai-font-mono);
    font-size: 12px;
    color: var(--ai-text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--ai-border);
    padding-bottom: 10px;
}

.ai-settings-section h4::before {
    content: '# ';
    color: var(--ai-cyan);
}

.ai-setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--ai-border);
}

.ai-setting-label {
    font-size: 14px;
    color: var(--ai-text-primary);
}

.ai-setting-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Toggle switch - Cyber style */
.ai-toggle {
    position: relative;
    width: 48px;
    height: 26px;
}

.ai-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ai-toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--ai-bg-surface);
    border-radius: 13px;
    transition: 0.3s;
    border: 1px solid var(--ai-border);
}

.ai-toggle-slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background: var(--ai-text-muted);
    border-radius: 50%;
    transition: 0.3s;
}

.ai-toggle input:checked + .ai-toggle-slider {
    background: var(--ai-cyan-dim);
    border-color: var(--ai-cyan);
    box-shadow: var(--ai-glow-sm);
}

.ai-toggle input:checked + .ai-toggle-slider::before {
    transform: translateX(22px);
    background: var(--ai-cyan);
    box-shadow: 0 0 10px var(--ai-cyan-glow);
}

/* ============================================
   Quick Actions - Command buttons
   ============================================ */
.ai-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--ai-border);
    margin-bottom: 16px;
}

.ai-quick-btn {
    background: var(--ai-bg-elevated);
    border: 1px solid var(--ai-border);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 12px;
    font-family: var(--ai-font-mono);
    cursor: pointer;
    color: var(--ai-text-secondary);
    transition: all 0.2s;
}

.ai-quick-btn::before {
    content: '/';
    color: var(--ai-cyan);
    margin-right: 4px;
}

.ai-quick-btn:hover {
    background: var(--ai-bg-surface);
    border-color: var(--ai-cyan);
    color: var(--ai-text-bright);
    box-shadow: var(--ai-glow-sm);
}

/* ============================================
   Difficulty Indicator
   ============================================ */
.ai-difficulty-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    font-family: var(--ai-font-mono);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-difficulty-badge::before {
    content: 'LVL';
    opacity: 0.6;
}

.ai-difficulty-badge[data-level="1"] {
    background: rgba(16, 185, 129, 0.15);
    color: var(--ai-emerald);
    border: 1px solid var(--ai-emerald);
}

.ai-difficulty-badge[data-level="2"] {
    background: rgba(6, 182, 212, 0.15);
    color: var(--ai-cyan);
    border: 1px solid var(--ai-cyan);
}

.ai-difficulty-badge[data-level="3"] {
    background: rgba(245, 158, 11, 0.15);
    color: var(--ai-amber);
    border: 1px solid var(--ai-amber);
}

.ai-difficulty-badge[data-level="4"] {
    background: rgba(244, 63, 94, 0.15);
    color: var(--ai-rose);
    border: 1px solid var(--ai-rose);
}

.ai-difficulty-badge[data-level="5"] {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    border: 1px solid #a78bfa;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    .ai-chat-panel {
        width: calc(100% - 32px);
        right: 16px;
        bottom: 88px;
        max-height: 75vh;
        border-radius: 16px;
    }

    .ai-bubble {
        left: 16px;
        right: 16px;
        max-width: none;
        bottom: 100px;
    }

    .ai-report-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .ai-toggle-btn {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }

    .ai-report-panel {
        width: 96%;
        border-radius: 20px;
    }

    .ai-report-body {
        padding: 20px;
    }

    .ai-progress-label {
        width: 100px;
        font-size: 11px;
    }
}

/* ============================================
   Special Effects
   ============================================ */

/* Glow text effect */
@keyframes text-glow {
    0%, 100% {
        text-shadow: 0 0 10px var(--ai-cyan-glow);
    }
    50% {
        text-shadow: 0 0 20px var(--ai-cyan-glow), 0 0 30px var(--ai-cyan-glow);
    }
}

/* Cursor blink for terminal effect */
@keyframes cursor-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Matrix rain background effect (optional) */
.ai-matrix-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Ctext x='10' y='15' text-anchor='middle' font-size='12' fill='%2306b6d4'%3E0%3C/text%3E%3C/svg%3E");
    animation: matrix-scroll 20s linear infinite;
}

@keyframes matrix-scroll {
    from { background-position: 0 0; }
    to { background-position: 0 1000px; }
}
