/* student-submissions.css — Styles for the student-facing Submissions left tab.
   All classes prefixed .sspg- (Student Submissions PaGe) to avoid conflicts. */

.sspg-root {
    padding: 16px 20px 40px;
    font-family: inherit;
    color: #333;
    box-sizing: border-box;
    overflow-y: auto;
    height: 100%;
}

.sspg-loading,
.sspg-error {
    padding: 40px 20px;
    text-align: center;
    font-size: 13px;
    color: #666;
}
.sspg-error { color: #b91c1c; }

/* Header */
/* Phase G2: header carries the title + "Open Calendar" CTA. Two-column
   flex layout so the button anchors right while the title stays left. */
.sspg-header {
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.sspg-title {
    font-size: 14px;
    font-weight: 700;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0;
}
.sspg-sub {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}
.sspg-open-cal-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: #fff;
    color: #2f6844;
    border: 1px solid #2f6844;
    border-radius: 8px;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    line-height: 1.2;
}
.sspg-open-cal-btn:hover {
    background: #2f6844;
    color: #fff;
}
.sspg-open-cal-icon {
    flex-shrink: 0;
}

/* Calendar portal — fixed overlay that pops the monthly grid on demand. */
.sspg-cal-portal {
    position: fixed;
    inset: 0;
    z-index: 12000;
    background: rgba(15, 23, 42, 0.48);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}
.sspg-cal-portal-box {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 560px;
    width: 100%;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    padding: 16px 18px 18px;
}
/* Iframe variant — wider + taller; no inner padding because the iframe
   carries its own layout. */
.sspg-cal-portal-box--iframe {
    max-width: min(1280px, calc(100vw - 60px));
    width: 100%;
    max-height: calc(100vh - 80px);
    height: calc(100vh - 80px);
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
}
.sspg-cal-portal-box--iframe .sspg-cal-portal-head {
    padding: 14px 18px;
    margin-bottom: 0;
    border-bottom: 1px solid #ece7dd;
}
.sspg-cal-portal-frame {
    flex: 1 1 auto;
    width: 100%;
    border: 0;
    display: block;
    background: #faf8f3;
}
.sspg-cal-portal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f3f4f6;
}
.sspg-cal-portal-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
}
.sspg-cal-portal-close {
    background: transparent;
    border: 0;
    font-size: 24px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    padding: 0 6px;
}
.sspg-cal-portal-close:hover { color: #111; }
/* Inside the portal, drop the .sspg-cal-wrap card chrome — the portal box
   already provides its own. Removes the doubled border + padding. */
.sspg-cal-portal .sspg-cal-wrap {
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
}

/* ============================================================
   PHASE G3: per-date history portal — left = plan + materials,
   right = student work + AI feedback.
   ============================================================ */
.sspg-lesson-card--plan,
.sspg-lesson-card--work {
    margin-bottom: 14px;
}
.sspg-plan-block {
    margin-top: 10px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 14px;
}
.sspg-plan-loading,
.sspg-plan-empty,
.sspg-mat-loading,
.sspg-mat-empty {
    font-size: 12px;
    color: #6b7280;
    font-style: italic;
}
.sspg-plan-row {
    margin-bottom: 10px;
}
.sspg-plan-row:last-child { margin-bottom: 0; }
.sspg-plan-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #6b7280;
    margin-bottom: 3px;
}
.sspg-plan-value {
    font-size: 13px;
    color: #1a1a1a;
    line-height: 1.5;
    white-space: pre-wrap;
}
.sspg-materials-block {
    margin-top: 10px;
}
.sspg-mat-head {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #6b7280;
    margin-bottom: 6px;
}
.sspg-mat-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sspg-mat-item {
    padding: 6px 10px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 4px;
    font-size: 13px;
    color: #1a1a1a;
}
.sspg-root--right .sspg-detail-head {
    margin-bottom: 8px;
}

/* Calendar wrap */
.sspg-cal-wrap {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 14px;
}
.sspg-cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.sspg-cal-arrow {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    color: #333;
}
.sspg-cal-arrow:hover { background: #eef2f5; }
.sspg-cal-month {
    font-size: 14px;
    font-weight: 700;
    color: #333;
}

.sspg-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 4px;
}
.sspg-cal-weekday {
    text-align: center;
    font-size: 10px;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 0;
}

