/* ========================================
   Session Plans - STORY-RESTYLE-SESSPLAN-0006
   BEM + CSS Variables from shared-layout.css
   Preserva il layout originale (segmented row + 2x2 grid)
   ======================================== */

/* ========================================
   OVERRIDE: layout.css #containerDashboardSession h1 { color:var(--color-primary) }
   Questa regola e' condivisa con altri moduli (Results, LeaderBoard, ecc.)
   quindi non la rimuoviamo da layout.css. Sovrascriviamo solo per i nostri h1.
   ======================================== */
#containerDashboardSession h1.session-plan__title,
#containerDashboardSession h1.session-plan__header-title,
#containerDashboardSession h1.sp-matrix__subtitle {
    color: var(--color-primary);
    font-family: var(--font-family-regular);
}

/* ========================================
   BLOCK: session-plan (page container)
   ======================================== */

.session-plan {
    position: relative;
    overflow: auto;
    width: 100%;
    font-family: var(--font-body);
    color: var(--color-text-primary);
    float: left;
    overflow-x: hidden !important;
    min-height: 100%;
}

/* --- Page H1 (desktop title) --- */
.session-plan__title {
    padding-top: 49px;
    margin-bottom: 2vh;
    padding-left: var(--padding-lateral);
}

/* --- Mobile header --- */
.session-plan__header-mobile {
    display: none;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
}

.session-plan__back-btn {
    display: inline-block;
    width: 24px;
    height: 24px;
    background: url('../../../../themes/simple/images/2026/BACK.png') no-repeat center / contain;
    background-size: 24px;
    cursor: pointer;
}

.session-plan__header-title {
    font-family: var(--font-secondary-header);
    font-weight: var(--weight-secondary-header);
    font-size: var(--font-size-lg);
    line-height: var(--line-height-secondary);
    color: var(--color-text-primary);
    margin: 0;
}

/* --- Load more --- */
.session-plan__load-more {
    margin-top: 50px;
    width: 220px;
    height: 50px;
    text-transform: uppercase;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    flex-flow: row nowrap;
    justify-content: space-around;
}

.session-plan__load-more p {
    font-family: var(--font-body);
    color: var(--color-primary);
    font-size: 16px;
    cursor: pointer;
    display: inline-block;
    padding: 10px;
    margin: 0;
}

.session-plan__load-more-icon {
    width: 40px;
    height: 40px;
    background: transparent url('../../../../themes/simple/images/2026/FULL_ARROW_DOWN.png') center center no-repeat;
    background-size: 15px;
}

/* --- Empty state --- */
.session-plan__empty {
    text-align: center;
    padding: var(--spacing-3xl) var(--spacing-lg);
    font-family: var(--font-body);
    font-size: var(--size-body);
    color: var(--color-text-muted);
}

/* --- Padding bottom on list view --- */
.session-plan div[ng-hide="matrixActive"] {
    padding-bottom: 60px;
}


/* ========================================
   BLOCK: sp-item (session plan list item)
   ======================================== */

.sp-item {
    margin-bottom: 1vh;
}

.sp-item:last-child {
    margin-bottom: 50px;
}

.sp-item__container {
    width: 100%;
    padding-right: var(--padding-lateral);
    padding-left: var(--padding-lateral);
}

/* --- Row header (segmented bar) --- */
.sp-item__row {
    width: 100%;
    background: var(--color-background-light);
    font-size: 18px;
    position: relative;
    height: 48px;
    clear: both;
    line-height: 52px;
    border-bottom: var(--color-border) 1px solid;
    display: flex;
}

.sp-item--collapsed .sp-item__row {
    height: 45px;
    line-height: 35px;
}

.sp-item__row p {
    font-family: var(--font-family-regular);
    font-size: 18px;
    margin: 0;
}

/* Grade number segment (gray) */
.sp-item__grade-number {
    width: 57px;
    height: 100%;
    float: left;
    background-color: var(--color-secondary);
    color: var(--color-background-light);
    font-size: 30px;
    font-family: var(--font-family-regular);
    text-align: center;
    border-right: 1px solid var(--color-background-light);
    border-bottom: var(--color-secondary) 1px solid;
    flex-shrink: 0;
}

.sp-item--collapsed .sp-item__grade-number {
    font-size: 18px;
}

.sp-item__grade-number--compact {
    padding-top: 5px;
}

