/* ================================================================
   ROOT VARIABLES
================================================================ */

:root {
    --primary: #2563eb;
    --ink: #172033;
    --muted: #6b7280;
    --line: #e5e7eb;
    --bg: #f5f7fb;
    --white: #fff;
}


/* ================================================================
   GLOBAL STYLES
================================================================ */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family:
        Inter,
        system-ui,
        -apple-system,
        "Segoe UI",
        sans-serif;
}


/* ================================================================
   ADMIN SHELL
================================================================ */

.admin-shell {
    min-height: 100vh;
    display: flex;
}


/* ================================================================
   SIDEBAR
================================================================ */

.sidebar {
    width: 250px;
    background: #fff;
    border-right: 1px solid var(--line);
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
}


/* ================================================================
   BRAND
================================================================ */

.brand-block {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #eaf1ff;
    color: var(--primary);
    display: grid;
    place-items: center;
    font-weight: 800;
}

.brand-block strong {
    display: block;
    font-size: 15px;
}

.brand-block small {
    color: var(--muted);
}


/* ================================================================
   NAVIGATION
================================================================ */

.nav-link {
    color: #596273;
    border-radius: 10px;
    padding: 11px 13px;
    margin: 3px 0;
    font-weight: 600;
}

.nav-link i {
    width: 24px;
    margin-right: 8px;
}

.nav-link:hover,
.nav-link.active {
    background: #eef4ff;
    color: var(--primary);
}


/* ================================================================
   SIDEBAR BOTTOM
================================================================ */

.sidebar-bottom {
    margin-top: auto;
}


/* ================================================================
   MAIN AREA
================================================================ */

.main-area {
    margin-left: 250px;
    width: calc(100% - 250px);
    min-width: 0;
}


/* ================================================================
   TOPBAR
================================================================ */

.topbar {
    height: 76px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 15px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.school-title {
    font-weight: 700;
    font-size: 16px;
}

.topbar small {
    color: var(--muted);
}

.admin-badge {
    font-size: 14px;
    color: #4b5563;
}


/* ================================================================
   CONTENT AREA
================================================================ */

.content-area {
    padding: 28px;
    max-width: 1500px;
    margin: auto;
}


/* ================================================================
   PAGE HEADING
================================================================ */

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 22px;
}

.page-heading h1 {
    font-size: 24px;
    margin: 0;
    font-weight: 750;
}

.page-heading p {
    margin: 4px 0 0;
    color: var(--muted);
}


/* ================================================================
   CARDS / PANELS
================================================================ */

.stat-card,
.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow:
        0 3px 14px rgba(15, 23, 42, 0.035);
}

.stat-card {
    padding: 20px;
}


/* ================================================================
   STATISTICS
================================================================ */

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #eef4ff;
    color: var(--primary);
    display: grid;
    place-items: center;
    font-size: 20px;
}

.stat-number {
    font-size: 27px;
    font-weight: 800;
    margin-top: 12px;
}


/* ================================================================
   TEXT UTILITIES
================================================================ */

.muted {
    color: var(--muted);
}


/* ================================================================
   PANEL
================================================================ */

.panel {
    padding: 22px;
}


/* ================================================================
   TABLE
================================================================ */

.table > :not(caption) > * > * {
    padding: 13px 12px;
    vertical-align: middle;
}


/* ================================================================
   LOGIN PAGE
================================================================ */

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        linear-gradient(
            135deg,
            #f7f9fc,
            #edf4ff
        );
}

.login-card {
    width: min(440px, 92vw);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow:
        0 18px 55px rgba(15, 23, 42, 0.09);
    padding: 32px;
}

.login-logo {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: #eaf1ff;
    color: var(--primary);
    display: grid;
    place-items: center;
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 18px;
}


/* ================================================================
   FORM CONTROLS
================================================================ */

.form-control,
.form-select {
    min-height: 46px;
    border-color: #d7dce5;
    border-radius: 10px;
}

.form-control:focus,
.form-select:focus {
    border-color: #93b4ff;
    box-shadow:
        0 0 0 0.2rem rgba(37, 99, 235, 0.1);
}


/* ================================================================
   PRIMARY BUTTON
================================================================ */

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}


/* ================================================================
   IMAGE PREVIEW
================================================================ */

.preview-img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #f8fafc;
}


/* ================================================================
   EMPTY STATE
================================================================ */

.empty-state {
    text-align: center;
    padding: 45px;
    color: var(--muted);
}


/* ================================================================
   BADGES
================================================================ */

.badge-soft {
    background: #eef4ff;
    color: var(--primary);
}


/* ================================================================
   NEWS
================================================================ */

.news-text {
    max-width: 480px;
    white-space: normal;
}


/* ================================================================
   MOBILE OVERLAY
================================================================ */

.mobile-overlay {
    display: none;
}


/* ================================================================
   PRINCIPAL PHOTO
================================================================ */

.principal-photo-panel {
    display: flex;
    align-items: center;
    justify-content: center;
}

.principal-photo-frame {
    width: min(100%, 260px);
    aspect-ratio: 1 / 1;
    border-radius: 20px;
    overflow: hidden;
    background: #f8fafc;
    border: 1px solid var(--line);
    box-shadow:
        0 8px 24px rgba(15, 23, 42, 0.06);
}

