/* =========================================================
   ZENGEZA 8 PRIMARY SCHOOL — PORTAL STYLESHEET
   Shared styles for authentication, dashboard and classes
========================================================= */

:root {
    --z8-green: #126447;
    --z8-dark: #10372b;
    --z8-red: #c83737;
    --z8-bg: #f4f7f5;
    --z8-text: #192d25;
    --z8-muted: #68766f;
    --z8-border: #dfe8e2;
    --z8-white: #ffffff;
    --z8-success-bg: #eef8f1;
    --z8-success-text: #205d39;
    --z8-error-bg: #fff0f0;
    --z8-error-text: #982727;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--z8-text);
    background: var(--z8-bg);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
    line-height: 1.6;
}

a {
    color: var(--z8-green);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

img {
    max-width: 100%;
    height: auto;
}

h1,
h2,
h3,
h4 {
    color: var(--z8-text);
    line-height: 1.3;
}

h1 {
    margin: 12px 0;
    font-size: clamp(32px, 5vw, 48px);
    line-height: 1.15;
    letter-spacing: -1.2px;
}

h2 {
    line-height: 1.3;
}

p {
    overflow-wrap: anywhere;
}

:focus-visible {
    outline: 3px solid #83bfa0;
    outline-offset: 3px;
}

/* =========================================================
   BRAND
========================================================= */

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--z8-text);
    font-weight: 700;
    text-decoration: none;
}

.brand:hover {
    text-decoration: none;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 15px;
    line-height: 1.4;
}

.brand small {
    color: var(--z8-muted);
    font-size: 12px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 12px;
    background: var(--z8-green);
    color: var(--z8-white);
    font-size: 18px;
    font-weight: 800;
}

/* =========================================================
   HEADER AND NAVIGATION
   Supports both existing portal-header and site-header HTML
========================================================= */

.portal-header,
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 17px 6%;
    background: var(--z8-white);
    border-bottom: 1px solid var(--z8-border);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    width: 100%;
}