/* Name segment (primary color) */
.sp-item__name {
    float: left;
    height: 100%;
    background-color: var(--color-primary);
    text-align: center;
    color: var(--color-background-light);
    border-right: 1px solid var(--color-background-light);
    border-bottom: var(--color-primary) 1px solid;
    padding-left: var(--spacing-lg);
    padding-right: var(--spacing-lg);
    font-family: var(--font-family-regular);
    width: fit-content;
    white-space: nowrap;
}

.sp-item__name--compact {
    padding-top: 5px;
}

.sp-item--collapsed .sp-item__name {
    font-size: 18px;
}

/* Vote segment (primary color) */
.sp-item__vote {
    float: left;
    width: 126px;
    height: 100%;
    background-color: var(--color-primary);
    text-align: center;
    color: var(--color-background-light);
    border-right: 1px solid var(--color-background-light);
    border-bottom: var(--color-primary) 1px solid;
    flex-shrink: 0;
}

.sp-item__vote p span:first-child {
    font-size: 16px;
    margin: 0;
    height: 100%;
}

.sp-item__vote p span:last-child {
    font-size: 30px;
    cursor: pointer;
}

.sp-item--collapsed .sp-item__vote p span {
    font-size: 18px;
}

.sp-item__vote--compact {
    padding-top: 5px;
}

/* Date segment (light background) */
.sp-item__date {
    float: left;
    height: 100%;
    background: var(--color-background-darker);
    color: var(--color-text-primary);
    padding-top: 3px;
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
    font-size: 18px;
    border-bottom: var(--color-border) 1px solid;
    width: fit-content;
    white-space: nowrap;
}

.sp-item--collapsed .sp-item__date {
    font-size: 14px;
}

/* Need correction badge */
.sp-item__needs-correction {
    float: left;
    height: 100%;
    color: var(--color-error);
    padding-top: 3px;
    font-size: 18px;
    padding-left: 10px;
    flex-shrink: 0;
}

.sp-item--collapsed .sp-item__needs-correction {
    font-size: 14px;
}

/* Trigger segment (expand/collapse) — pushed to far right */
.sp-item__trigger {
    cursor: pointer;
    width: 48px;
    height: 100%;
    background: var(--color-background-light);
    flex-shrink: 0;
    margin-left: auto;
}

/* --- Content wrapper --- */
.sp-item__content-wrapper {
    width: 100%;
}

@media screen and (max-width: 767px) {
    .sp-item__row {
        display: flex;
        flex-direction: row;
    }
    .sp-item__grade-number {
        flex-basis: 0;
        flex-grow: 1;
        width: auto;
    }
    .sp-item__vote {
        flex-basis: 0;
        flex-grow: 2;
        width: auto;
    }
    .sp-item__date {
        flex-basis: 0;
        flex-grow: 2;
    }
    .sp-item__needs-correction {
        flex-basis: 0;
        flex-grow: 2;
    }
    .sp-item__trigger {
        flex-basis: 0;
        flex-grow: 1;
        width: auto;
    }
    .sp-item__container {
        padding-left: 20px;
        padding-right: 20px;
    }
    .sp-item__vote p span:first-child {
        display: none;
    }
    .sp-item__name p span:first-child {
        display: none;
    }
}


/* ========================================
   BLOCK: sp-detail (expanded session detail)
   Originale: grid 2x2 (4 quadranti)
   ======================================== */

.sp-detail {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: auto auto;
    gap: 20px;
    padding: 20px 0;
    width: 100%;
}

.sp-detail__header,
.sp-detail__section {
    background: var(--color-background-light);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-md);
}

/* --- Section titles & text (restyled with CSS Vars) --- */
.sp-detail__section-title {
    font-size: var(--font-size-xl);
}

.sp-detail__section-text,
.sp-detail__section-text p {
    font-family: var(--font-body);
    font-weight: var(--weight-body);
    font-size: 15px;
    margin-bottom: 12px;
    text-align: justify;
    color: var(--color-text-primary);
}

.sp-detail__section-text--old-vocab {
    line-height: 35px;
}

.sp-detail__subtitle {
    font-weight: var(--weight-secondary-header);
    font-size: 14px;
    line-height: 20px;
    color: var(--color-text-secondary);
    margin: 0;
}

.sp-detail__divider {
    border: none;
    border-top: 2px solid var(--color-text-secondary);
    margin: var(--spacing-lg) 0;
}

/* --- Teacher info --- */
.sp-detail__teacher {
    height: 40px;
    margin: 10px 0;
    margin-bottom: 36px;
    width: 100%;
    display: flex;
    align-items: center;
}

.sp-detail__teacher-photo {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-round);
    object-fit: cover;
    float: left;
    margin-right: 5px;
}

