/* Post-Lesson Content Styles
 * Renders markdown homework/notes with proper spacing and typography
 */

.post-lesson-content {
    line-height: 1.6;
}

.post-lesson-content h2 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: var(--slate-100);
}

.post-lesson-content h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: var(--slate-100);
}

.post-lesson-content ol,
.post-lesson-content ul {
    padding-left: 1.5rem;
}

.post-lesson-content li {
    margin-bottom: 0.25rem;
}

.post-lesson-content p {
    margin-bottom: 0.75rem;
}

.post-lesson-content blockquote {
    border-left: 3px solid var(--slate-600);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--slate-300);
}

.post-lesson-content code {
    background: var(--slate-800);
    padding: 0.125rem 0.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.875em;
}

.post-lesson-content pre {
    background: var(--slate-800);
    padding: 1rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
}

.field-marker {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--slate-700);
    border-radius: var(--radius-sm);
}

/* =============================================================================
 * Audio Player Component (Phase 4 TTS Integration)
 * ============================================================================= */

.audio-player-container {
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: var(--radius-md);
}

.audio-player-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    color: var(--slate-200);
    font-weight: 500;
}

.audio-player-icon {
    font-size: 1.25rem;
}

.audio-player-title {
    flex: 1;
}

.audio-player-duration {
    font-size: 0.75rem;
    color: var(--slate-400);
    padding: 0.125rem 0.5rem;
    background: rgba(148, 163, 184, 0.1);
    border-radius: var(--radius-sm);
}

/* Native audio element styling — transparent wrapper, let browser oval stand alone */
.audio-player-container audio {
    width: 100%;
    background: none;
    border: none;
    outline: none;
}

/* Webkit audio controls customization */
.audio-player-container audio::-webkit-media-controls-panel {
    background: var(--slate-800);
}

.audio-player-container audio::-webkit-media-controls-current-time-display,
.audio-player-container audio::-webkit-media-controls-time-remaining-display {
    color: var(--slate-300);
}

/* Custom player: play/pause + seek + time row */
.audio-custom-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.75rem 0 0.25rem;
}

.audio-btn--play {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    padding: 0;
    justify-content: center;
}

.audio-progress-wrap {
    flex: 1;
    display: flex;
    align-items: center;
}

.audio-seek {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgba(148, 163, 184, 0.2);
    outline: none;
    cursor: pointer;
    accent-color: rgba(59, 130, 246, 1);
}

.audio-seek:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.8);
    outline-offset: 3px;
}

.audio-seek::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 1);
    cursor: pointer;
}

.audio-seek::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 1);
    cursor: pointer;
    border: none;
}

.audio-time {
    font-size: 0.75rem;
    color: var(--slate-400);
    white-space: nowrap;
    min-width: 5.5rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Visually hidden label for range input (WCAG) */
.audio-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Audio control buttons container */
.audio-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.75rem;
}

/* Replay button */
.audio-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--slate-200);
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.audio-btn:hover {
    background: rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.5);
}

.audio-btn:active {
    background: rgba(59, 130, 246, 0.35);
}

.audio-btn svg {
    stroke: currentColor;
}

/* Speed control */
.audio-speed-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--slate-400);
    font-size: 0.875rem;
}

.audio-speed-select {
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
    color: var(--slate-200);
    background: var(--slate-800);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.audio-speed-select:hover {
    border-color: rgba(148, 163, 184, 0.4);
}

.audio-speed-select:focus {
    outline: none;
    border-color: var(--blue-500);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Graceful degradation: Audio unavailable message */
.audio-unavailable {
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: var(--radius-md);
    text-align: center;
}

.audio-unavailable-icon {
    display: block;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.audio-unavailable-text {
    color: var(--slate-300);
    font-size: 0.875rem;
    margin: 0;
}

/* Hide raw JSON tags that may leak through markdown rendering */
.markdown-preview code:empty,
.markdown-preview pre:empty {
    display: none;
}

/* =============================================================================
 * Before Our Next Session footer (hardcoded, moved from LLM output template)
 * ============================================================================= */

.before-next-session-footer {
    margin: 1.5rem 0 0.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    color: var(--slate-300);
}

.before-next-session-footer h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--slate-200);
    margin-bottom: 0.75rem;
}

.before-next-session-footer p {
    font-size: 0.9rem;
    color: var(--slate-400);
    margin-bottom: 0.5rem;
}

/* ============================= Agent 4 Checker UI (ported from post_lesson_view inline) ============================= */

/* Checker Card Container */
.checker-card {
    margin-bottom: var(--space-5);
    padding: var(--space-5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-color);
}

/* Header Row */
.checker-card__header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}
.checker-card__header-icon {
    font-size: var(--font-size-lg);
}
.checker-card__header-text {
    font-weight: 500;
    color: var(--slate-400);
    text-transform: uppercase;
    font-size: var(--font-size-xs);
    letter-spacing: 0.05em;
}