.site-header nav,
.portal-header nav {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.site-header nav a,
.portal-header nav a {
    font-size: 14px;
    font-weight: 700;
}

.back-link {
    font-size: 14px;
    font-weight: 700;
}

/* =========================================================
   PAGE CONTAINERS
========================================================= */

.portal-main,
.classes-page {
    width: min(1120px, 88%);
    min-height: 72vh;
    margin: 0 auto;
    padding: 55px 0 75px;
}

.classes-page {
    padding-top: 38px;
    padding-bottom: 60px;
}

.eyebrow {
    color: var(--z8-green);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1.8px;
    text-transform: uppercase;
}

.muted {
    color: var(--z8-muted);
    font-size: 14px;
}

.help-text {
    margin: 20px 0 0;
    color: var(--z8-muted);
    font-size: 13px;
}

/* =========================================================
   AUTHENTICATION
========================================================= */

.auth-main {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 65px;
}

.login-card {
    width: 100%;
    padding: 30px;
    border: 1px solid var(--z8-border);
    border-radius: 18px;
    background: var(--z8-white);
    box-shadow: 0 12px 36px rgba(16, 55, 43, 0.06);
}

.auth-card {
    max-width: 480px;
}

.login-card h1 {
    font-size: 34px;
}

.login-card form,
.admin-form {
    display: grid;
    gap: 10px;
    margin-top: 22px;
}

label {
    display: block;
    margin-top: 7px;
    font-size: 13px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 47px;
    padding: 11px 13px;
    border: 1px solid #d5e0d9;
    border-radius: 9px;
    background: var(--z8-white);
    color: var(--z8-text);
}

textarea {
    min-height: 110px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #a9d4bd;
    outline-offset: 1px;
    border-color: var(--z8-green);
}

button,
.button {
    min-height: 43px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: var(--z8-green);
    color: var(--z8-white);
    font-weight: 700;
    text-align: center;
    text-decoration: none;
}

button:hover,
.button:hover {
    background: var(--z8-dark);
    color: var(--z8-white);
    text-decoration: none;
}

.login-card button,
.admin-form button {
    margin-top: 12px;
}

.secondary-button {
    min-height: 40px;
    padding: 8px 15px;
    background: #edf3ef;
    color: var(--z8-dark);
}

.secondary-button:hover {
    background: #dce9e0;
    color: var(--z8-dark);
}

.logout-form {
    display: inline-flex;
    align-items: center;
    gap: 0;
    margin: 0;
}

.logout-form button {
    margin: 0;
}

/* =========================================================
   NOTICES AND FEEDBACK
========================================================= */

.notice,
.success-notice {
    margin: 17px 0;
    padding: 13px 15px;
    border-radius: 9px;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.notice {
    border: 1px solid #efd4a5;
    background: #fff8e9;
    color: #75501a;
}

.success-notice {
    border: 1px solid #b8ddc5;
    background: var(--z8-success-bg);
    color: var(--z8-success-text);
}

.classes-page .notice {
    margin: 17px 0;
    padding: 14px 16px;
    border-radius: 9px;
}

.classes-page .notice-success {
    border: 1px solid #bfe4cc;
    background: #e8f6ed;
    color: #17663a;
}

.classes-page .notice-error {
    border: 1px solid #f0caca;
    background: var(--z8-error-bg);
    color: var(--z8-error-text);
}

/* =========================================================
   DASHBOARD
========================================================= */

.dashboard-welcome {
    margin-bottom: 28px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.dashboard-tile {
    min-width: 0;
    padding: 23px;
    border: 1px solid var(--z8-border);
    border-radius: 15px;
    background: var(--z8-white);
}

.dashboard-tile h2 {
    margin: 0 0 8px;
    font-size: 19px;
}

.dashboard-tile p {
    color: var(--z8-muted);
    font-size: 14px;
}

.portal-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin-bottom: 14px;
    border-radius: 13px;
    background: #eaf4ee;
    font-size: 24px;
}

.status-label {
    display: inline-block;
    margin-top: 5px;
    color: var(--z8-muted);
    font-size: 12px;
    font-weight: 700;
}

/* =========================================================
   ADMINISTRATION SECTIONS
========================================================= */

.admin-section {
    margin-top: 28px;
    padding: 27px;
    border: 1px solid var(--z8-border);
    border-radius: 15px;
    background: var(--z8-white);
}

.admin-section h2 {
    margin-top: 0;
}

.admin-form {
    max-width: 650px;
}

/* =========================================================
   GENERAL TABLES
========================================================= */

.table-wrap,
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    margin-top: 15px;
    border-collapse: collapse;
    font-size: 14px;
}

th,
td {
    padding: 12px;
    border-bottom: 1px solid var(--z8-border);
    text-align: left;
    vertical-align: middle;
}

th {
    background: #f5f8f6;
    font-size: 12px;
    font-weight: 700;
}

th,
td {
    overflow-wrap: anywhere;
}

.data-table td {
    white-space: nowrap;
}

/* =========================================================
   CLASS MANAGEMENT PAGE
========================================================= */

.classes-page .page-heading {
    margin-bottom: 28px;
}

.classes-page .page-heading h1 {
    margin: 8px 0 12px;
}

.classes-page .page-heading p {
    max-width: 760px;
}

.classes-page .eyebrow {
    color: var(--z8-green);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1.8px;
    text-transform: uppercase;
}

.classes-page .panel {
    min-width: 0;
    margin: 28px 0;
    padding: 27px;
    border: 1px solid var(--z8-border);
    border-radius: 15px;
    background: var(--z8-white);
    box-shadow: 0 5px 20px rgba(16, 55, 43, 0.04);
}

.classes-page .panel h2 {
    margin-top: 0;
    margin-bottom: 8px;
}

.classes-page .muted {
    color: var(--z8-muted);
    font-size: 14px;
}

.classes-page .class-form {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(140px, 1fr) auto;
    align-items: end;
    gap: 18px;
    margin-top: 24px;
}

.classes-page .form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.classes-page .form-field label {
    display: block;
    margin-top: 7px;
    color: var(--z8-text);
    font-size: 13px;
    font-weight: 700;
}

.classes-page .form-field input,
.classes-page .form-field select {
    width: 100%;
    min-width: 0;
    min-height: 47px;
    padding: 11px 13px;
    border: 1px solid #d5e0d9;
    border-radius: 9px;
    background: var(--z8-white);
    color: var(--z8-text);
    font: inherit;
}

.classes-page .form-field input:focus,
.classes-page .form-field select:focus {
    outline: 2px solid #a9d4bd;
    border-color: var(--z8-green);
}

.classes-page .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 43px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 9px;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.classes-page .button-primary {
    background: var(--z8-green);
    color: var(--z8-white);
}

.classes-page .button-primary:hover {
    background: var(--z8-dark);
    color: var(--z8-white);
}

.classes-page .button-secondary {
    background: #edf3ef;
    border-color: #d6e0da;
    color: var(--z8-dark);
}

.classes-page .button-secondary:hover {
    background: #dce9e0;
    color: var(--z8-dark);
}

.classes-page .button-danger {
    background: #fff0f0;
    border-color: #f1caca;
    color: #a52a2a;
}

.classes-page .button-danger:hover {
    background: #fce0e0;
    color: #8b2020;
}

.classes-page .button-small {
    min-height: 36px;
    padding: 7px 11px;
    font-size: 13px;
}

.classes-page .section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.classes-page .section-heading h2 {
    margin-bottom: 6px;
}

.classes-page .section-heading p {
    margin-bottom: 0;
}

.classes-page .data-table {
    width: 100%;
    margin-top: 15px;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

.classes-page .data-table th,
.classes-page .data-table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--z8-border);
    text-align: left;
    vertical-align: middle;
}