.sp-detail__teacher-name {
    color: var(--color-error);
    font-family: var(--font-body);
    font-size: 18px;
    padding-top: 9px;
    float: left;
    margin-left: 10px;
}

/* --- Objectives --- */
.sp-detail__objectives {
    margin-top: var(--spacing-md);
}

/* --- Vocabulary list --- */
.sp-detail__vocabulary-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    align-content: flex-start;
    list-style: none;
    padding: 0;
    margin: 0;
}

.sp-detail__vocab-word {
    flex: 1 1 45%;
    box-sizing: border-box;
    list-style-type: disc;
    margin: 0 0 0 20px;
    font-family: var(--font-body);
    font-size: 15px;
}

/* --- Archive link (restyled) --- */
.sp-detail__archive-link {
    margin-top: var(--spacing-lg);
}

.sp-detail__archive-link h4 {
    margin: 0;
}

.sp-detail__archive-link img {
    margin-left: 5px;
    width: var(--icon-smaller-width);
}

/* --- Matrix link (restyled) --- */
.sp-detail__matrix-link {
    margin-top: var(--spacing-lg);
}

.sp-detail__matrix-link h4 {
    margin: 0;
}

.sp-detail__matrix-link img {
    margin-left: 5px;
    width: var(--icon-smaller-width);
}

/* --- Two-column layout (coaching, pronunciation, corrections) --- */
.sp-detail__columns {
    display: flex;
    grid-column: 1 / -1;
}

.sp-detail__col:first-child {
    width: 65%;
    float: left;
}

.sp-detail__col:last-child {
    width: 30%;
    float: right;
    margin-left: 3vw;
}

@media screen and (max-width: 800px) {
    .sp-detail__col:last-child {
        width: 100%;
        float: left;
        margin-left: 12px;
        margin-top: 30px;
    }
}

/* --- Collapse bar (coaching, group, pronunciation) --- */
.sp-detail__collapse-bar {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: -24px;
}

.sp-detail__accent-line {
    flex: 1;
    height: 3px;
    background: var(--color-primary);
    border-radius: 2px;
}

.sp-detail__body {
    grid-column: 1 / -1;
}


/* ========================================
   BLOCK: sp-grade (grade display)
   ======================================== */

.sp-grade__overall {
    display: flex;
    justify-content: center;
    font-family: var(--font-secondary-header);
    font-weight: var(--weight-secondary-header);
    font-size: var(--font-size-lg);
    color: var(--color-text-primary);
    margin: var(--spacing-sm) 0 var(--spacing-md);
}

.sp-grade__details {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.sp-grade__item {
    background: var(--color-background-dark);
    border: 2px solid var(--color-primary);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-md) var(--spacing-lg);
}

.sp-grade__item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-xs);
}

.sp-grade__label {
    font-family: var(--font-preheader);
    font-weight: var(--weight-preheader);
    font-size: var(--size-preheader);
    letter-spacing: var(--letter-spacing-preheader);
    text-transform: uppercase;
    color: var(--color-text-secondary);
    margin: 0;
}

.sp-grade__value {
    font-family: var(--font-secondary-header);
    font-weight: var(--weight-secondary-header);
    font-size: var(--font-size-lg);
    color: var(--color-primary);
    margin: 0;
}

.sp-grade__item p {
    font-size: var(--size-body-small);
    color: var(--color-text-primary);
    margin: 0;
}

.sp-grade__moving-towards {
    color: var(--color-text-muted) !important;
    font-size: var(--font-size-xs) !important;
    margin-top: var(--spacing-xs) !important;
}


/* ========================================
   BLOCK: sp-hw-btn (homework action buttons)
   ======================================== */

