/* Shared variables */
:root {
    --portal-purple: #7368bd;
    --dark-gray: #71717a;
    --canvas: #f4f6fa;
    --white: #ffffff;
    --border: #d9d9dc;
}

/* index.php */
.home-page-body {
    min-width: 320px;
    overflow: auto;
    background: #f4f6fa;
}

.home-page {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 55px 27px 60px;
}

.home-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 70px;
    margin-bottom: 54px;
}

.home-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    text-decoration: none;
}

.home-logo__emblem {
    display: block;
    width: 64px;
    height: 62px;
    object-fit: contain;
}

.home-logo__text {
    display: block;
    width: 120px;
    height: 63px;
    object-fit: contain;
}

.date-navigator {
    display: grid;
    grid-template-columns: 54px minmax(220px, 1fr) 54px;
    align-items: center;
    width: 342px;
    height: 70px;
    color: var(--portal-purple);
    background: transparent;
    border: 2px solid var(--portal-purple);
    border-radius: 11px;
}

.date-navigator__button {
    display: grid;
    width: 100%;
    height: 100%;
    padding: 0;
    color: var(--portal-purple);
    background: transparent;
    border: 0;
    cursor: pointer;
    place-items: center;
}

.date-navigator__button svg,
.schedule-card__enter svg {
    width: 16px;
    height: 28px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 3;
}

.date-navigator__button:disabled {
    color: #d0d0d2;
    cursor: default;
}

.date-navigator__button:focus-visible,
.schedule-card__enter:focus-visible,
.home-logo:focus-visible {
    outline: 3px solid rgba(115, 104, 189, 0.35);
    outline-offset: 3px;
}

.date-navigator__label {
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 24px;
    font-weight: 400;
    line-height: 1;
}

.schedule-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 27px;
    width: 100%;
}

.schedule-card {
    position: relative;
    min-width: 0;
    overflow: hidden;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 3px 6px rgba(43, 47, 58, 0.12);
}

.schedule-card__media {
    position: relative;
    display: grid;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 2.55 / 1;
    background: #e8e7f3;
    place-items: center;
}

.schedule-card__fallback {
    width: 74px;
    height: 72px;
    object-fit: contain;
    opacity: 0.35;
}

.schedule-card__banner {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.schedule-card__count {
    position: absolute;
    z-index: 1;
    top: 20px;
    right: 19px;
    min-width: 140px;
    padding: 10px 18px;
    color: var(--portal-purple);
    background: #fff;
    border-radius: 999px;
    text-align: center;
    white-space: nowrap;
    font-size: 21px;
    font-weight: 400;
    line-height: 1;
}

.schedule-card__details {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 117px;
    padding: 18px 27px;
}

.schedule-card__summary {
    min-width: 0;
}

.schedule-card__title {
    overflow: hidden;
    margin: 0 0 7px;
    color: var(--portal-purple);
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 25px;
    font-weight: 600;
    line-height: 1.1;
}

.schedule-card__time {
    margin: 0;
    color: var(--dark-gray);
    white-space: nowrap;
    font-size: 22px;
    font-weight: 400;
    line-height: 1.1;
}

.schedule-card__enter {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    flex: 0 0 auto;
    color: var(--portal-purple);
    text-decoration: none;
    white-space: nowrap;
    font-size: 24px;
    font-weight: 400;
    line-height: 1;
}

.schedule-card__enter:hover {
    color: #5f54aa;
}

.schedule-state {
    grid-column: 1 / -1;
    display: grid;
    min-height: 220px;
    padding: 32px;
    color: var(--dark-gray);
    text-align: center;
    font-size: 20px;
    place-items: center;
}

.schedule-state--error {
    color: #b33a31;
}

@media (max-width: 1400px) {
    .schedule-card__details {
        gap: 16px;
        padding-right: 20px;
        padding-left: 20px;
    }

    .schedule-card__title {
        font-size: 20px;
    }

    .schedule-card__time {
        font-size: 18px;
    }

    .schedule-card__enter {
        gap: 10px;
        font-size: 19px;
    }
}

@media (max-width: 1000px) {
    .schedule-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .home-page {
        padding: 24px 16px 40px;
    }

    .home-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 24px;
        margin-bottom: 32px;
    }

    .date-navigator {
        grid-template-columns: 48px minmax(0, 1fr) 48px;
        width: 100%;
        height: 60px;
    }

    .date-navigator__label {
        font-size: 19px;
    }

    .schedule-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .schedule-card__count {
        top: 12px;
        right: 12px;
        min-width: 0;
        padding: 8px 13px;
        font-size: 16px;
    }
}