.sspg-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.sspg-cal-cell {
    border-radius: 6px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 12px;
    background: #fafafa;
    border: 1px solid transparent;
    height: 28px;
    position: relative;
}
.sspg-cal-cell--empty {
    background: transparent;
}
.sspg-cal-cell--grey {
    background: #f4f4f5;
    color: #bbb;
}
.sspg-cal-cell--green {
    background: #d1fae5;
    border-color: #10b981;
    color: #065f46;
    font-weight: 600;
}
.sspg-cal-cell--yellow {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
    font-weight: 600;
}
.sspg-cal-cell--red {
    background: #fee2e2;
    border-color: #ef4444;
    color: #991b1b;
    font-weight: 600;
}
.sspg-cal-cell--future {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}
.sspg-cal-cell--today {
    box-shadow: inset 0 0 0 2px #2563eb;
}
.sspg-cal-cell--selected {
    box-shadow: inset 0 0 0 2px #059669;
}
.sspg-cal-cell--clickable {
    cursor: pointer;
}
.sspg-cal-cell--clickable:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.sspg-cal-day {
    font-size: 12px;
    line-height: 1;
}
.sspg-cal-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.sspg-cal-dot--green { background: #10b981; }
.sspg-cal-dot--yellow { background: #f59e0b; }
.sspg-cal-dot--red { background: #ef4444; }
.sspg-cal-dot--future { background: #93c5fd; }

.sspg-cal-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    vertical-align: middle;
    margin-right: 4px;
}
.sspg-cal-swatch--grey { background: #f4f4f5; border: 1px solid #e0e0e0; }

.sspg-cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
    font-size: 11px;
    color: #666;
}
.sspg-cal-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.sspg-cal-legend-item .sspg-cal-dot {
    margin-top: 0;
}

/* Detail panel */
.sspg-detail {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 14px;
}
.sspg-detail-empty {
    text-align: center;
    padding: 28px 16px;
    color: #999;
}
.sspg-detail-empty-icon {
    font-size: 32px;
    margin-bottom: 8px;
}
.sspg-detail-empty-title {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    margin-bottom: 4px;
}
.sspg-detail-empty-desc {
    font-size: 12px;
    color: #999;
    line-height: 1.5;
}
.sspg-detail-empty-lite {
    text-align: center;
    padding: 14px;
    color: #999;
    font-size: 12px;
    font-style: italic;
}

.sspg-detail-head {
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}
.sspg-detail-date {
    font-size: 14px;
    font-weight: 700;
    color: #333;
}
.sspg-detail-date-sub {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}

.sspg-lesson-card {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 10px;
    background: #fafafa;
}
.sspg-lesson-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}
.sspg-lesson-unit {
    font-size: 10px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}
.sspg-lesson-title {
    font-size: 13px;
    font-weight: 700;
    color: #333;
    margin: 2px 0;
}
.sspg-lesson-coverage {
    font-size: 11px;
    color: #666;
}
.sspg-open-lesson-btn {
    background: #059669;
    border: none;
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.sspg-open-lesson-btn:hover { background: #047857; }

/* Wrap-up status badge — appears in the lesson card head on the submissions calendar. */
.sspg-wrap-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}
.sspg-wrap-finalized {
    background: #bbf7d0;
    border: 1px solid #4ade80;
    color: #064e3b;
}
.sspg-wrap-submitted {
    background: #d1fae5;
    border: 1px solid #6ee7b7;
    color: #065f46;
}
.sspg-wrap-ready {
    background: #fef3c7;
    border: 1px solid #fde68a;
    color: #92400e;
    animation: sspg-wrap-pulse 2.6s ease-in-out infinite;
}
@keyframes sspg-wrap-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0); }
    50%      { box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.18); }
}
.sspg-wrap-generating {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    font-style: italic;
}