.sp-hw-btn {
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.sp-hw-btn h4 {
    margin: 0;
}

.sp-hw-btn img {
    margin-left: 5px;
    width: var(--icon-smaller-width);
}


/* ========================================
   BLOCK: sp-matrix (matrix explanation)
   ======================================== */

.sp-matrix {
    width: 90%;
}

.sp-matrix__subtitle {
    padding-top: 0;
    margin: 0;
    color: var(--color-primary);
    font-size: 30px;
    font-family: var(--font-family-regular);
    margin-bottom: 2vh;
    margin-left: var(--padding-lateral);
}

.sp-matrix__divider {
    height: 2px;
    background: var(--color-border);
    margin-left: var(--padding-lateral);
    margin-bottom: var(--spacing-lg);
}

.sp-matrix__grade-content {
    padding: 0 var(--spacing-xl);
}

.sp-matrix__results {
    padding: var(--spacing-lg) 0;
}

/* --- Level navigation --- */
.sp-matrix__level {
    margin-bottom: var(--spacing-xl);
    margin-left: var(--padding-lateral);
}

.sp-matrix__level-text {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
}

.sp-matrix__level-prev,
.sp-matrix__level-next {
    font-family: var(--font-body);
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    flex: 1;
}

.sp-matrix__level-prev {
    text-align: left;
}

.sp-matrix__level-next {
    text-align: right;
}

.sp-matrix__level-current {
    flex: 2;
    text-align: center;
}

.sp-matrix__level-label {
    font-family: var(--font-family-regular);
    font-size: 16px;
    color: var(--color-text-secondary);
    margin-right: var(--spacing-xs);
}

.sp-matrix__level-value {
    font-family: var(--font-secondary-header);
    font-weight: var(--weight-secondary-header);
    font-size: var(--font-size-xl);
    color: var(--color-primary);
}

.sp-matrix__level-desc {
    font-family: var(--font-body);
    font-size: var(--size-body-small);
    color: var(--color-text-secondary);
    display: block;
    margin-top: var(--spacing-xs);
}

/* ng-bind-html badge classes (injected into DOM) */
.sp-matrix__level-badge {
    font-family: var(--font-family-regular);
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

.sp-matrix__level-badge-num {
    font-family: var(--font-secondary-header);
    font-weight: var(--weight-secondary-header);
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

/* --- Level nav arrows --- */
.sp-matrix__level-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    width: 100%;
}

.sp-matrix__level-nav a {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    line-height: 0;
}

.sp-matrix__arrow {
    width: 32px;
    height: 32px;
    cursor: pointer;
    z-index: 1;
    flex-shrink: 0;
    transition: var(--transition-fast);
}

.sp-matrix__arrow:hover {
    opacity: 0.7;
}

.sp-matrix__arrow--left {
    background: transparent url('../../../../themes/simple/images/2026/BACK.png') no-repeat center / contain;
    background-size: 32px;
}

.sp-matrix__arrow--right {
    background: transparent url('../../../../themes/simple/images/2026/LINK_ICON.png') no-repeat center / contain;
    background-size: 32px;
}

img.sp-matrix__arrow {
    /* When arrow is an <img> tag (pronunciation, group, conf call matrices) */
    width: 32px;
    height: 32px;
    display: block;
}

.sp-matrix__arrow-line {
    position: absolute;
    left: 32px;
    right: 32px;
    top: 50%;
    height: 1px;
    background: var(--color-border);
    transform: translateY(-50%);
}

/* --- Matrix content categories --- */
.sp-matrix__content {
    margin-top: var(--spacing-lg);
}

.sp-matrix__column {
    display: flex;
    flex-direction: column;
}

.sp-matrix__category {
    padding: var(--spacing-lg);
    border: 1px solid var(--color-border);
    border-bottom: none;
}

.sp-matrix__category--first {
    border-radius: var(--border-radius-md) var(--border-radius-md) 0 0;
}

.sp-matrix__category--last {
    border-bottom: 1px solid var(--color-border);
    border-radius: 0 0 var(--border-radius-md) var(--border-radius-md);
}

/* When a category is both first and last (single category) */
.sp-matrix__category--first.sp-matrix__category--last {
    border-radius: var(--border-radius-md);
    border-bottom: 1px solid var(--color-border);
}

.sp-matrix__category-title {
    font-family: var(--font-family-regular);
    font-weight: var(--weight-secondary-header);
    font-size: 20px;
    color: var(--color-primary);
    margin-bottom: var(--spacing-sm);
}

.sp-matrix__category-text {
    font-family: var(--font-body);
    font-size: var(--size-body);
    line-height: var(--line-height-body);
    color: var(--color-text-primary);
}

/* --- Back link --- */
.sp-matrix__back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-lg) var(--spacing-xl);
    cursor: pointer;
    margin-left: var(--padding-lateral);
}

.sp-matrix__back-action {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-family: var(--font-body);
    font-weight: var(--weight-body-bold);
    font-size: var(--size-body);
    color: var(--color-primary);
    text-decoration: none;
}

.sp-matrix__back-action:hover {
    color: var(--color-primary-hover);
}

.sp-matrix__back-icon {
    width: 20px;
    height: 20px;
}


/* ========================================
   BLOCK: sp-vocab-popup (vocabulary popup)
   ======================================== */

.sp-vocab-popup__overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(44, 42, 38, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sp-vocab-popup {
    background: var(--color-background-light);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sp-vocab-popup__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-primary);
    padding: 0 50px;
}