.classes-page .data-table th {
    background: #f5f8f6;
    color: var(--z8-text);
    font-size: 12px;
    font-weight: 700;
}

.classes-page .data-table tbody tr:hover {
    background: #fbfdfb;
}

.classes-page .status {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.classes-page .status-active {
    background: #e3f5e9;
    color: #17663a;
}

.classes-page .status-inactive {
    background: #f0f1f1;
    color: #626b66;
}

.classes-page .inline-form {
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.classes-page .inline-form button {
    margin: 0;
}

.classes-page .empty-state {
    padding: 35px 15px;
    border-radius: 10px;
    background: var(--z8-bg);
    text-align: center;
}

.classes-page .empty-state h3 {
    margin-top: 0;
}

.classes-page .empty-state p {
    margin-bottom: 0;
    color: var(--z8-muted);
}

.classes-page .back-link {
    margin-top: 22px;
    font-size: 14px;
    font-weight: 700;
}

.classes-page .back-link a {
    color: var(--z8-green);
}

/* =========================================================
   FOOTER
   Supports both portal-footer and site-footer HTML
========================================================= */

.portal-footer,
.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 23px 6%;
    border-top: 1px solid var(--z8-border);
    background: var(--z8-white);
    color: var(--z8-muted);
    font-size: 13px;
}

.portal-footer p,
.site-footer p {
    margin: 0;
}

/* =========================================================
   RESPONSIVE LAYOUT
========================================================= */

@media (max-width: 800px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .portal-main,
    .classes-page {
        width: 90%;
        padding-top: 35px;
    }

    .portal-header,
    .site-header {
        padding: 14px 5%;
    }

    .admin-section,
    .classes-page .panel {
        padding: 20px;
    }

    .site-header .container {
        align-items: flex-start;
        flex-direction: column;
    }

    .site-header nav,
    .portal-header nav {
        gap: 12px;
    }

    .classes-page .class-form {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .classes-page .class-form .button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .brand strong {
        max-width: 200px;
        font-size: 13px;
    }

    .back-link {
        font-size: 12px;
    }

    .login-card {
        padding: 22px;
    }

    .portal-footer,
    .site-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .classes-page .panel {
        padding: 18px;
    }

    .classes-page .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .classes-page .data-table th,
    .classes-page .data-table td {
        padding: 11px 9px;
        white-space: nowrap;
    }
}

/* =========================================================
   REDUCED MOTION ACCESSIBILITY
========================================================= */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