/* Section rows */
.sspg-section-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sspg-section-row {
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 4px;
    padding: 8px 10px;
}
.sspg-section-row-head {
    display: flex;
    align-items: center;
    gap: 8px;
}
.sspg-section-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.sspg-section-dot--green { background: #10b981; }
.sspg-section-dot--yellow { background: #f59e0b; }
.sspg-section-dot--red { background: #ef4444; }
.sspg-section-dot--pending { background: #93c5fd; }
.sspg-section-dot--missing { background: #d1d5db; }
.sspg-section-label {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    flex: 1;
}
.sspg-section-score {
    font-size: 11px;
    color: #666;
}
.sspg-section-feedback {
    font-size: 12px;
    color: #555;
    margin-top: 6px;
    line-height: 1.5;
    padding: 6px 8px;
    background: #f8f9fa;
    border-radius: 3px;
}

/* RIGHT SIDE — memory profile + prefs */

.sspg-right-root {
    padding: 16px 20px 40px;
    box-sizing: border-box;
    overflow-y: auto;
    height: 100%;
    color: #333;
}

.sspg-banner {
    display: flex;
    gap: 10px;
    padding: 12px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 6px;
    margin-bottom: 16px;
}
.sspg-banner-icon {
    font-size: 18px;
    color: #4f46e5;
    line-height: 1;
    flex-shrink: 0;
    padding-top: 1px;
}
.sspg-banner-title {
    font-size: 12px;
    font-weight: 700;
    color: #4f46e5;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.sspg-banner-text {
    font-size: 12px;
    color: #4338ca;
    line-height: 1.5;
}

.sspg-summary {
    padding: 10px 12px;
    background: #f0fdf4;
    border-left: 3px solid #059669;
    border-radius: 4px;
    font-size: 13px;
    color: #333;
    line-height: 1.6;
    margin-bottom: 14px;
}

.sspg-section-heading {
    font-size: 13px;
    font-weight: 700;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 18px 0 8px;
}

.sspg-empty {
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    font-size: 12px;
    color: #999;
    font-style: italic;
}

/* Trait grid */
.sspg-trait-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}
.sspg-trait-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px 12px;
}
.sspg-trait-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}
.sspg-trait-name {
    font-size: 12px;
    font-weight: 700;
    color: #333;
}
.sspg-trait-conf {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
}
.sspg-trait-conf--high { background: #d1fae5; color: #065f46; }
.sspg-trait-conf--medium { background: #fef3c7; color: #92400e; }
.sspg-trait-conf--low { background: #fee2e2; color: #991b1b; }
.sspg-trait-desc {
    font-size: 12px;
    color: #555;
    line-height: 1.5;
}
.sspg-trait-evidence {
    font-size: 11px;
    color: #666;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed #f0f0f0;
    font-style: italic;
}

/* Generic list (growth, suggestions, comments) */
.sspg-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sspg-list-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px 12px;
}
.sspg-list-item--teacher {
    border-left: 3px solid #2563eb;
}
.sspg-list-item--ai {
    border-left: 3px solid #059669;
}
.sspg-list-title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}
.sspg-list-desc {
    font-size: 12px;
    color: #555;
    line-height: 1.5;
}
.sspg-suggestion-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}
.sspg-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.sspg-badge--teacher { background: #dbeafe; color: #1d4ed8; }
.sspg-badge--ai { background: #d1fae5; color: #065f46; }

.sspg-comment-btn {
    margin-top: 8px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    color: #2563eb;
    cursor: pointer;
}
.sspg-comment-btn:hover {
    background: #eff6ff;
    border-color: #93c5fd;
}
.sspg-comment-btn--inline {
    margin-top: 6px;
    padding: 3px 8px;
}

/* Prefs form */
.sspg-prefs-note {
    font-size: 12px;
    color: #555;
    line-height: 1.5;
    margin-bottom: 10px;
    padding: 8px 10px;
    background: #fef3c7;
    border-left: 3px solid #f59e0b;
    border-radius: 4px;
}
.sspg-prefs-form {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px;
}
.sspg-prefs-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}
.sspg-prefs-label {
    display: flex;
    flex-direction: column;
    font-size: 11px;
    font-weight: 700;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    gap: 4px;
}
.sspg-prefs-label--full {
    display: flex;
    flex-direction: column;
    font-size: 11px;
    font-weight: 700;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    gap: 4px;
    margin-bottom: 10px;
}
.sspg-prefs-input {
    font-family: inherit;
    font-size: 13px;
    font-weight: 400;
    color: #333;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 6px 8px;
    text-transform: none;
    letter-spacing: 0;
}
.sspg-prefs-input:focus {
    outline: none;
    border-color: #059669;
    background: #fff;
}

.sspg-prefs-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sspg-prefs-save {
    background: #059669;
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.sspg-prefs-save:hover { background: #047857; }
.sspg-prefs-status {
    font-size: 11px;
    font-weight: 600;
}
.sspg-prefs-status--saving { color: #2563eb; }
.sspg-prefs-status--saved { color: #059669; }
.sspg-prefs-status--error { color: #dc2626; }

/* Comment metadata */
.sspg-comment-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    font-size: 11px;
    margin-bottom: 4px;
}
.sspg-comment-target {
    font-weight: 700;
    color: #333;
}
.sspg-comment-date {
    color: #999;
}
.sspg-comment-status {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
}
.sspg-comment-status--open { background: #fef3c7; color: #92400e; }
.sspg-comment-status--acknowledged { background: #dbeafe; color: #1d4ed8; }
.sspg-comment-status--resolved { background: #d1fae5; color: #065f46; }