.sp-vocab-popup__header h4 {
    margin: 0;
    color: var(--color-background-light);
    font-size: 30px;
    line-height: 50px;
    font-weight: bold;
}

.sp-vocab-popup__content {
    padding: 0 50px;
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

.sp-vocab-popup__close {
    width: 20px;
    height: 20px;
    background: url('../../../../themes/simple/images/escPopup.png') no-repeat center / contain;
    cursor: pointer;
}

.sp-vocab-popup__close img {
    width: 100%;
    height: 100%;
}

.sp-vocab-popup__dates {
    flex-shrink: 0;
    padding: var(--spacing-lg) 0;
}

.sp-vocab-popup__dates h5 {
    font-family: var(--font-family-regular);
    font-size: var(--size-body);
    color: var(--color-text-primary);
    margin: 0 0 var(--spacing-sm);
}

.sp-vocab-popup__dates-list p,
.sp-vocab-popup__dates > p {
    background: var(--color-primary);
    float: left;
    color: var(--color-background-light);
    border: 1px solid var(--color-primary);
    padding: 1px 1px 1px 7px;
    margin-right: 5px;
    margin-bottom: 5px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: var(--size-body-small);
    transition: var(--transition-fast);
}

.sp-vocab-popup__year--selected {
    background: var(--color-primary-hover) !important;
    font-weight: var(--weight-body-bold);
}

.sp-vocab-popup__words {
    flex: 1;
    padding: var(--spacing-lg);
    overflow-y: auto;
}

.sp-vocab-popup__words h5 {
    font-family: var(--font-secondary-header);
    font-weight: var(--weight-secondary-header);
    font-size: var(--font-size-md);
    color: var(--color-text-primary);
    margin: 0 0 var(--spacing-sm);
}

.sp-vocab-popup__year-words p {
    font-family: var(--font-body);
    font-size: var(--size-body);
    color: var(--color-text-primary);
    padding: var(--spacing-xs) 0;
    border-bottom: 1px solid var(--color-border);
    margin: 0;
}

.sp-vocab-popup__word {
    font-weight: var(--weight-body-bold);
}


/* ========================================
   BLOCK: sp-hw-popup (homework popups)
   ======================================== */

.sp-hw-popup__overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(44, 42, 38, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sp-hw-popup {
    background: var(--color-background-light);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
}

.sp-hw-popup--corrected {
    max-width: 900px;
}

.sp-hw-popup__close {
    position: absolute;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    width: 15px;
    height: 15px;
    background: url('../../../../themes/simple/images/escPopup.png') no-repeat center / contain;
    cursor: pointer;
    z-index: 1;
    transition: var(--transition-fast);
}

.sp-hw-popup__close:hover {
    opacity: 0.7;
}

.sp-hw-popup__title {
    padding: var(--spacing-xl) var(--spacing-xl) var(--spacing-md);
}

.sp-hw-popup__title h1 {
    font-family: var(--font-secondary-header);
    font-weight: var(--weight-secondary-header);
    font-size: var(--size-secondary-header);
    color: var(--color-text-primary);
    margin: 0;
}

.sp-hw-popup__body {
    padding: 0 var(--spacing-xl) var(--spacing-xl);
}

.sp-hw-popup__editor {
    margin-bottom: var(--spacing-lg);
}

.sp-hw-popup__actions-wrapper {
    border-top: 1px solid var(--color-border);
    padding-top: var(--spacing-md);
}

.sp-hw-popup__body + .sp-hw-popup__actions-wrapper {
    padding: var(--spacing-md) var(--spacing-xl) var(--spacing-xl);
}

.sp-hw-popup__actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.sp-hw-popup__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: 24px;
    cursor: pointer;
    transition: var(--transition-default);
    font-family: var(--font-body);
    font-weight: var(--weight-body-bold);
    font-size: var(--size-body-small);
    line-height: 1;
    text-decoration: none;
    appearance: none;
}

.sp-hw-popup__btn h5 {
    font-family: var(--font-body);
    font-weight: var(--weight-body-bold);
    font-size: var(--size-body-small);
    margin: 0;
}

.sp-hw-popup__btn--save {
    background: transparent;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
}

.sp-hw-popup__btn--save:hover {
    background: rgba(188, 150, 98, 0.1);
    border-color: var(--color-primary);
}

.sp-hw-popup__btn--confirm,
.sp-hw-popup__btn--confirm-audio {
    background: var(--color-primary);
    border: 1px solid var(--color-primary);
    color: var(--color-background-light);
}

.sp-hw-popup__btn--confirm:hover,
.sp-hw-popup__btn--confirm-audio:hover {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
}

.sp-hw-popup__btn--disabled {
    background: var(--color-background-dark) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text-secondary) !important;
    cursor: not-allowed !important;
    pointer-events: none;
}