.principal-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.principal-photo-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: #9ca3af;
    font-size: 72px;
}


/* ================================================================
   DASHBOARD PRINCIPAL PHOTO
================================================================ */

.dashboard-principal-photo,
.dashboard-principal-placeholder {
    width: 58px;
    height: 58px;
    border-radius: 14px;
    object-fit: cover;
    flex: 0 0 58px;
    border: 1px solid var(--line);
    background: #f8fafc;
}

.dashboard-principal-placeholder {
    display: grid;
    place-items: center;
    color: #9ca3af;
    font-size: 25px;
}

.principal-dashboard-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
}


/* ================================================================
   DOCUMENT TABLE
================================================================ */

.document-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.document-table {
    width: 100%;
    min-width: 900px;
}


/* ================================================================
   DOCUMENT TABLE COLUMNS
================================================================ */

.document-title-column {
    min-width: 240px;
}

.document-title {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.45;
}

.document-category-column {
    min-width: 150px;
}

.document-order-column {
    width: 80px;
    min-width: 80px;
    text-align: center;
}

.document-file-column {
    min-width: 120px;
}

.document-status-column {
    min-width: 100px;
}

.document-date-column {
    min-width: 110px;
}

.document-action-column {
    min-width: 180px;
}

.document-action-column .btn {
    white-space: nowrap;
}


/* ================================================================
   TABLET
================================================================ */

@media (max-width: 991.98px) {

    .document-table {
        min-width: 800px;
    }

    .document-table th,
    .document-table td {
        padding: 10px;
        font-size: 14px;
    }

    .document-title-column {
        min-width: 220px;
    }

    .document-category-column {
        min-width: 130px;
    }

    .document-action-column {
        min-width: 170px;
    }
}


/* ================================================================
   MOBILE
================================================================ */

@media (max-width: 575.98px) {

    /* Remove horizontal scrolling */
    .document-table-wrapper {
        overflow-x: visible;
    }

    /* Convert table to mobile layout */
    .document-table {
        width: 100%;
        min-width: 0;
        border-collapse: separate;
        border-spacing: 0;
    }

    /* Hide table heading */
    .document-table thead {
        display: none;
    }

    .document-table tbody {
        display: block;
        width: 100%;
    }

    /* Each document becomes a card */
    .document-table tbody tr {
        display: block;
        width: 100%;

        margin-bottom: 15px;
        padding: 15px;

        background: #ffffff;

        border: 1px solid var(--line);
        border-radius: 14px;

        box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
    }

    /* Each table cell becomes a row */
    .document-table tbody td {
        display: flex;
        align-items: center;

        width: 100%;
        min-width: 0;

        padding: 8px 0;

        border: 0;

        font-size: 14px;
        line-height: 1.4;

        overflow-wrap: anywhere;
        word-break: break-word;
    }

    /* Document title */
    .document-table tbody td.document-title-column {
        display: block;

        padding: 0 0 12px;
        margin-bottom: 5px;

        border-bottom: 1px solid var(--line);
    }

    .document-title {
        font-size: 15px;
        font-weight: 700;
        color: var(--ink);
        line-height: 1.45;
    }

    /* Labels */
    .document-table tbody td::before {
        flex: 0 0 80px;

        margin-right: 8px;

        color: var(--muted);

        font-size: 12px;
        font-weight: 600;
    }

    /* Category */
    .document-table tbody td.document-category-column::before {
        content: "Category";
    }

    /* Display order */
    .document-table tbody td.document-order-column {
        width: 100%;
        min-width: 0;
        text-align: left;
        justify-content: flex-start;
    }

    .document-table tbody td.document-order-column::before {
        content: "Order";
    }

    /* File */
    .document-table tbody td.document-file-column::before {
        content: "File";
    }

    /* Status */
    .document-table tbody td.document-status-column::before {
        content: "Status";
    }

    /* Uploaded date */
    .document-table tbody td.document-date-column::before {
        content: "Uploaded";
    }

    /* File link */
    .document-table tbody td.document-file-column a {
        white-space: nowrap;
    }

    /* Actions */
    .document-table tbody td.document-action-column {
        display: block;

        margin-top: 6px;
        padding-top: 12px;

        border-top: 1px solid var(--line);

        text-align: left;
    }

    .document-table tbody td.document-action-column::before {
        display: block;

        margin-bottom: 8px;

        content: "Actions";
    }

    /* Action buttons */
    .document-table tbody td.document-action-column > div {
        display: flex !important;

        flex-wrap: wrap;

        align-items: center;
        justify-content: flex-start !important;

        gap: 8px;

        width: 100%;
    }

    .document-table tbody td.document-action-column .btn {
        white-space: nowrap;
    }
}


/* ================================================================
   SMALL PHONES
================================================================ */

@media (max-width: 380px) {

    .document-table tbody tr {
        padding: 12px;
        border-radius: 12px;
    }

    .document-table tbody td {
        font-size: 13px;
    }

    .document-title {
        font-size: 14px;
    }

    .document-table tbody td::before {
        flex: 0 0 70px;
        font-size: 11px;
    }

    .document-table tbody td.document-action-column .btn {
        font-size: 13px;
        padding: 6px 9px;
    }
}