/* =========================================================
   STUDENT PORTAL SHELL
   The portal's header and sidebar, styled to match the main app
   (Components/Layout/AppHeader.razor.css and AppSidebar.razor.css).
   Global rather than scoped so they reach the MudBlazor components;
   every rule sits under .portal-shell, so the staff app is untouched.
   ========================================================= */

/* ---------- Page ---------- */

.portal-shell .portal-drawer {
    background: #0f172a !important;
    border-right: none !important;
}

.portal-shell .portal-main-content {
    background: #f8fafc;
    min-height: 100vh;
}

.portal-shell .portal-page-content {
    min-height: calc(100vh - 72px);
    padding: 24px;
}

@media (max-width: 600px) {
    .portal-shell .portal-page-content {
        padding: 16px;
    }
}


/* ---------- Header ---------- */

.portal-shell .driveflow-header {
    height: 72px !important;
    background: #1e293b !important;
    color: #ffffff !important;
    border-bottom: 1px solid #334155;
    z-index: 1300 !important;
}

.portal-shell .header-menu-button {
    color: #f8fafc !important;
    margin-left: 6px;
    border-radius: 9px;
}

    .portal-shell .header-menu-button:hover {
        background: rgba(255, 255, 255, 0.10) !important;
    }

.portal-shell .header-brand {
    display: flex;
    align-items: center;
    min-width: 0;
    margin-left: 10px;
    color: inherit;
    text-decoration: none;
}

.portal-shell .header-brand-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .portal-shell .header-brand-icon img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

/* A school's logo sits on a white tile so dark logos stay visible. */
.portal-shell .header-brand-icon--logo {
    border-radius: 8px;
    background: #ffffff;
    padding: 3px;
    overflow: hidden;
}

.portal-shell .header-brand-text {
    margin-left: 10px;
    min-width: 0;
}

.portal-shell .header-brand-name {
    color: #ffffff;
    font-size: 17px;
    font-weight: 700;
    line-height: 19px;
    letter-spacing: -0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 42vw;
}

.portal-shell .header-brand-subtitle {
    color: #94a3b8;
    font-size: 9px;
    line-height: 13px;
}

.portal-shell .app-header-icon {
    color: #cbd5e1 !important;
    margin: 0 2px;
    border-radius: 9px;
}

    .portal-shell .app-header-icon:hover {
        background: rgba(255, 255, 255, 0.10) !important;
        color: #ffffff !important;
    }

.portal-shell .header-user-wrap {
    display: flex;
    align-items: center;
}

.portal-shell .header-user-button {
    color: #ffffff !important;
    text-transform: none !important;
}

    .portal-shell .header-user-button .mud-button-end-icon {
        color: #94a3b8;
    }

.portal-shell .header-avatar {
    font-size: 11px !important;
    font-weight: 700;
}

.portal-shell .header-user-details {
    min-width: 90px;
    margin-left: 10px;
    text-align: left;
}

.portal-shell .header-user-name {
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    line-height: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.portal-shell .header-user-role {
    color: #94a3b8;
    font-size: 10px;
    line-height: 14px;
}

@media (max-width: 600px) {

    .portal-shell .driveflow-header {
        height: 64px !important;
    }

    .portal-shell .header-brand-subtitle {
        display: none;
    }

    .portal-shell .header-brand-name {
        font-size: 16px;
    }

    .portal-shell .header-brand-icon {
        width: 34px;
        height: 34px;
        min-width: 34px;
    }

    .portal-shell .header-menu-button {
        margin-left: 2px;
    }
}


/* ---------- Sidebar ---------- */

.portal-shell .driveflow-sidebar {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
    background: #0f172a;
    color: #cbd5e1;
    overflow: hidden;
}

.portal-shell .sidebar-organisation {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    margin: 18px 14px 12px;
    padding: 11px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: inherit;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}

    .portal-shell .sidebar-organisation:hover {
        background: rgba(255, 255, 255, 0.08);
        border-color: rgba(255, 255, 255, 0.10);
    }

.portal-shell .organisation-icon {
    width: 34px;
    height: 34px;
    min-width: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.20);
    color: #60a5fa;
}

.portal-shell .organisation-logo {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    object-fit: contain;
    background: #ffffff;
}

.portal-shell .organisation-initials {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.portal-shell .organisation-details {
    flex: 1;
    min-width: 0;
    margin-left: 10px;
}

.portal-shell .organisation-label {
    color: #64748b;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.9px;
    line-height: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portal-shell .organisation-name {
    margin-top: 2px;
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 600;
    line-height: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portal-shell .organisation-arrow {
    color: #64748b !important;
}

.portal-shell .driveflow-nav-scroll {
    flex: 1 1 auto;
    min-height: 0;
    height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 10px 14px;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.portal-shell .driveflow-nav {
    width: 100%;
    overflow: visible !important;
    padding: 0 !important;
}

.portal-shell .nav-section {
    padding: 17px 13px 7px;
    color: #64748b;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 14px;
}

/* Height, margin and padding are left to MudBlazor, as in the staff sidebar
   (whose own sizing rules are scoped and don't reach MudNavLink), so the
   space between links is the same in both. */
.portal-shell .driveflow-nav .mud-nav-link {
    border-radius: 9px;
    color: #94a3b8 !important;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}

    .portal-shell .driveflow-nav .mud-nav-link:hover {
        background: rgba(255, 255, 255, 0.06);
        color: #f8fafc !important;
    }

        .portal-shell .driveflow-nav .mud-nav-link:hover .mud-nav-link-icon {
            color: #93c5fd !important;
        }

    .portal-shell .driveflow-nav .mud-nav-link .mud-nav-link-icon {
        color: #64748b !important;
        margin-right: 13px;
        font-size: 20px;
    }

    /* The current page: only the text and icon change colour, like the staff
       sidebar (MudBlazor's primary colour), with no highlighted block. */
    .portal-shell .driveflow-nav .mud-nav-link.active {
        background: transparent !important;
        box-shadow: none !important;
        color: var(--mud-palette-primary) !important;
        font-weight: 600;
    }

        .portal-shell .driveflow-nav .mud-nav-link.active .mud-nav-link-icon {
            color: var(--mud-palette-primary) !important;
        }

.portal-shell .sidebar-footer {
    flex: 0 0 auto;
    padding: 12px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    background: #0f172a;
}

.portal-shell .school-contact {
    padding: 10px;
    border-radius: 10px;
    background: rgba(37, 99, 235, 0.10);
    border: 1px solid rgba(37, 99, 235, 0.20);
}

.portal-shell .school-contact-title {
    color: #e2e8f0;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 6px;
}

.portal-shell .school-contact-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    color: #94a3b8;
    font-size: 11px;
    text-decoration: none;
    min-width: 0;
}

    .portal-shell .school-contact-link span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .portal-shell .school-contact-link:hover {
        color: #f8fafc;
    }

    .portal-shell .school-contact-link .mud-icon-root {
        color: #60a5fa;
        font-size: 16px;
    }

.portal-shell .footer-help {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding: 0 4px;
}

.portal-shell .footer-help-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
}

    .portal-shell .footer-help-link:hover {
        color: #f8fafc;
    }

.portal-shell .footer-version {
    color: #475569;
    font-size: 10px;
}

/* Only positions the line; its text is styled by .footer-version. */
.portal-shell .footer-powered-by {
    margin-top: 6px;
    padding: 0 4px;
    color: #475569;
    font-size: 10px;
}