.sp-hw-popup__btn > img,
.sp-hw-popup__btn-icon img {
    width: var(--icon-smaller-width);
    height: auto;
    flex-shrink: 0;
    display: block;
}

.sp-hw-popup__btn-icon--disabled {
    opacity: 0.4;
}

/* --- Recording section --- */
.sp-hw-popup__recording {
    margin-bottom: var(--spacing-lg);
}

.sp-hw-popup__audio-container,
.sp-hw-popup__video-container {
    margin-bottom: var(--spacing-md);
}

.sp-hw-popup__audio-player {
    width: 100%;
    border-radius: var(--border-radius-md);
}

.sp-hw-popup__video-player {
    width: 100%;
    border-radius: var(--border-radius-md);
    background: var(--color-text-primary);
}

.sp-hw-popup__waveform {
    margin: var(--spacing-md) 0;
}

.sp-hw-popup__rec-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: 24px;
    font-family: var(--font-body);
    font-weight: var(--weight-body-bold);
    font-size: var(--size-body-small);
    cursor: pointer;
    transition: var(--transition-default);
    text-decoration: none;
    border: none;
    background: transparent;
}

.sp-hw-popup__rec-btn h5 {
    font-family: var(--font-body);
    font-weight: var(--weight-body-bold);
    font-size: var(--size-body-small);
    margin: 0;
}

.sp-hw-popup__rec-btn--start,
.sp-hw-popup__rec-btn--video-start {
    background: var(--color-error);
    color: var(--color-background-light);
    border: 1px solid var(--color-error);
}

.sp-hw-popup__rec-btn--stop,
.sp-hw-popup__rec-btn--video-stop {
    background: var(--color-text-primary);
    color: var(--color-background-light);
    border: 1px solid var(--color-text-primary);
}

.sp-hw-popup--audio .sp-hw-popup__body,
.sp-hw-popup--video .sp-hw-popup__body {
    padding-bottom: var(--spacing-md);
}

.sp-hw-popup__rec-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    justify-content: center;
    margin-top: var(--spacing-md);
}

/* Override legacy layout.css #record positioning inside homework popup */
.sp-hw-popup #record,
.sp-hw-popup #stop {
    position: static !important;
    left: auto !important;
    margin: 0 !important;
    float: none !important;
}

.sp-hw-popup .sp-hw-popup__rec-btn--start#record,
.sp-hw-popup .sp-hw-popup__rec-btn--video-start#record {
    background: var(--color-error) !important;
    color: var(--color-background-light) !important;
    border: 1px solid var(--color-error) !important;
}

.sp-hw-popup .sp-hw-popup__rec-btn--stop#stop,
.sp-hw-popup .sp-hw-popup__rec-btn--video-stop#stop {
    background: var(--color-text-primary) !important;
    color: var(--color-background-light) !important;
    border: 1px solid var(--color-text-primary) !important;
}

/* --- Corrected homework layout --- */
.sp-hw-popup__correction-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl);
    padding: 0 var(--spacing-xl) var(--spacing-xl);
}

.sp-hw-popup__student-work {
    font-family: var(--font-body);
    font-size: var(--size-body);
    line-height: var(--line-height-body);
    color: var(--color-text-primary);
    padding: var(--spacing-md);
    background: var(--color-background-dark);
    border-radius: var(--border-radius-md);
}

.sp-hw-popup__teacher-correction {
    font-family: var(--font-body);
    font-size: var(--size-body);
    line-height: var(--line-height-body);
    color: var(--color-text-primary);
}

.sp-hw-popup__teacher-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.sp-hw-popup__teacher-photo {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-round);
    overflow: hidden;
    border: 2px solid var(--color-primary);
    flex-shrink: 0;
}

.sp-hw-popup__teacher-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sp-hw-popup__teacher-info h4 {
    font-family: var(--font-body);
    font-weight: var(--weight-body-bold);
    font-size: var(--size-body);
    color: var(--color-text-primary);
    margin: 0;
}

.sp-hw-popup__score {
    margin-right: var(--spacing-lg);
}

.sp-hw-popup__score h5 {
    font-family: var(--font-body);
    font-size: var(--size-body);
    color: var(--color-text-primary);
    margin: 0;
}

