/* ========================================
   CUSTOM CSS VARIABLES

   These variables are used by custom components that aren't
   covered by DaisyUI. DaisyUI theme colors are configured in
   tailwind.css - these are supplementary.
   ======================================== */

:root {
    --color-text: #212529;
    --color-muted-text: #6c757d;
    --color-primary: #4A90E2;
    --color-success: #198754;
    --color-danger: #dc3545;
    --color-border: #DEE2E6;
    --color-card-bg: #FFFFFF;
    --color-card-header-bg: #f1f3f5;
    --color-input-bg: #FFFFFF;
    --color-input-text: #212529;
    --color-light-bg: #f8f9fa;
    --color-text-light: #6c757d;
}

[data-theme="dark"] {
    --color-text: #E8E8E8;
    --color-muted-text: #888888;
    --color-border: #404040;
    --color-card-bg: #2A2A2A;
    --color-card-header-bg: #333333;
    --color-input-bg: #333333;
    --color-input-text: #E8E8E8;
    --color-light-bg: #252525;
    --color-success: #28a745;
    --color-text-light: #888888;
}

/* ========================================
   PROGRESS GRID - Course progress/happiness maps
   ======================================== */

.progress-grid { overflow-x: auto; }
.progress-grid table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
.progress-grid th, .progress-grid td { padding: 0.75rem; border: 1px solid var(--color-border); text-align: left; }
.progress-grid th { background-color: var(--color-card-header-bg); }
.progress-grid td.check-cell { text-align: center; font-size: 1.2rem; color: var(--color-success); }

/* Section header for collapsible sections */
.section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--color-card-header-bg);
    cursor: pointer;
    font-weight: 600;
}

/* ========================================
   STEP/BLOCK DESIGNER - Drag & drop blocks
   ======================================== */

.block-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--color-border);
    background-color: var(--color-card-bg);
}

.block-drag-handle {
    cursor: grab;
    color: var(--color-muted-text);
    margin-right: 1rem;
    font-size: 1.2rem;
    user-select: none;
}

.block-info { flex-grow: 1; }
.block-item:last-child { border-bottom: none; }
.block-item strong { color: var(--color-text); }

.block-content-preview {
    color: var(--color-muted-text);
    font-family: sans-serif;
    font-size: 0.9em;
    margin: 0.5rem 0 0 0;
}

.block-full-content {
    padding: 1rem;
    background: var(--color-light-bg);
    border-radius: 4px;
    margin-top: 0.5rem;
}

.add-block-form {
    border-top: 1px solid var(--color-border);
    padding: 1rem 0;
}

.add-block-form[open] { padding-bottom: 1.5rem; }

.add-block-form summary {
    cursor: pointer;
    font-weight: bold;
    list-style: none;
}

.add-block-form summary::-webkit-details-marker { display: none; }

.add-block-form summary::before {
    content: '▶';
    display: inline-block;
    margin-right: 0.5rem;
    font-size: 0.8rem;
    transition: transform 0.2s ease;
    color: var(--color-primary);
}

.add-block-form[open] summary::before {
    transform: rotate(90deg);
}

.sortable-ghost {
    opacity: 0.4;
    background: var(--color-primary);
}

/* Content block for step/course view */
.content-block {
    margin-bottom: 1.5rem;
}

/* ========================================
   STEP LIST - Course view checkboxes
   ======================================== */

.step-list { list-style: none; padding: 0; }
.step-list li { display: flex; align-items: center; padding: 1rem 0; border-bottom: 1px solid var(--color-border); }
.step-list li:last-child { border-bottom: none; }
.step-list input[type="checkbox"] { transform: scale(1.5); cursor: pointer; }

.step-header {
    margin-bottom: 1rem;
}

/* ========================================
   JOURNAL VIEWING STYLES
   ======================================== */

.step-journal-entry {
    margin-bottom: 1.5rem;
}

.journal-content {
    margin: 0;
}

.journal-entry-text {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    font-size: 1rem;
    background-color: var(--color-card-header-bg);
    color: var(--color-text);
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid var(--color-border);
    margin: 0;
    line-height: 1.5;
}

