/**
 * Header & footer - adminmaster.master (student-facing portal).
 * Brand palette: deep blue + vibrant green (Online Exam System logo).
 * Scoped with .admin-header-shell and .portal-footer.
 */

/* -- Global responsive shell (Clientstyle.css uses fixed #page / #page-bgtop widths) -- */
html {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body.admin-portal {
    margin: 0;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

body.admin-portal #page {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box;
}

body.admin-portal #page-bgtop {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    margin-left: auto !important;
    margin-right: auto !important;
    /* One gutter value for both sides (separate L/R max() can differ when safe-area insets differ). */
    --admin-shell-page-inline: max(
        clamp(10px, 3vw, 36px),
        env(safe-area-inset-left, 0px),
        env(safe-area-inset-right, 0px)
    );
    padding-left: var(--admin-shell-page-inline);
    padding-right: var(--admin-shell-page-inline);
    padding-top: clamp(8px, 2.5vw, 28px);
    padding-bottom: max(clamp(10px, 3vw, 36px), env(safe-area-inset-bottom, 0px));
    box-sizing: border-box !important;
}

body.admin-portal .middle {
    min-height: unset;
}

body.admin-portal #form1 {
    max-width: 100%;
    box-sizing: border-box;
}

/* Footer sits outside #page (full viewport band, not inside white card) */
body.admin-portal form > footer.portal-footer,
body.admin-portal form > #footer.portal-footer,
body.admin-portal footer.portal-footer.portal-footer--site {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    text-align: center;
    box-sizing: border-box;
}

body.admin-portal footer.portal-footer .portal-footer__inner,
body.admin-portal footer.portal-footer .portal-footer__bottom,
body.admin-portal footer.portal-footer .portal-footer__bottom--solo,
body.admin-portal #footer.portal-footer .portal-footer__inner,
body.admin-portal #footer.portal-footer .portal-footer__bottom,
body.admin-portal #footer.portal-footer .portal-footer__bottom--solo {
    text-align: center !important;
}

/* Clientstyle.css sets p { text-align: justify } — reset inside footer */
body.admin-portal footer.portal-footer p,
body.admin-portal #footer.portal-footer p {
    text-align: center !important;
    line-height: 1.55 !important;
}

#header-wrapper.admin-header-shell {
    --brand-blue-deep: #06365c;
    --brand-blue-mid: #08528a;
    --brand-blue-bright: #0b6cb3;
    --brand-green: #2bc46a;
    --brand-green-light: #53e08c;
    --brand-green-dark: #1fa854;
    width: 100%;
    min-height: unset;
    padding: 0;
    padding-top: env(safe-area-inset-top, 0px);
    margin: 0;
    /* Light header; logo is normal compositing - no blend modes (those washed the raster to white) */
    background: linear-gradient(
        180deg,
        #ffffff 0%,
        #f4f9fd 40%,
        #e8f2fa 100%
    ) !important;
    border-bottom: 1px solid rgba(11, 108, 179, 0.14);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.95) inset,
        0 4px 18px rgba(6, 54, 92, 0.1);
    text-align: left;
}

#header.admin-header-inner.admin-header-shell__inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 0.65rem;
    padding-right: max(clamp(1rem, 4vw, 1.75rem), env(safe-area-inset-right, 0px));
    padding-bottom: 0.65rem;
    padding-left: max(clamp(1rem, 4vw, 1.75rem), env(safe-area-inset-left, 0px));
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.25rem;
    line-height: normal !important; /* Clientstyle sets #header.admin-header-inner { line-height:0 } - kills logo height */
}

.admin-header-shell__brand {
    display: flex;
    align-items: center;
    gap: 1rem 1.25rem;
    flex: 1 1 auto;
    min-width: 0;
}

/* Amity header logo (wide PNG ~1651×606) */
.admin-header-shell__logo-well {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 4.85rem;
    max-width: min(26rem, 94vw);
    padding: 0.4rem 0.9rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(11, 108, 179, 0.16);
    box-shadow: 0 2px 10px rgba(6, 54, 92, 0.08);
}