.sp-hw-popup__matrix-link {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: var(--weight-body-bold);
    font-size: 15px;
    color: var(--color-primary);
    transition: var(--transition-default);
}

.sp-hw-popup__matrix-link:hover {
    color: var(--color-primary-hover);
}

.sp-hw-popup__matrix-icon {
    width: 20px;
    height: 20px;
    background: url('../../../../themes/simple/images/2026/LINK_ICON.png') no-repeat center / contain;
    background-size: 20px;
}


/* ========================================
   BLOCK: sp-students (corrections student list)
   ======================================== */

.sp-students {
    padding-top: var(--padding-lateral);
    padding-left: var(--padding-lateral);;
    padding-right: var(--padding-lateral);;
}

.sp-students__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.sp-students__search {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: 20px;
}

.sp-students__search-aligner {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.sp-students__search span {
    font-family: var(--font-family-regular);
    font-size: var(--size-body);
    color: var(--color-text-secondary);
}

.sp-students__search input {
    padding: var(--spacing-sm) var(--spacing-md);
    font-family: var(--font-body);
    font-size: var(--size-body-small);
    border: 0;
    border-radius: var(--border-radius-sm);
    outline: none;
    transition: var(--transition-default);
}

.sp-students__search-icon {
    width: 16px;
    height: 24px;
    cursor: pointer;
}

.sp-students__search-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* --- Top bar --- */
.sp-students__top-bar {
    width: 100%;
    margin-top: var(--padding-lateral);
    height: 48px;
    background-color: var(--color-background-light);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}

.sp-students__top-bar-contents {
    display: flex;
    flex-wrap: wrap;
}

.sp-students__top-bar-title {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--color-background-darker);
    padding-left: var(--spacing-lg);
    padding-right: var(--spacing-lg);
}

.sp-students__top-bar-title-name {
    background-color: var(--color-primary);
}

.sp-students__top-bar-title span {
    font-family: var(--font-family-regular);
    font-size: var(--size-body);
    color: var(--color-text-primary);
}

.sp-students__top-bar-title-name span {
    color: var(--color-background-light);
}

.sp-students__top-bar-search-input {
    flex: 1;
}

.sp-students__top-bar-input {
    width: 100%;
    padding: var(--spacing-xs) var(--spacing-sm);
    font-family: var(--font-body);
    font-size: var(--size-body-small);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    outline: none;
}

.sp-students__mobile-search-lens {
    width: 20px;
    height: 20px;
    background: url('../../../../themes/simple/images/searchThread.png') no-repeat center / contain;
    cursor: pointer;
}

.sp-students__mobile-search-close {
    width: 48px;
    cursor: pointer;
}

/* --- Student list --- */
.sp-students__list {
    padding: var(--spacing-md) 0;
}

.sp-students__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    transition: var(--transition-default);
}

.sp-students__row:hover {
    background: var(--color-background-hover);
}

.sp-students__row--last {
    border-bottom: none;
}

.sp-students__info {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.sp-students__photo {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-round);
    object-fit: cover;
    border: 2px solid var(--color-border);
}

.sp-students__name {
    font-family: var(--font-body);
    font-weight: var(--weight-body-bold);
    font-size: var(--size-body);
    color: var(--color-text-primary);
}

.sp-students__stats {
    display: flex;
    gap: var(--spacing-lg);
}

.sp-students__stats h5 {
    font-family: var(--font-body);
    font-size: var(--size-body-small);
    color: var(--color-text-secondary);
    margin: 0;
}

.sp-students__stat--highlight {
    color: var(--color-error) !important;
    font-weight: var(--weight-body-bold);
}

.sp-students__empty {
    text-align: center;
    padding: var(--spacing-3xl) var(--spacing-lg);
    font-family: var(--font-body);
    font-size: var(--size-body);
    color: var(--color-text-muted);
}

/* --- Filter row (corrections) --- */
.sp-students__filter {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-left: auto;
}

.sp-students__filter-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.sp-students__filter span {
    font-family: var(--font-body);
    font-weight: var(--weight-body-bold);
    font-size: var(--size-body-small);
    color: var(--color-text-primary);
}

/* --- Close student SP button --- */
.sp-students__close-btn {
    width: 24px;
    height: 24px;
    background: url('../../../../themes/simple/images/escPopup.png') no-repeat center / contain;
    cursor: pointer;
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
}

.sp-students__no-sp {
    text-align: center;
    padding: var(--spacing-xl);
    font-family: var(--font-body);
    font-size: var(--size-body);
    color: var(--color-text-muted);
    position: relative;
}


