/* ============================================
   GangDan Learning Module - Shared Styles
   ============================================ */

/* Navigation links in header */
.learning-nav {
    display: flex; gap: 6px; flex-wrap: wrap;
}
.learning-nav-link {
    padding: 5px 12px; border-radius: 6px; font-size: 0.82em;
    background: rgba(79,195,247,0.1); color: var(--primary);
    text-decoration: none; transition: all 0.2s;
    border: 1px solid rgba(79,195,247,0.2); white-space: nowrap;
}
.learning-nav-link:hover { background: rgba(79,195,247,0.25); }
.learning-nav-link.active { background: var(--primary); color: #0f0f1a; }

/* Learning page layout */
.learning-page { display: grid; grid-template-columns: 340px 1fr; gap: 15px; min-height: 70vh; }
@media (max-width: 900px) { .learning-page { grid-template-columns: 1fr; } }

.learning-sidebar {
    background: var(--bg-card); border-radius: 12px; padding: 18px;
    border: 1px solid var(--border); overflow-y: auto; max-height: 80vh;
}
.learning-main {
    background: var(--bg-card); border-radius: 12px; padding: 20px;
    border: 1px solid var(--border); overflow-y: auto; max-height: 80vh;
}

/* Form elements */
.learning-form label {
    display: block; color: var(--text-muted); font-size: 0.85em;
    margin-bottom: 4px; margin-top: 12px;
}
.learning-form label:first-child { margin-top: 0; }
.learning-form input, .learning-form select, .learning-form textarea {
    width: 100%; padding: 8px 12px; border-radius: 8px;
    border: 1px solid var(--border); background: rgba(255,255,255,0.05);
    color: var(--text); font-size: 0.9em; transition: border 0.2s;
}
.learning-form input:focus, .learning-form select:focus, .learning-form textarea:focus {
    outline: none; border-color: var(--primary);
}
.learning-form select option { background: #1a1a2e; color: var(--text); }

/* Buttons */
.btn-learning {
    padding: 10px 20px; border-radius: 8px; border: none; cursor: pointer;
    font-size: 0.9em; font-weight: 500; transition: all 0.2s; width: 100%;
    margin-top: 15px;
}
.btn-learning-primary { background: var(--primary); color: #0f0f1a; }
.btn-learning-primary:hover { background: var(--primary-dark); }
.btn-learning-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-learning-secondary { background: rgba(255,255,255,0.08); color: var(--text); border: 1px solid var(--border); }
.btn-learning-secondary:hover { background: rgba(255,255,255,0.15); }

/* KB multi-select */
.kb-check-list { max-height: 200px; overflow-y: auto; margin-top: 6px; }
.kb-check-item {
    display: flex; align-items: center; gap: 8px; padding: 5px 8px;
    border-radius: 6px; cursor: pointer; font-size: 0.85em;
    transition: background 0.15s;
}
.kb-check-item:hover { background: rgba(255,255,255,0.06); }
.kb-check-item input[type="checkbox"] { width: auto; margin: 0; }

/* Progress bar */
.progress-bar {
    width: 100%; height: 6px; background: rgba(255,255,255,0.1);
    border-radius: 3px; margin: 10px 0; overflow: hidden;
}
.progress-bar-fill {
    height: 100%; background: var(--primary); border-radius: 3px;
    transition: width 0.4s ease;
}

/* Question card */
.question-card {
    background: rgba(255,255,255,0.03); border: 1px solid var(--border);
    border-radius: 10px; padding: 16px; margin-bottom: 12px;
}
.question-card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px;
}
.question-card-header .q-num {
    font-size: 0.8em; color: var(--primary); font-weight: 600;
    background: rgba(79,195,247,0.1); padding: 2px 10px; border-radius: 4px;
}
.question-card-header .q-type {
    font-size: 0.75em; color: var(--text-muted);
}
.question-text { font-size: 0.95em; line-height: 1.6; margin-bottom: 10px; }
.question-options { margin: 10px 0; }
.question-option {
    padding: 8px 12px; margin: 4px 0; border-radius: 6px;
    background: rgba(255,255,255,0.04); font-size: 0.9em;
    border: 1px solid transparent; transition: all 0.2s;
}
.question-option:hover { border-color: var(--primary); }
.question-option.correct { border-color: var(--success); background: rgba(102,187,106,0.1); }
.question-answer {
    margin-top: 10px; padding: 12px; border-radius: 8px;
    background: rgba(102,187,106,0.05); border: 1px solid rgba(102,187,106,0.2);
    display: none;
}
.question-answer.visible { display: block; }
.question-answer h4 { color: var(--success); font-size: 0.85em; margin-bottom: 6px; }
.question-answer p { font-size: 0.88em; line-height: 1.5; }

/* Knowledge point list */
.kp-list { list-style: none; }
.kp-item {
    padding: 10px 12px; margin: 4px 0; border-radius: 8px;
    background: rgba(255,255,255,0.03); border: 1px solid transparent;
    cursor: pointer; transition: all 0.2s; font-size: 0.88em;
}
.kp-item:hover { background: rgba(255,255,255,0.06); }
.kp-item.active { border-color: var(--primary); background: rgba(79,195,247,0.08); }
.kp-item.completed { opacity: 0.7; }
.kp-item.completed::before { content: "✓ "; color: var(--success); }
.kp-item .kp-title { font-weight: 500; color: var(--text); }
.kp-item .kp-desc { font-size: 0.82em; color: var(--text-muted); margin-top: 3px; }

/* Phase indicator */
.phase-indicator {
    display: flex; gap: 4px; margin-bottom: 15px; align-items: center;
}
.phase-step {
    padding: 6px 14px; border-radius: 6px; font-size: 0.82em;
    background: rgba(255,255,255,0.05); color: var(--text-muted);
    transition: all 0.3s;
}
.phase-step.active { background: var(--primary); color: #0f0f1a; font-weight: 500; }
.phase-step.completed { background: rgba(102,187,106,0.2); color: var(--success); }
.phase-arrow { color: var(--text-muted); font-size: 0.8em; }

/* Subtopic cards */
.subtopic-card {
    padding: 10px 14px; margin: 6px 0; border-radius: 8px;
    background: rgba(255,255,255,0.03); border-left: 3px solid var(--border);
    font-size: 0.88em; transition: all 0.3s;
}
.subtopic-card.pending, .subtopic-card.PENDING { border-left-color: var(--text-muted); }
.subtopic-card.active, .subtopic-card.RESEARCHING {
    border-left-color: var(--primary);
    animation: subtopic-pulse 1.5s ease-in-out infinite;
}
.subtopic-card.completed, .subtopic-card.COMPLETED { border-left-color: var(--success); }
.subtopic-card.FAILED { border-left-color: var(--danger); opacity: 0.8; }
.subtopic-card.FAILED .subtopic-title::after { content: " (failed)"; color: var(--danger); font-size: 0.85em; }
.subtopic-card.COMPLETED .subtopic-title::before { content: ""; color: var(--success); margin-right: 4px; }
@keyframes subtopic-pulse {
    0%, 100% { background: rgba(255,255,255,0.03); }
    50% { background: rgba(79,195,247,0.08); }
}
.subtopic-title { font-weight: 500; }
.subtopic-overview { color: var(--text-muted); font-size: 0.85em; margin-top: 2px; }
.subtopic-sources-detail {
    font-size: 0.78em; color: var(--text-muted); margin-top: 3px;
    padding: 2px 6px; border-radius: 4px;
    background: rgba(255,255,255,0.03); display: inline-block;
}
.iteration-badge {
    font-size: 0.75em; color: var(--warning, #ffb74d); margin-left: 6px;
    font-weight: normal;
}

/* Refining phase (amber) */
.subtopic-card.WEAK {
    border-left-color: var(--warning, #ffb74d);
    animation: subtopic-pulse 1.5s ease-in-out infinite;
}

/* Status message */
.status-msg {
    color: var(--text-muted); font-size: 0.85em; padding: 6px 0;
    font-style: italic;
}

/* Chat area in guide */
.guide-chat { margin-top: 15px; border-top: 1px solid var(--border); padding-top: 12px; }
.guide-chat-messages {
    max-height: 250px; overflow-y: auto; margin-bottom: 10px;
    padding: 8px; font-size: 0.88em;
}
.guide-chat-msg { margin: 6px 0; padding: 8px 12px; border-radius: 8px; }
.guide-chat-msg.user { background: rgba(79,195,247,0.1); text-align: right; }
.guide-chat-msg.assistant { background: rgba(255,255,255,0.04); }
.guide-chat-input {
    display: flex; gap: 8px;
}
.guide-chat-input input { flex: 1; }
.guide-chat-input button { width: auto; margin-top: 0; padding: 8px 16px; }

/* Markdown content area */
.lesson-content, .report-content {
    line-height: 1.7; font-size: 0.92em;
}
.lesson-content h1, .report-content h1 { font-size: 1.4em; color: var(--primary); margin: 20px 0 10px; }
.lesson-content h2, .report-content h2 { font-size: 1.2em; color: var(--primary-dark); margin: 16px 0 8px; }
.lesson-content h3, .report-content h3 { font-size: 1.05em; margin: 12px 0 6px; }
.lesson-content pre, .report-content pre {
    background: rgba(0,0,0,0.3); padding: 12px; border-radius: 8px;
    overflow-x: auto; font-size: 0.88em; margin: 10px 0;
}
.lesson-content code, .report-content code {
    background: rgba(255,255,255,0.08); padding: 2px 6px; border-radius: 4px;
    font-size: 0.9em;
}
.lesson-content pre code, .report-content pre code { background: none; padding: 0; }
.lesson-content ul, .lesson-content ol, .report-content ul, .report-content ol {
    margin: 8px 0; padding-left: 24px;
}
.lesson-content blockquote, .report-content blockquote {
    border-left: 3px solid var(--primary); padding: 8px 16px; margin: 10px 0;
    background: rgba(79,195,247,0.05); border-radius: 0 8px 8px 0;
}

/* History / saved items list */
.history-list { margin-top: 12px; }
.history-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px; margin: 4px 0; border-radius: 8px;
    background: rgba(255,255,255,0.03); font-size: 0.85em;
    cursor: pointer; transition: background 0.15s;
}
.history-item:hover { background: rgba(255,255,255,0.08); }
.history-item .hi-title { font-weight: 500; }
.history-item .hi-meta { color: var(--text-muted); font-size: 0.8em; }
.history-item .hi-delete {
    color: var(--danger); cursor: pointer; opacity: 0.5; transition: opacity 0.2s;
    background: none; border: none; font-size: 1em;
}
.history-item .hi-delete:hover { opacity: 1; }

/* Loading spinner */
.learning-loading {
    display: inline-block; width: 16px; height: 16px;
    border: 2px solid var(--border); border-top-color: var(--primary);
    border-radius: 50%; animation: lspin 0.6s linear infinite;
}
@keyframes lspin { to { transform: rotate(360deg); } }

/* Empty state */
.empty-state {
    text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 0.9em;
}

/* Exam tab bar */
.exam-tab-bar {
    display: flex; gap: 4px; margin-bottom: 15px;
    border-bottom: 1px solid var(--border); padding-bottom: 8px;
}
.exam-tab {
    padding: 8px 18px; border-radius: 6px 6px 0 0; border: 1px solid transparent;
    background: rgba(255,255,255,0.03); color: var(--text-muted);
    cursor: pointer; font-size: 0.88em; font-weight: 500; transition: all 0.2s;
    border-bottom: none;
}
.exam-tab:hover { background: rgba(255,255,255,0.08); }
.exam-tab.active {
    background: var(--bg-card); color: var(--primary);
    border-color: var(--border); border-bottom-color: var(--bg-card);
    position: relative; top: 1px;
}