@media (max-width: 420px) {
    .schedule-card__details {
        align-items: flex-start;
        flex-direction: column;
        gap: 15px;
        padding: 20px;
    }
}

/* login.php */
* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    color: var(--dark-gray);
    background: var(--canvas);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.page-decoration {
    position: fixed;
    z-index: 0;
    width: 650px;
    height: 650px;
    border: 2px dashed var(--portal-purple);
    border-radius: 50%;
    pointer-events: none;
}

.page-decoration--top {
    top: -622px;
    left: -374px;
    width: 1000px;
    height: 1000px;
}

.page-decoration--bottom {
    right: -260px;
    bottom: -430px;
}

.login-page {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px;
}

.login-card {
    display: flex;
    flex-direction: column;
    width: 452px;
    min-height: 666px;
    padding: 32px;
    overflow: hidden;
    background: var(--white);
    border: 1px solid #e3e4e8;
    border-radius: 24px;
    box-shadow: 0 7px 14px rgba(31, 35, 48, 0.08);
}

.portal-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
    margin: 0 0 48px;
}

.portal-brand img {
    display: block;
    width: 100%;
    height: auto;
}

.login-form {
    display: flex;
    flex: 1;
    flex-direction: column;
}

.form-fields,
.form-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 12px;
}

.form-actions {
    margin-top: 48px;
}

