/* ==========================================================================
   Pedagogical mode + Daily Report Builder
   ========================================================================== */

/* --- Pedagogical mode visibility ----------------------------------------- */
/* Teaching content is hidden by default and revealed when the body carries
   the .pedagogy-on class (toggled from the header). */
.pedagogical-only { display: none; }
body.pedagogy-on .pedagogical-only { display: block; }
body.pedagogy-on .token-group-hint.pedagogical-only { display: block; }
/* Inline hints living inside a label should stay on the same flow line */
body.pedagogy-on label .pedagogical-only { display: inline; }

.pedagogical-tip {
    border: 1px solid #c7d2fe;
    background: linear-gradient(180deg, #eef2ff 0%, #f5f7ff 100%);
    border-left: 4px solid var(--primary-color);
    border-radius: 0.5rem;
    padding: 0.85rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    color: #312e81;
}

.pedagogical-tip strong { color: #1e3a8a; }

.pedagogical-tip .tip-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.7rem;
    color: var(--primary-color);
    margin-bottom: 0.3rem;
}

/* --- Pedagogical mode toggle button -------------------------------------- */
.pedagogy-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.pedagogy-toggle .pedagogy-state {
    font-weight: 700;
    padding: 0.05rem 0.4rem;
    border-radius: 0.35rem;
    background: var(--border-color);
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.pedagogy-toggle.is-active {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pedagogy-toggle.is-active .pedagogy-state {
    background: var(--primary-color);
    color: #fff;
}

/* --- Report builder layout ----------------------------------------------- */
.report-meta-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.report-meta-bar .form-group { margin: 0; }

.report-meta-bar label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.report-meta-bar input,
.report-meta-bar select,
.report-meta-bar textarea {
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--text-primary);
    background: #fff;
}

.report-meta-bar textarea { resize: vertical; min-height: 64px; }

.report-meta-bar .meta-wide { grid-column: 1 / -1; }

/* --- Hole picker --------------------------------------------------------- */
.report-hole-picker {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.report-hole-picker-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.report-hole-picker-head h3 { font-size: 0.95rem; color: var(--text-primary); }

.report-hole-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.report-hole-picker-actions { display: flex; gap: 0.5rem; }
.report-hole-picker-actions .btn-secondary { padding: 0.4rem 0.75rem; font-size: 0.8rem; }

.report-hole-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 0.6rem;
}

.report-hole-card {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-align: left;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.6rem;
    background: #fff;
    cursor: pointer;
    transition: var(--transition);
}

.report-hole-card:hover { border-color: var(--primary-color); background: var(--bg-color); }

.report-hole-check {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    display: inline-block;
    position: relative;
}

.report-hole-card.selected {
    border-color: var(--primary-color);
    background: #eff6ff;
    box-shadow: inset 0 0 0 1px var(--primary-color);
}

.report-hole-card.selected .report-hole-check {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.report-hole-card.selected .report-hole-check::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 4px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.report-hole-body { display: flex; flex-direction: column; min-width: 0; }
.report-hole-name { font-weight: 600; font-size: 0.875rem; color: var(--text-primary); }
.report-hole-meta { font-size: 0.75rem; color: var(--text-secondary); }
.report-hole-empty { color: var(--text-secondary); font-size: 0.875rem; }

.report-builder-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .report-builder-layout { grid-template-columns: 1fr; }
}

.report-pane {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.report-pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
}

.report-pane-header h3 { font-size: 0.95rem; color: var(--text-primary); }

.report-pane-body { padding: 1rem; }

.report-pane-header select {
    padding: 0.4rem 0.55rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.8rem;
    background: #fff;
}

/* --- Token palette ------------------------------------------------------- */
.report-token-palette {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 0.5rem 1rem 1rem;
    max-height: 280px;
    overflow-y: auto;
    border-bottom: 1px solid var(--border-color);
}

.token-group-head { margin-bottom: 0.4rem; }

.token-group-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.token-group-hint {
    font-size: 0.78rem;
    color: #6366f1;
    margin-top: 0.15rem;
}

.token-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.token-chip {
    border: 1px solid #c7d2fe;
    background: #eef2ff;
    color: #3730a3;
    border-radius: 999px;
    padding: 0.3rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.token-chip:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

/* --- Template editor ----------------------------------------------------- */
#report-template-editor {
    width: 100%;
    min-height: 420px;
    border: none;
    padding: 1rem;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.82rem;
    line-height: 1.55;
    color: #0f172a;
    resize: vertical;
    background: #fbfcfe;
    tab-size: 2;
}

#report-template-editor:focus { outline: 2px solid var(--primary-color); outline-offset: -2px; }

/* --- Live preview -------------------------------------------------------- */
.report-preview {
    padding: 1.5rem;
    min-height: 420px;
    background: #fff;
    overflow-x: auto;
}

.report-preview h1 { font-size: 1.6rem; color: #1e3a8a; border-bottom: 3px solid var(--primary-color); padding-bottom: 0.3rem; margin-bottom: 0.5rem; }
.report-preview h2 { font-size: 1.2rem; color: #1e40af; margin: 1.4rem 0 0.5rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.2rem; }
.report-preview h3 { font-size: 1.02rem; color: #334155; margin: 1rem 0 0.4rem; }
.report-preview p { margin-bottom: 0.6rem; color: var(--text-secondary); }
.report-preview table { border-collapse: collapse; width: 100%; margin: 0.6rem 0; font-size: 0.85rem; }
.report-preview th, .report-preview td { border: 1px solid var(--border-color); padding: 0.4rem 0.55rem; text-align: left; vertical-align: top; }
.report-preview th { background: var(--bg-color); color: var(--text-primary); }
.report-preview .report-subtitle { color: var(--secondary-color); margin-top: -0.3rem; }
.report-preview .report-note { background: #fffbeb; border-left: 3px solid var(--warning-color); padding: 0.4rem 0.6rem; }
.report-preview .report-hole { margin-bottom: 1.2rem; }

.report-preview-status {
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.report-preview-status.is-error { color: var(--danger-color); font-weight: 600; }

.report-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    padding: 0.85rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

/* --- Writing guide ------------------------------------------------------- */
.report-guide {
    margin-top: 1.5rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-left: 4px solid #6366f1;
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-sm);
}

.report-guide h3 { color: #312e81; margin-bottom: 0.4rem; }
.report-guide-lead { color: var(--text-secondary); margin-bottom: 0.9rem; font-size: 0.9rem; }

.report-guide details {
    border-top: 1px solid var(--border-color);
    padding: 0.6rem 0;
}

.report-guide summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text-primary);
    list-style: revert;
}

.report-guide ul { margin: 0.6rem 0 0.3rem 1.1rem; }
.report-guide li { margin-bottom: 0.35rem; font-size: 0.875rem; color: var(--text-secondary); }
.report-guide code {
    background: #eef2ff;
    color: #3730a3;
    padding: 0.05rem 0.35rem;
    border-radius: 0.3rem;
    font-size: 0.82rem;
}
