/* DS-04 rev 2: gradebook grading-awareness, entry-mode controls, newest-left rail (WP1-WP5) */

.gb-scalebar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 14px;
}

.gb-legend-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-right: 6px;
}

.gb-legend-swatches {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 10.5px;
    color: var(--text-muted);
}

.gb-legend-item {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.gb-legend-swatch {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 3px;
    margin-right: 5px;
}

.gb-flag {
    display: inline-block;
    font-size: 8.5px;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 99px;
    letter-spacing: 0.04em;
    margin-left: 6px;
    text-transform: uppercase;
    vertical-align: middle;
}

.gb-flag-risk {
    background: rgba(239, 68, 68, 0.22);
    color: #f87171;
}

.gb-flag-drop {
    background: rgba(245, 158, 11, 0.22);
    color: #fbbf24;
}

/* One number per cell: the editable raw input, tinted by its resolved grade band.
   Kept compact so more columns fit on screen. */
.gb-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
}

/* Compound selector (.results-grade-input.gb-cell-input) so these win over the base
   .results-grade-input rule in 02_specific.css regardless of stylesheet load order. */
.results-grade-input.gb-cell-input {
    width: 28px !important;
    max-width: 34px !important;
    height: 22px !important;
    padding: 0.05rem 0.05rem !important;
    border-radius: 4px !important;
    font-weight: 700 !important;
    font-size: 0.7rem !important;
    line-height: 1 !important;
}

/* Keep the whole grade cell (input + padding) at ~28px tall. */
.results-table td.results-td-grade {
    height: 28px !important;
    padding-top: 2px !important;
    padding-bottom: 2px !important;
}

/* Tighter gridlines so the compact cells aren't padded back out. */
.results-table th,
.results-table td {
    padding: 2px 4px !important;
}

/* Much smaller date row under each column header. */
.results-table .results-date-input {
    width: 58px !important;
    font-size: 0.55rem !important;
    padding: 1px 2px !important;
}

/* Band tint on the input itself (overrides the transparent base with !important). */
.results-grade-input.gb-band-fail    { background: rgba(239, 68, 68, 0.20) !important; }
.results-grade-input.gb-band-warn    { background: rgba(245, 158, 11, 0.18) !important; }
.results-grade-input.gb-band-neutral { background: rgba(148, 163, 184, 0.16) !important; }
.results-grade-input.gb-band-ok      { background: rgba(6, 182, 212, 0.18) !important; }
.results-grade-input.gb-band-pass    { background: rgba(16, 185, 129, 0.20) !important; }

/* For dropdown selects, the shorthand 'background' kills the native SVG arrow. 
   We must restore the arrow and provide a subtle visible background/border for empty states. */
select.results-grade-input.gb-cell-input {
    background-color: var(--glass-bg) !important;
    background-image: var(--bs-form-select-bg-icon) !important;
    background-position: right 2px center !important;
    background-size: 10px 10px !important;
    border: 1px solid var(--glass-border) !important;
    /* Symmetric padding so the centered value isn't nudged left by the arrow's extra
       right padding. */
    padding-right: 4px !important;
    padding-left: 4px !important;
    text-align: center !important;
    text-align-last: center !important;
}

/* Ensure the band tints on dropdowns only change the background-color so the arrow isn't destroyed. */
select.results-grade-input.gb-band-fail    { background-color: rgba(239, 68, 68, 0.20) !important; }
select.results-grade-input.gb-band-warn    { background-color: rgba(245, 158, 11, 0.18) !important; }
select.results-grade-input.gb-band-neutral { background-color: rgba(148, 163, 184, 0.16) !important; }
select.results-grade-input.gb-band-ok      { background-color: rgba(6, 182, 212, 0.18) !important; }
select.results-grade-input.gb-band-pass    { background-color: rgba(16, 185, 129, 0.20) !important; }

.gb-newest {
    box-shadow: inset 3px 0 0 var(--accent-secondary, #06b6d4);
}

/* Session (participation) cells: grade input + optional note icon on the first row,
   an "Absent" line underneath. The td's 28px height acts as a minimum, so absent
   rows simply grow taller without breaking the compact grid. */
.gb-session-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.gb-cell-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.gb-note-icon {
    color: var(--accent-secondary, #06b6d4);
    font-size: 0.65rem;
    line-height: 1;
    cursor: help;
}

.gb-absent-row {
    color: #ef4444;
    font-size: 0.6rem;
    font-weight: 600;
    line-height: 1.2;
    margin-top: 2px;
    text-align: center;
}

.gb-group-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

/* Setting-aware entry-mode label (configured in Edit Structure, read-only in the grid). */
.gb-entry-label {
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    color: var(--text-muted);
    padding: 1px 7px;
    border-radius: 99px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
}

.gb-col-controls {
    display: inline-flex;
    gap: 3px;
}

.gb-col-btn {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 5px;
    font-size: 10px;
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.04);
}

.gb-col-btn-add:hover {
    color: var(--accent-secondary);
    border-color: var(--accent-secondary);
}

.gb-col-btn-del:hover {
    color: #ef4444;
    border-color: #ef4444;
}

.gb-lock-badge {
    font-size: 9px;
    color: #10b981;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}

/* Responsive (WP6): matches the app's existing 991.98px / 767.98px breakpoints */
@media (max-width: 991.98px) {
    .gb-scalebar {
        padding: 8px 10px;
        gap: 8px;
    }

    .gb-legend-swatches {
        width: 100%;
    }
}

@media (max-width: 767.98px) {
    .gb-group-controls {
        gap: 8px;
    }

    .gb-col-btn {
        width: 26px;
        height: 26px;
    }
}