/* ========================================
   BLOCK: sp-correction-popup (teacher correction popup)
   ======================================== */

.sp-correction-popup {
    background: var(--color-background-light);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.sp-correction-popup--video {
    max-width: 1000px;
}

.sp-correction-popup__close {
    position: absolute;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    width: 28px;
    height: 28px;
    background: url('../../../../themes/simple/images/escPopup.png') no-repeat center / contain;
    cursor: pointer;
    z-index: 1;
}

.sp-correction-popup__title {
    padding: var(--spacing-xl) var(--spacing-xl) var(--spacing-md);
    grid-column: 1 / -1;
}

.sp-correction-popup__title h1 {
    font-family: var(--font-secondary-header);
    font-weight: var(--weight-secondary-header);
    font-size: var(--size-secondary-header);
    color: var(--color-text-primary);
    margin: 0;
}

.sp-correction-popup__body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl);
    padding: 0 var(--spacing-xl) var(--spacing-xl);
    overflow-y: auto;
    flex: 1 1 auto;
}

.sp-correction-popup__student-work {
    font-family: var(--font-body);
    font-size: var(--size-body);
    line-height: var(--line-height-body);
    color: var(--color-text-primary);
    padding: var(--spacing-md);
    background: var(--color-background-dark);
    border-radius: var(--border-radius-md);
}

.sp-correction-popup__teacher-side {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.sp-correction-popup__teacher-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    justify-content: space-between;
}

.sp-correction-popup__teacher-photo {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-round);
    overflow: hidden;
    border: 2px solid var(--color-primary);
    flex-shrink: 0;
}

.sp-correction-popup__teacher-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sp-correction-popup__evaluate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--color-primary);
    color: var(--color-background-light);
    border: none;
    border-radius: 24px;
    font-family: var(--font-body);
    font-weight: var(--weight-body-bold);
    font-size: var(--size-body-small);
    cursor: pointer;
    transition: var(--transition-default);
}

.sp-correction-popup__evaluate-btn:hover {
    background: var(--color-primary-hover);
}

.sp-correction-popup__evaluate-btn--disabled {
    background: var(--color-background-dark) !important;
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary) !important;
    cursor: not-allowed !important;
    pointer-events: none;
}

.sp-correction-popup__editor textarea {
    width: 100%;
    min-height: 200px;
    font-family: var(--font-body);
    font-size: var(--size-body);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-md);
    resize: vertical;
}

.sp-correction-popup__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
    padding: var(--spacing-lg) var(--spacing-xl);
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}

.sp-correction-popup__actions .sp-hw-popup__btn {
    min-width: 120px;
    padding: 10px 24px;
    font-size: var(--font-size-md);
}

.sp-correction-popup__avg-grade {
    font-family: var(--font-body);
    font-size: var(--size-body-small);
    color: var(--color-text-secondary);
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--color-background-dark);
    border-radius: 24px;
    margin-right: auto;
}

/* Only small screen utility */
.only-small-screen {
    display: none;
}


/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .session-plan__header-mobile {
        display: flex;
    }

    .session-plan__title {
        display: none;
    }

    .only-small-screen {
        display: block;
    }

    .sp-detail {
        grid-template-columns: 1fr;
    }

    .sp-detail__columns {
        flex-direction: column;
    }

    .sp-detail__col:first-child,
    .sp-detail__col:last-child {
        width: 100%;
        float: none;
        margin-left: 0;
    }

    .sp-matrix {
        width: 100%;
    }

    .sp-matrix__level {
        margin-left: 20px;
        padding: 0 20px;
    }

    .sp-hw-popup {
        width: 95%;
        max-height: 90vh;
    }

    .sp-hw-popup__correction-body {
        grid-template-columns: 1fr;
    }

    .sp-correction-popup__body {
        grid-template-columns: 1fr;
    }

    .sp-correction-popup__actions {
        flex-wrap: wrap;
        justify-content: stretch;
    }

    .sp-correction-popup__actions .sp-hw-popup__btn {
        flex: 1 1 calc(50% - var(--spacing-sm));
        min-width: 0;
    }

    .sp-correction-popup__avg-grade {
        flex: 1 1 100%;
        margin-right: 0;
    }

    .sp-students {
        padding-left: 15px;
        padding-right: 15px;
    }
}

@media (max-width: 480px) {
    .sp-vocab-popup {
        width: 95%;
    }

    .sp-vocab-popup__content {
        flex-direction: column;
        padding: 0 15px;
    }

    .sp-vocab-popup__header {
        padding: 0 15px;
    }
}