.admin-header-shell__logo,
#header-wrapper.admin-header-shell img.admin-header-shell__logo {
    display: block !important;
    flex-shrink: 0;
    width: auto !important;
    height: clamp(4.15rem, 7.2vh, 5.85rem) !important;
    max-height: 5.85rem !important;
    min-height: 0 !important;
    min-width: 0 !important;
    max-width: min(24rem, 90vw) !important;
    object-fit: contain;
    object-position: center center;
    vertical-align: middle;
    opacity: 1;
    visibility: visible;
    mix-blend-mode: normal;
    filter: none;
}

.admin-header-shell__titles {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    min-width: 0;
}

.admin-header-shell__eyebrow {
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--brand-green-dark);
}

.admin-header-shell__title {
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: clamp(0.92rem, 2.05vw + 0.55rem, 1.14rem);
    font-weight: 700;
    color: var(--brand-blue-deep);
    line-height: 1.25;
    letter-spacing: 0.01em;
    text-shadow: none;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.admin-header-shell__tag {
    flex: 0 0 auto;
    font-family: "Segoe UI", system-ui, sans-serif;
    display: inline-flex;
    align-items: stretch;
    padding: 2px;
    border-radius: 999px;
    white-space: nowrap;
    vertical-align: middle;
    background: linear-gradient(
        125deg,
        var(--brand-blue-bright) 0%,
        #1293e8 22%,
        var(--brand-green) 48%,
        var(--brand-green-light) 72%,
        var(--brand-blue-bright) 100%
    );
    background-size: 180% 100%;
    animation: admin-header-shell-tag-shift 10s ease-in-out infinite alternate;
    box-shadow:
        0 2px 10px rgba(11, 108, 179, 0.32),
        0 4px 24px rgba(43, 196, 106, 0.28),
        0 0 0 1px rgba(255, 255, 255, 0.45) inset;
    transition:
        transform 0.2s ease,
        filter 0.2s ease,
        box-shadow 0.22s ease;
}

.admin-header-shell__tag:hover {
    transform: translateY(-1px);
    filter: saturate(1.12) brightness(1.02);
    box-shadow:
        0 4px 16px rgba(11, 108, 179, 0.4),
        0 8px 32px rgba(43, 196, 106, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.55) inset;
}

@keyframes admin-header-shell-tag-shift {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 100% 50%;
    }
}

.admin-header-shell__tag-inner {
    display: inline-flex;
    align-items: center;
    gap: 0.48rem;
    flex-wrap: wrap;
    justify-content: center;
    padding: 0.4rem clamp(0.68rem, 2.2vw, 1rem) 0.42rem;
    border-radius: inherit;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.98) 0%,
        #f4fcff 42%,
        #ecfdf5 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.75);
    box-shadow:
        inset 0 2px 6px rgba(255, 255, 255, 0.9),
        inset 0 -1px 8px rgba(11, 108, 179, 0.06);
}

.admin-header-shell__tag-strong {
    font-size: 0.695rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--brand-blue-deep);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
}

.admin-header-shell__tag-sep {
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-blue-bright), var(--brand-green));
    box-shadow: 0 0 0 2px rgba(43, 196, 106, 0.25), 0 0 12px rgba(11, 108, 179, 0.35);
    flex-shrink: 0;
}

.admin-header-shell__tag-accent {
    font-size: 0.695rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--brand-green-dark);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

@media (prefers-reduced-motion: reduce) {
    .admin-header-shell__tag {
        animation: none;
        background-size: 100% 100%;
        transition: none;
    }

    .admin-header-shell__tag:hover {
        transform: none;
        filter: none;
    }
}

.admin-header-shell__accent {
    height: 4px;
    width: 100%;
    margin: 0;
    padding: 0;
    background: linear-gradient(
        90deg,
        var(--brand-blue-bright) 0%,
        var(--brand-green) 28%,
        var(--brand-green-light) 52%,
        var(--brand-green) 75%,
        var(--brand-blue-bright) 100%
    );
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.65) inset;
}