.input-control {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.input-control svg {
    position: absolute;
    left: 16px;
    width: 20px;
    height: 20px;
    color: var(--portal-purple);
    pointer-events: none;
}

.input-control input {
    width: 100%;
    height: 44px;
    padding: 0 16px 0 44px;
    color: #3f3f46;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    outline: none;
    font: 400 14px/normal Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.input-control input::placeholder {
    color: var(--dark-gray);
    opacity: 1;
}

.input-control input:focus {
    border-color: var(--portal-purple);
    box-shadow: 0 0 0 3px rgba(115, 104, 189, 0.14);
}

.button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 44px;
    padding: 0 16px;
    border-radius: 6px;
    cursor: pointer;
    font: 400 14px/normal Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    transition: background-color 150ms ease, opacity 150ms ease;
}

.button--login {
    color: var(--white);
    background: var(--portal-purple);
    border: 1px solid var(--portal-purple);
}

.button--login:hover:not(:disabled) {
    background: #665bad;
}

.button--login:disabled {
    cursor: wait;
    opacity: 0.7;
}

.button--forgot {
    color: var(--dark-gray);
    background: var(--white);
    border: 1px solid var(--dark-gray);
}

.button--forgot:hover {
    background: #f8f8fa;
}

.form-message {
    min-height: 18px;
    margin: 12px 0 0;
    color: #c0392b;
    text-align: center;
    font-size: 13px;
    line-height: 18px;
}

.form-message:empty {
    display: none;
}

@media (max-width: 520px), (max-height: 720px) {
    body {
        overflow: auto;
    }

    .login-page {
        padding: 16px;
    }

    .login-card {
        width: min(100%, 452px);
        min-height: 0;
        padding: 24px;
        border-radius: 20px;
    }

    .portal-brand {
        width: min(100%, 340px);
        margin-right: auto;
        margin-bottom: 32px;
        margin-left: auto;
    }

    .form-actions {
        margin-top: 32px;
    }
}

/* attendance.php */
.attendance-page-body {
    min-width: 320px;
    overflow: auto;
    background: #f4f6fa;
}

.attendance-page {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 55px 27px 170px;
}

.attendance-header {
    margin-bottom: 48px;
}

.class-summary {
    display: flex;
    align-items: center;
    min-height: 64px;
}

.attendance-summary {
    display: flex;
    gap: 20px;
    margin-left: auto;
}

.attendance-summary__item {
    display: grid;
    width: 224px;
    height: 69px;
    color: #45454b;
    background: #e9e9e9;
    border-radius: 10px;
    font-size: 26px;
    font-weight: 400;
    line-height: 1;
    place-items: center;
}

.attendance-summary__item strong {
    font-weight: 700;
}

.attendance-summary__item--present {
    color: #fff;
    background: var(--portal-purple);
}

.class-summary__back {
    display: grid;
    width: 30px;
    height: 48px;
    margin-right: 26px;
    color: var(--dark-gray);
    text-decoration: none;
    place-items: center;
}

.class-summary__back svg {
    width: 16px;
    height: 28px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 3;
}

.class-summary__back:focus-visible {
    outline: 3px solid rgba(115, 104, 189, 0.35);
    outline-offset: 3px;
}

.class-summary__title {
    margin: 0 0 9px;
    color: var(--portal-purple);
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

.class-summary__time {
    margin: 0;
    color: var(--dark-gray);
    font-size: 22px;
    font-weight: 400;
    line-height: 1;
}

.attendance-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 27px;
    width: 100%;
    margin-top: 54px;
}

.student-card {
    --level-color: #a9d13a;
    display: flex;
    align-items: center;
    min-width: 0;
    min-height: 110px;
    padding: 16px 26px;
    background: #fff;
    border: 2px solid transparent;
    border-radius: 15px;
    box-shadow: 0 3px 6px rgba(43, 47, 58, 0.1);
    transition: background-color 150ms ease, border-color 150ms ease;
}

.student-card.level-1 { --level-color: #a9d13a; }
.student-card.level-2 { --level-color: #ffbf1e; }
.student-card.level-3 { --level-color: #e69a57; }
.student-card.level-4 { --level-color: #08bce9; }
.student-card.level-5 { --level-color: #7368bd; }

.student-card--present {
    background: #efedff;
    border-color: var(--portal-purple);
}

.attendance-page--update .student-card--present {
    background: #fff;
    border-color: transparent;
}

.student-card--absent {
    background: #fff0f0;
    border-color: #ef5c61;
}

.student-card__number {
    display: grid;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    margin-right: 21px;
    color: #3f3f46;
    background: #e8e8e8;
    border-radius: 7px;
    font-size: 20px;
    font-weight: 600;
    place-items: center;
}

.student-card--present .student-card__number {
    color: #fff;
    background: var(--portal-purple);
}

.attendance-page--update .student-card--present .student-card__number {
    color: #3f3f46;
    background: #e8e8e8;
}

.student-card--absent .student-card__number {
    color: #fff;
    background: #ef5c61;
}

.student-card__avatar {
    position: relative;
    display: grid;
    flex: 0 0 76px;
    width: 76px;
    height: 76px;
    margin-right: 20px;
    color: #fff;
    background: var(--level-color);
    border: 5px solid var(--level-color);
    border-radius: 50%;
    font-size: 22px;
    font-weight: 700;
    place-items: center;
}

.student-card__avatar > img:not(.student-card__level-logo) {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.student-card__level-logo {
    position: absolute;
    right: -8px;
    bottom: -7px;
    width: 36px;
    height: 36px;
    padding: 2px;
    background: #fff;
    border: 3px solid #fff;
    border-radius: 50%;
    object-fit: contain;
}

.student-card__identity {
    min-width: 0;
}

.student-card__name {
    overflow: hidden;
    margin: 0 0 8px;
    color: #303038;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 28px;
    font-weight: 600;
    line-height: 1;
}

.student-card__level {
    display: grid;
    width: 120px;
    height: 28px;
    color: #fff;
    background: var(--level-color);
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    place-items: center;
}

.student-card__present {
    flex: 0 0 139px;
    width: 139px;
    height: 69px;
    margin-left: auto;
    color: #45454b;
    background: #e9e9e9;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    font: 400 24px/1 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.student-card__present[aria-pressed="true"] {
    color: #fff;
    background: var(--portal-purple);
}

.attendance-page--update .student-card__present[aria-pressed="true"] {
    color: #45454b;
    background: #e9e9e9;
}

.student-card--absent .student-card__present {
    color: #fff;
    background: #ef5c61;
}

.student-card__present:focus-visible {
    outline: 3px solid rgba(115, 104, 189, 0.35);
    outline-offset: 3px;
}

.attendance-state {
    grid-column: 1 / -1;
    display: grid;
    min-height: 220px;
    padding: 32px;
    color: var(--dark-gray);
    text-align: center;
    font-size: 20px;
    place-items: center;
}

.attendance-state--error {
    color: #b33a31;
}

.attendance-action {
    position: fixed;
    z-index: 10;
    right: 27px;
    bottom: 68px;
    display: flex;
    align-items: center;
    height: 70px;
    padding-left: 16px;
    background: #f4f6fa;
}

.attendance-action__count {
    margin: 0 22px 0 0;
    color: var(--dark-gray);
    white-space: nowrap;
    font-size: 22px;
    font-weight: 400;
}

.attendance-action__count strong {
    font-weight: 400;
}

.attendance-action__check {
    display: inline-grid;
    width: 25px;
    height: 25px;
    margin-right: 10px;
    color: #fff;
    background: var(--portal-purple);
    border-radius: 50%;
    font-size: 15px;
    place-items: center;
}

.attendance-action__check--absent {
    color: #ef5c61;
    background: transparent;
    border-radius: 0;
}

.attendance-action__check svg {
    width: 25px;
    height: 25px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.2;
}

.attendance-action__divider {
    width: 1px;
    height: 69px;
    margin-right: 20px;
    background: var(--dark-gray);
}

.attendance-action__button {
    width: 276px;
    height: 69px;
    color: #fff;
    background: var(--portal-purple);
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    font: 400 24px/1 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.attendance-action__button:disabled {
    cursor: wait;
    opacity: 0.7;
}

.attendance-modal {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: grid;
    padding: 24px;
    background: rgba(32, 34, 43, 0.38);
    place-items: center;
}

.attendance-modal[hidden],
.attendance-action[hidden] {
    display: none;
}

.attendance-modal__dialog {
    width: min(716px, 100%);
    padding: 40px 32px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 14px 40px rgba(22, 24, 34, 0.18);
    text-align: center;
}

.attendance-modal__icon {
    display: grid;
    width: 80px;
    height: 80px;
    margin: 0 auto 18px;
    color: var(--portal-purple);
    background: var(--portal-purple);
    border-radius: 16px;
    place-items: center;
}

.attendance-modal__icon span {
    display: grid;
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 50%;
    font-size: 0;
    font-weight: 700;
    place-items: center;
}

.attendance-modal__icon span::before {
    content: "✓";
    font-size: 26px;
}

.attendance-modal__dialog h2 {
    margin: 0 0 24px;
    color: var(--portal-purple);
    font-size: 30px;
    font-weight: 700;
    line-height: 1;
}

.attendance-modal__dialog p {
    margin: 0 0 36px;
    color: #323238;
    font-size: 25px;
    font-weight: 400;
    line-height: 1.45;
}

.attendance-modal__button {
    width: 100%;
    height: 80px;
    color: #fff;
    background: var(--portal-purple);
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    font: 400 28px/1 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (max-width: 1400px) {
    .attendance-page {
        padding: 32px 16px 110px;
    }

    .attendance-header {
        min-height: 40px;
        margin-bottom: 27px;
    }

    .attendance-header .home-logo {
        gap: 6px;
    }

    .attendance-header .home-logo__emblem {
        width: 38px;
        height: 37px;
    }

    .attendance-header .home-logo__text {
        width: 71px;
        height: 37px;
    }

    .attendance-header .date-navigator {
        grid-template-columns: 32px minmax(130px, 1fr) 32px;
        width: 200px;
        height: 40px;
        border-width: 1px;
        border-radius: 6px;
    }

    .attendance-header .date-navigator__label {
        font-size: 14px;
    }

    .attendance-header .date-navigator__button svg {
        width: 10px;
        height: 17px;
        stroke-width: 2.5;
    }

    .class-summary {
        min-height: 39px;
    }

    .class-summary__back {
        width: 18px;
        height: 30px;
        margin-right: 15px;
    }

    .class-summary__back svg {
        width: 10px;
        height: 17px;
        stroke-width: 2.5;
    }

    .class-summary__title {
        margin-bottom: 6px;
        font-size: 16px;
    }

    .class-summary__time {
        font-size: 13px;
    }

    .attendance-summary {
        gap: 12px;
    }

    .attendance-summary__item {
        width: 132px;
        height: 40px;
        border-radius: 6px;
        font-size: 15px;
    }

    .attendance-grid {
        gap: 14px;
        margin-top: 28px;
    }

    .student-card {
        min-height: 66px;
        padding: 9px 14px;
        border-width: 1px;
        border-radius: 9px;
    }

    .student-card__number {
        flex-basis: 24px;
        width: 24px;
        height: 24px;
        margin-right: 12px;
        border-radius: 4px;
        font-size: 12px;
    }

    .student-card__avatar {
        flex-basis: 46px;
        width: 46px;
        height: 46px;
        margin-right: 12px;
        border-width: 3px;
        font-size: 13px;
    }

    .student-card__level-logo {
        right: -5px;
        bottom: -4px;
        width: 22px;
        height: 22px;
        border-width: 2px;
    }

    .student-card__name {
        margin-bottom: 5px;
        font-size: 16px;
    }

    .student-card__level {
        width: 70px;
        height: 16px;
        font-size: 8px;
    }

    .student-card__present {
        flex-basis: 81px;
        width: 81px;
        height: 40px;
        border-radius: 6px;
        font-size: 14px;
    }

    .attendance-action {
        right: 16px;
        bottom: 24px;
        height: 44px;
    }

    .attendance-action__count {
        margin-right: 14px;
        font-size: 14px;
    }

    .attendance-action__check {
        width: 17px;
        height: 17px;
        margin-right: 6px;
        font-size: 10px;
    }

    .attendance-action__check svg {
        width: 17px;
        height: 17px;
    }

    .attendance-action__divider {
        height: 42px;
        margin-right: 12px;
    }

    .attendance-action__button {
        width: 174px;
        height: 43px;
        border-radius: 6px;
        font-size: 15px;
    }
}

@media (max-width: 760px) {
    .attendance-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 20px;
    }

    .attendance-header .date-navigator {
        width: 100%;
    }

    .class-summary {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 18px 0;
    }

    .attendance-summary {
        width: 100%;
        margin-left: 0;
    }

    .attendance-summary__item {
        width: 100%;
    }

    .attendance-grid {
        grid-template-columns: 1fr;
    }

    .attendance-action {
        right: 0;
        bottom: 0;
        left: 0;
        justify-content: flex-end;
        padding: 10px 16px;
        height: auto;
        box-shadow: 0 -3px 12px rgba(43, 47, 58, 0.1);
    }

    .attendance-action__divider {
        display: none;
    }
}

@media (max-width: 480px) {
    .student-card__identity {
        overflow: hidden;
    }

    .student-card__present {
        flex-basis: 68px;
        width: 68px;
        margin-left: 8px;
        font-size: 12px;
    }

    .attendance-action {
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
    }

    .attendance-action__count {
        margin: 0;
        text-align: center;
    }

    .attendance-action__button {
        width: 100%;
    }

    .attendance-modal__dialog {
        padding: 28px 20px 20px;
    }

    .attendance-modal__dialog h2 {
        font-size: 24px;
    }

    .attendance-modal__dialog p {
        font-size: 17px;
    }

    .attendance-modal__button {
        height: 56px;
        font-size: 20px;
    }
}