.journal-empty {
    color: var(--color-muted-text);
    font-style: italic;
    margin: 0;
    padding: 1rem;
    background-color: var(--color-card-header-bg);
    border-radius: 4px;
    border: 1px solid var(--color-border);
}

/* ========================================
   CHAT BUBBLES - Comment threads (JS rendered)
   ======================================== */

.comments-thread {
    margin-top: 0;
    margin-bottom: 0;
    padding: 0.75rem 0.75rem 0.5rem 0.75rem;
    background: var(--color-card-bg);
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.chat-bubbles {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin-bottom: 0;
    max-height: 500px;
    overflow-y: auto;
}

.chat-bubble {
    max-width: 75%;
    padding: 0.35rem 0.5rem;
    padding-bottom: 0.25rem;
    border-radius: 8px;
    position: relative;
}

.guide-bubble {
    align-self: flex-start;
    background: #e3f2fd;
    color: #1e3a5f;
}

[data-theme="dark"] .guide-bubble {
    background: #2C4158;
    color: #E8E8E8;
}

.student-bubble {
    align-self: flex-end;
    background: #4caf50;
    color: white;
}

[data-theme="dark"] .student-bubble {
    background: #3A5F3C;
    color: #E8E8E8;
}

.bubble-content {
    font-size: 0.95em;
    line-height: 1.3;
    padding-right: 3.5rem;
    padding-bottom: 0.1rem;
}

.bubble-time {
    position: absolute;
    bottom: 0.2rem;
    right: 0.4rem;
    font-size: 0.65em;
    opacity: 0.6;
}

.discussion-header {
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

.discussion-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.date-divider {
    text-align: center;
    margin: 0.5rem 0 0.35rem 0;
    position: relative;
}

.date-divider span {
    background: var(--color-card-bg);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75em;
    color: var(--color-muted-text);
    border: 1px solid var(--color-border);
    display: inline-block;
}

.comment-section {
    margin-top: 0.5rem;
}

.add-comment-form {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 1rem;
}

.add-comment-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-input-bg);
    color: var(--color-input-text);
    resize: vertical;
    font-family: inherit;
    margin: 0;
}

.add-comment-form button {
    align-self: flex-end;
}

.comment-status {
    text-align: right;
    font-size: 0.9em;
    min-height: 1.2em;
}

/* ========================================
   STATS GRID - Course stats display
   ======================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    color: var(--color-muted-text);
    font-size: 0.9rem;
}

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

/* ========================================
   SIDEBAR MENU - Zebra striping
   ======================================== */

.sidebar-menu > li:not(.menu-title):nth-child(odd) > a {
    background-color: oklch(var(--b2));
}

.sidebar-menu > li:not(.menu-title):nth-child(even) > a {
    background-color: oklch(var(--b1));
}

/* ========================================
   MISC UTILITIES
   ======================================== */

.dashboard-header {
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: var(--color-text);
}

/* ========================================
   CUSTOM AUDIO PLAYER
   ======================================== */

.audio-player [data-display="progress-bar"] {
    transition: width 100ms linear;
}

.audio-player [data-display="seek-handle"] {
    transition: transform 150ms ease, opacity 150ms ease;
}

/* Focus states for accessibility */
.audio-player:focus-visible {
    outline: 2px solid oklch(var(--p));
    outline-offset: 2px;
}

/* Remove focus ring from container, keep on buttons */
.audio-player:focus {
    outline: none;
}

.audio-player button:focus-visible {
    outline: 2px solid oklch(var(--p));
    outline-offset: 2px;
}

/* Volume slider styling */
.audio-player input[type="range"].range {
    --range-shdw: transparent;
}

/* Speed dropdown centering */
.audio-player .dropdown .dropdown-content {
    left: 50%;
    transform: translateX(-50%);
}

/* Prose styling for rendered HTML content */
.prose {
    line-height: 1.6;
}

.prose p { margin-bottom: 1rem; }
.prose ul, .prose ol { margin-bottom: 1rem; padding-left: 1.5rem; }
.prose li { margin-bottom: 0.25rem; }

/* Tailwind-compatible utilities that may be referenced */
.text-center { text-align: center; }
.gap-2 { gap: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.progress-bar { height: 0.5rem; background: var(--color-primary); border-radius: 9999px; }