/* -- Footer (use footer.portal-footer — #footer breaks when runat=server without ClientIDMode=Static) -- */
footer.portal-footer,
#footer.portal-footer {
    --brand-blue-deep: #06365c;
    --brand-green: #2bc46a;
    --brand-green-light: #6ee7b3;
    width: 100%;
    height: auto !important;
    min-height: unset !important;
    margin: 0;
    margin-top: auto;
    padding: 0 !important;
    border-top: none !important;
    background: linear-gradient(165deg, #052438 0%, #031a2e 42%, #021018 100%) !important;
    box-shadow:
        0 -1px 0 rgba(255, 255, 255, 0.06) inset,
        0 -12px 32px rgba(3, 28, 50, 0.35);
}

footer.portal-footer.portal-footer--site,
#footer.portal-footer.portal-footer--site {
    position: relative;
    overflow: hidden;
}

footer.portal-footer.portal-footer--site::after,
#footer.portal-footer.portal-footer--site::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -40%;
    width: min(120%, 720px);
    height: 140px;
    transform: translateX(-50%);
    background: radial-gradient(ellipse at center, rgba(43, 196, 106, 0.14) 0%, transparent 70%);
    pointer-events: none;
}

footer.portal-footer::before,
#footer.portal-footer::before {
    content: "";
    display: block;
    height: 3px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(11, 108, 179, 0.9),
        var(--brand-green),
        rgba(83, 224, 140, 0.95),
        var(--brand-green),
        rgba(11, 108, 179, 0.9),
        transparent
    );
}

.portal-footer__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.15rem clamp(1rem, 4vw, 1.75rem) 1.35rem;
    position: relative;
    z-index: 1;
}

.portal-footer__inner--compact {
    padding: 0.95rem clamp(1rem, 4vw, 1.75rem) 1.05rem;
}

.portal-footer__main {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: clamp(1rem, 3vw, 2rem);
    align-items: start;
    text-align: left;
}

.portal-footer__brand-block {
    display: flex;
    align-items: flex-start;
    min-width: 0;
}

.portal-footer__brand-text {
    min-width: 0;
}

.portal-footer__brand {
    font-family: "Segoe UI", system-ui, sans-serif;
    font-size: clamp(0.82rem, 1.5vw, 0.97rem);
    font-weight: 700;
    color: #ecfdf5;
    letter-spacing: 0.02em;
    line-height: 1.35;
    margin: 0;
}

.portal-footer__tagline {
    margin: 0.28rem 0 0;
    font-family: "Segoe UI", system-ui, sans-serif;
    font-size: clamp(0.68rem, 1.2vw, 0.78rem);
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(110, 231, 179, 0.92);
    line-height: 1.4;
}

.portal-footer__info {
    min-width: 0;
}

.portal-footer__features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.portal-footer__feature {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    font-family: "Segoe UI", system-ui, sans-serif;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.45;
    color: rgba(226, 232, 240, 0.95);
}

.portal-footer__feature-icon {
    flex-shrink: 0;
    width: 1.35rem;
    height: 1.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(43, 196, 106, 0.18);
    border: 1px solid rgba(110, 231, 179, 0.35);
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    color: rgba(110, 231, 179, 0.95);
}

.portal-footer__feature--secure .portal-footer__feature-icon::before {
    content: "\1F512";
    font-size: 0.62rem;
}

.portal-footer__feature--schedule .portal-footer__feature-icon::before {
    content: "\2022";
    font-size: 1rem;
    line-height: 0;
}

.portal-footer__feature--results .portal-footer__feature-icon::before {
    content: "\2713";
    font-size: 0.68rem;
}

.portal-footer__main:not(:has(.portal-footer__info)) {
    grid-template-columns: 1fr;
    justify-items: center;
}

.portal-footer__main:not(:has(.portal-footer__info)) .portal-footer__brand-block {
    justify-content: center;
    text-align: center;
}

.portal-footer__feature-text {
    flex: 1;
    min-width: 0;
}

.portal-footer__bottom {
    margin-top: clamp(0.85rem, 2.5vw, 1.15rem);
    padding-top: clamp(0.75rem, 2vw, 0.95rem);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    text-align: center;
}

.portal-footer__bottom--solo {
    margin-top: 0;
    padding-top: 0.15rem;
    border-top: none;
}