/* Score Section */
.checker-score-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}
.checker-score-box {
    text-align: center;
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    min-width: 100px;
    border: 1px solid rgba(148, 163, 184, 0.3);
}
.checker-score-box__value {
    display: block;
    font-size: var(--font-size-2xl);
    font-weight: 700;
    line-height: 1.2;
}
.checker-score-box__label {
    display: block;
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.8;
    margin-top: var(--space-1);
}
.checker-score-box--excellent {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.3);
}
.checker-score-box--good {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border-color: rgba(59, 130, 246, 0.3);
}
.checker-score-box--needs-work {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
    border-color: rgba(234, 179, 8, 0.3);
}

/* Sparkle Animation */
@keyframes sparkle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.9); }
}
.checker-spark {
    display: inline-block;
    animation: sparkle 1.5s ease-in-out infinite;
    font-style: normal;
}
.checker-spark--delay {
    animation-delay: 0.75s;
}
@media (prefers-reduced-motion: reduce) {
    .checker-spark {
        animation: none;
    }
}

/* Feedback Message Card */
.checker-feedback-message {
    text-align: center;
    width: 100%;
    padding: var(--space-4) var(--space-5);
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: var(--radius-md);
}
.checker-feedback-message__text {
    margin: 0;
    font-style: italic;
    font-size: var(--font-size-lg);
    color: var(--text-color);
    line-height: 1.6;
}

/* Overlay Container for Sections */
.checker-section {
    margin-top: var(--space-4);
    padding: var(--space-4);
    background: rgba(148, 163, 184, 0.05);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: var(--radius-md);
}
.checker-section.hidden {
    display: none;
}
.checker-section__title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--slate-400);
}

/* Matrix Table (Feedback + Answer Key) */
.checker-matrix {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}
.checker-matrix col.col-field { width: 22%; }
.checker-matrix col.col-status { width: 25%; }
.checker-matrix col.col-content { width: 53%; }
.checker-matrix caption {
    text-align: center;
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--slate-400);
    padding: var(--space-3) 0;
    border-bottom: 2px solid var(--border-color);
}
.checker-matrix th {
    text-align: left;
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--slate-400);
    padding: var(--space-3) var(--space-3);
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}
.checker-matrix td {
    padding: var(--space-3) var(--space-3);
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    vertical-align: top;
    text-align: left;
}
.checker-matrix th:nth-child(2),
.checker-matrix td:nth-child(2) {
    text-align: center;
}
.checker-matrix tr:last-child td {
    border-bottom: none;
}
.checker-matrix__field {
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
}
.checker-matrix__status {
    text-align: center;
    min-width: 60px;
}
.checker-matrix__feedback {
    color: var(--slate-300);
}
.checker-matrix__answer {
    color: var(--success-color, #22c55e);
    font-weight: 500;
}

/* Status Badges (scoped under .checker-matrix to avoid collision with other templates) */
.checker-matrix .status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.checker-matrix .status-badge--ok {
    background: rgba(22, 163, 74, 0.15);
    color: #16a34a;
}
.checker-matrix .status-badge--partial {
    background: rgba(37, 99, 235, 0.15);
    color: #2563eb;
}
.checker-matrix .status-badge--warn {
    background: rgba(234, 88, 12, 0.15);
    color: #ea580c;
}

/* Timestamp */
.checker-timestamp {
    margin-top: var(--space-4);
    font-size: var(--font-size-xs);
    color: var(--slate-400);
    text-align: center;
}

/* Action Buttons Row */
.checker-actions {
    margin-top: var(--space-5);
    display: flex;
    gap: var(--space-3);
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}
.checker-actions .c-button {
    min-width: 120px;
}
.checker-actions__hint {
    width: 100%;
    text-align: center;
    color: var(--slate-400);
    font-size: var(--font-size-xs);
    margin-top: var(--space-2);
}
