/* Task #1566: single source of truth for the full-screen student pop-up
   (dark backdrop, white panel, red X close button). Used by:
   - manager timetable (.students-overlay*, was in timetable.css)
   - manager free trials (.students-overlay*, was inline)
   - shared student quick-search include (.sb-students-overlay*, was inline)
   Loaded globally from base.html. Per-page tweaks go through the CSS
   variables below, never by re-declaring these rules:
   --overlay-left      left edge of the backdrop (default 0)
   --overlay-backdrop  backdrop colour (default rgba(0,0,0,0.3))
   --overlay-z         stacking base; the X sits at +1 (default 2000)
   --overlay-inset     panel gap from the viewport edges (default 10px) */
.students-overlay,
.sb-students-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: var(--overlay-left, 0);
    right: 0;
    bottom: 0;
    background: var(--overlay-backdrop, rgba(0,0,0,0.3));
    z-index: var(--overlay-z, 2000);
}
.students-overlay.show,
.sb-students-overlay.show {
    display: block;
}
.students-overlay-content,
.sb-students-overlay .sb-overlay-content {
    position: absolute;
    top: var(--overlay-inset, 10px);
    left: var(--overlay-inset, 10px);
    right: var(--overlay-inset, 10px);
    bottom: var(--overlay-inset, 10px);
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.students-overlay-close,
.sb-students-overlay .sb-overlay-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: calc(var(--overlay-z, 2000) + 1);
    display: flex;
    align-items: center;
    justify-content: center;
}
.students-overlay-close:hover,
.sb-students-overlay .sb-overlay-close:hover {
    background: #c82333;
}
.students-overlay iframe,
.sb-students-overlay iframe {
    width: 100%;
    height: 100%;
    border: none;
}
/* Task #1565: on phones the iOS status bar overlays the top of the
   viewport, making the X untappable. Push the panel below the safe
   area and grow the X to a 44px tap target. The sidebar also collapses,
   so the backdrop spans the full width. */
@media (max-width: 768px) {
    .students-overlay,
    .sb-students-overlay {
        left: 0;
    }
    .students-overlay-content,
    .sb-students-overlay .sb-overlay-content {
        top: calc(10px + env(safe-area-inset-top, 0px));
        left: 10px;
        right: 10px;
        bottom: 10px;
    }
    .students-overlay-close,
    .sb-students-overlay .sb-overlay-close {
        width: 44px;
        height: 44px;
        font-size: 22px;
    }
}