.portal-footer__institute {
    margin: 0 0 0.4rem;
    font-family: "Segoe UI", system-ui, sans-serif;
    font-size: clamp(0.7rem, 1.4vw, 0.78rem);
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    line-height: 1.35;
    color: rgba(167, 243, 208, 0.95);
}

#footer.portal-footer .portal-footer__brand a {
    color: inherit;
    font-weight: inherit;
    text-decoration: none;
    border-bottom: none;
    transition: color 0.15s;
}

#footer.portal-footer .portal-footer__brand a:hover {
    color: #ffffff;
}

footer.portal-footer p.portal-footer__copy,
footer.portal-footer p.portal-footer__institute,
footer.portal-footer p,
#footer.portal-footer p.portal-footer__copy,
#footer.portal-footer p.portal-footer__institute,
#footer.portal-footer p {
    margin: 0;
    padding: 0 !important;
    line-height: 1.55;
    font-family: "Segoe UI", system-ui, sans-serif;
    font-size: clamp(0.75rem, 1.5vw, 0.84rem);
    font-weight: 500;
    color: rgba(226, 232, 240, 0.92);
    text-align: center !important;
}

#footer.portal-footer p.portal-footer__copy {
    max-width: 42rem;
    margin-left: auto;
    margin-right: auto;
}

#footer.portal-footer a {
    color: var(--brand-green-light);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid rgba(110, 231, 179, 0.4);
    transition: color 0.15s, border-color 0.15s;
}

#footer.portal-footer a:hover {
    color: #fff;
    border-bottom-color: rgba(255, 255, 255, 0.55);
}

.portal-footer__meta {
    font-size: 0.75rem;
    color: rgba(148, 189, 200, 0.92);
    font-family: "Segoe UI", system-ui, sans-serif;
    margin: 0.65rem 0 0;
    line-height: 1.5;
    text-align: center;
}

.portal-footer__meta--solo {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 0.15rem 0 0 !important;
    text-align: center !important;
}

@media (max-width: 640px) {
    #header.admin-header-inner.admin-header-shell__inner {
        padding-inline: max(0.75rem, env(safe-area-inset-left, 0))
            max(0.75rem, env(safe-area-inset-right, 0));
    }

    .admin-header-shell__logo-well {
        min-height: 4rem;
        max-width: min(22rem, 96vw);
        padding: 0.35rem 0.65rem;
    }

    .admin-header-shell__logo,
    #header-wrapper.admin-header-shell img.admin-header-shell__logo {
        height: clamp(3.5rem, 13vw, 4.75rem) !important;
        max-height: 4.75rem !important;
        max-width: min(20rem, 94vw) !important;
    }

    .admin-header-shell__eyebrow {
        font-size: 0.56rem;
        letter-spacing: 0.11em;
    }

    #footer.portal-footer .portal-footer__inner {
        padding-inline: max(1rem, env(safe-area-inset-left, 0))
            max(1rem, env(safe-area-inset-right, 0));
        padding-bottom: max(1.35rem, env(safe-area-inset-bottom, 0));
    }

    #footer.portal-footer .portal-footer__main {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    #footer.portal-footer .portal-footer__brand-block {
        text-align: center;
    }

    #footer.portal-footer .portal-footer__meta {
        text-align: center;
    }

    #footer.portal-footer p {
        overflow-wrap: anywhere;
    }
}

@media (max-width: 520px) {
    #header.admin-header-inner.admin-header-shell__inner {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-header-shell__brand {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .admin-header-shell__titles {
        align-items: center;
    }

    .admin-header-shell__tag {
        width: 100%;
        text-align: center;
        white-space: normal;
        justify-content: center;
    }

    .admin-header-shell__tag-inner {
        width: 100%;
        max-width: min(26rem, 100%);
        margin-inline: auto;
    }
}

@media (max-width: 380px) {
    .admin-header-shell__logo,
    #header-wrapper.admin-header-shell img.admin-header-shell__logo {
        height: clamp(3.15rem, 16vw, 4.15rem) !important;
        max-height: 4.15rem !important;
        max-width: min(18rem, 96vw) !important;
    }
}
