/* =========================================================
   Base & Global Styles
   ========================================================= */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: inherit;
}

html, body {
    margin: 0;
    overflow-x: hidden;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";
    line-height: 1.5;
}

/* Media elements scale properly */
img, svg, video, canvas, audio, iframe {
    max-width: 100%;
    height: auto;
}

/* Skip link for keyboard users */
.skip-link {
    position: absolute;
    top: 0;
    left: 0;
    transform: translateY(-100%);
    background: #255b3a;
    color: #fff;
    padding: .5rem .9rem;
    z-index: 1100;
}

    .skip-link:focus {
        transform: translateY(0);
    }

/* =========================================================
   Links / Buttons / Forms
   ========================================================= */
a, .btn-link {
    color: #006bb7;
    text-decoration: none;
}

    a:hover, .btn-link:hover {
        text-decoration: underline;
    }

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem #fff, 0 0 0 0.25rem #258cfb;
    outline: none;
}

/* Slightly larger tap targets on small screens */
@media (max-width: 600px) {
    .btn {
        padding: .6rem 1rem;
    }
}

/* =========================================================
   Layout Shell
   ========================================================= */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.ms-main {
    min-height: 60vh;
    padding: 24px;
}

.ms-main--internal {
    padding-top: 24px;
}

/* =========================================================
   Navbars
   ========================================================= */
.ms-navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #255b3a; /* public or internal */
    color: #fff;
    border-bottom: 1px solid rgba(0,0,0,.08);
}

.ms-navbar--internal {
    background: #255b3a;
}

/* Wrapper ensures brand + nav are centered */
.ms-navbar-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 10px;
    padding: 14px 24px;
}

/* Brand */
.ms-brand {
    display: block;
    color: #fff;
    font-weight: 800;
    letter-spacing: 0.02em;
    font-size: clamp(1rem, 2.6vw, 1.3rem);
    text-decoration: none;
    text-align: center;
    margin-bottom: 6px;
}

/* Centered Nav */
.ms-nav {
    width: 100%;
    display: flex;
    justify-content: center;
}

    /* top-level only (keep this) */
    .ms-nav > ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 14px 48px;
        list-style: none;
        margin: 0;
        padding: 0;
        max-width: 1200px;
    }

    /* nested ULs (dropdowns) must not be flex */
    .ms-nav ul ul {
        list-style: none;
        margin: 0;
        padding: 0;
        display: block;
    }

    /* Avatar */
    .ms-nav .nav-avatar {
        margin-left: auto;
    }

    .ms-nav .avatar {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        object-fit: cover;
        display: block;
        border: 1px solid rgba(0,0,0,.08);
    }

        .ms-nav .avatar:hover {
            outline: 2px solid rgba(0,0,0,.1);
        }

    .ms-nav li {
        text-align: center;
        flex: 0 1 auto;
        max-width: 220px; /* wrap long labels inside */
    }

    /* nav links */
    .ms-nav a,
    .ms-nav .nav-link {
        display: inline-block;
        width: 100%;
        color: #fff;
        font-weight: 700;
        padding: 8px 6px;
        line-height: 1.3;
        text-align: center;
        text-decoration: none;
        white-space: normal; /* allow wrapping */
        word-break: break-word; /* break long words if needed */
        overflow-wrap: anywhere;
    }

        .ms-nav a:hover,
        .ms-nav .nav-link:hover {
            text-decoration: underline;
        }

    .ms-nav .active {
        text-decoration: underline;
        text-underline-offset: 3px;
    }

    /* let Bootstrap control visibility by default */
    .ms-nav .dropdown-menu {
        display: none;
    }

    /* show when Bootstrap adds .show */
    .ms-nav .dropdown.show > .dropdown-menu,
    .ms-nav .dropdown .dropdown-menu.show {
        display: block;
    }

    /* optional hover open for mouse users */
    .ms-nav .dropdown:hover > .dropdown-menu {
        display: block;
    }

    /* dark dropdown to match internal header */
    .ms-nav .dropdown-menu {
        background: #255b3a;
        border: 5px solid rgba(0,0,0,.15);
        padding: .25rem 0;
    }

    .ms-nav .dropdown-item {
        color: #fff;
    }

        .ms-nav .dropdown-item:hover {
            color: #fff;
            background: rgba(255,255,255,.08);
        }

    .ms-nav > ul > li.logout-link {
        margin-left: auto;
    }

    .ms-nav .logout-link a {
        color: #fff;
        font-weight: 700;
    }

        .ms-nav .logout-link a:hover {
            text-decoration: underline;
        }

/* =========================================================
   Footer
   ========================================================= */
.ms-footer {
    background: #f5f6f7;
    color: #333;
    padding: 24px 0;
}

/* =========================================================
   Auth layout helpers
   ========================================================= */
.auth-wrap {
    min-height: calc(100dvh - 140px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,.08);
    padding: 28px;
    border: 1px solid rgba(0,0,0,.06);
}

.auth-title {
    margin: 0 0 12px;
    font-size: 1.5rem;
    font-weight: 700;
}

.auth-form .form-floating > .form-control {
    height: calc(3.25rem + 2px);
    padding: 1rem .75rem;
}

.auth-links a {
    text-decoration: none;
}

    .auth-links a:hover {
        text-decoration: underline;
    }

/* =========================================================
   Buttons
   ========================================================= */
.btn-success {
    background-color: #255b3a;
    border-color: #255b3a;
}

    .btn-success:hover {
        background-color: #1e4d31;
        border-color: #1e4d31;
    }

/* =========================================================
   Profile layout & grids
   ========================================================= */
.profile-wrap {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 1.25rem;
    align-items: start;
}

.profile-photo {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(0,0,0,.08);
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    gap: .75rem 1rem;
    margin: .75rem 0;
}

    .grid .col-2 {
        grid-column: span 2;
    }

.btn {
    padding: .5rem .9rem;
}

/* =========================================================
   Responsive Adjustments
   ========================================================= */
@media (max-width: 1100px) {
    .ms-nav > ul {
        gap: 12px 36px;
        max-width: 1000px;
    }
}

@media (max-width: 900px) {
    .ms-brand {
        margin-bottom: 8px;
    }

    .ms-navbar-inner {
        padding: 12px 16px;
    }

    .ms-nav > ul {
        gap: 10px 24px;
        max-width: 800px;
    }

    .ms-main,
    .ms-main--internal {
        padding: 16px;
    }

    .container {
        padding: 0 16px;
    }

    .profile-wrap {
        grid-template-columns: 150px 1fr;
    }
}

@media (max-width: 768px) {
    /* Stack profile photo above form */
    .profile-wrap {
        grid-template-columns: 1fr;
        text-align: left;
    }

    .profile-left {
        justify-self: center;
    }

    .grid {
        grid-template-columns: 1fr;
    }

        .grid .col-2 {
            grid-column: auto;
        }
}

@media (max-width: 600px) {
    .ms-nav > ul {
        gap: 8px 16px;
        max-width: 100%;
    }

    .ms-nav li {
        max-width: 160px;
    }

    .ms-nav a,
    .ms-nav .nav-link {
        font-size: 0.95rem;
        padding: 6px 4px;
    }

    .auth-card {
        padding: 20px;
    }
}

/* =========================================================
   Responsive Tables (mobile-friendly, accessible)
   ========================================================= */


.table-responsive-stack {
    width: 100%;
    overflow-x: auto; /* fallback horizontal scroll on medium screens */
}

/* Small screens: stack rows into cards */
@media (max-width: 700px) {
    .table-responsive-stack table,
    .table-responsive-stack thead,
    .table-responsive-stack tbody,
    .table-responsive-stack th,
    .table-responsive-stack td,
    .table-responsive-stack tr {
        display: block;
        width: 100%;
    }

    .table-responsive-stack thead {
        /* hide header row, but keep for screen readers */
        position: absolute;
        top: -9999px;
        left: -9999px;
        height: 1px;
        width: 1px;
        overflow: hidden;
    }

    .table-responsive-stack tr {
        margin-bottom: 0.75rem;
        border: 1px solid rgba(0,0,0,0.08);
        border-radius: 0.5rem;
        padding: 0.5rem 0.75rem;
        background: #fff;
    }

    .table-responsive-stack td {
        border: none !important;
        border-bottom: 1px solid rgba(0,0,0,0.05) !important;
        position: relative;
        padding-left: 50%;
        padding-top: 0.4rem;
        padding-bottom: 0.4rem;
        min-height: 2.2rem;
        display: flex;
        align-items: center;
    }

        .table-responsive-stack td:last-child {
            border-bottom: none !important;
        }

        .table-responsive-stack td::before {
            content: attr(data-label);
            position: absolute;
            left: 0.75rem;
            top: 0;
            bottom: 0;
            display: flex;
            align-items: center;
            font-weight: 600;
            font-size: 0.85rem;
            text-align: left;
            white-space: nowrap;
        }
}
/* =========================================================
   Admin Users Table – responsive / mobile-friendly
   ========================================================= */

.admin-users-table-wrapper {
    width: 100%;
    overflow-x: auto; /* fallback horizontal scroll if CSS fails */
}

/* Keep normal table layout on larger screens */
.admin-users-table {
    width: 100%;
}

/* Stack rows on small screens */
@media (max-width: 768px) {
    .admin-users-table {
        border: 0;
    }

        .admin-users-table thead {
            border: 0;
            clip: rect(0 0 0 0);
            height: 1px;
            margin: -1px;
            overflow: hidden;
            padding: 0;
            position: absolute;
            width: 1px;
        }

        .admin-users-table tbody tr {
            display: block;
            margin-bottom: 0.75rem;
            border-bottom: 1px solid #dee2e6;
            padding-bottom: 0.5rem;
        }

            .admin-users-table tbody tr:last-child {
                margin-bottom: 0;
            }

        .admin-users-table td {
            display: grid;
            grid-template-columns: minmax(0, 40%) minmax(0, 1fr);
            gap: 0.35rem;
            padding: 0.35rem 0.75rem;
            border: none;
        }

            .admin-users-table td[data-label="Actions"] {
                grid-template-columns: 1fr; /* actions stack vertically */
            }

            .admin-users-table td::before {
                content: attr(data-label);
                font-weight: 600;
                color: #555;
                text-align: left;
            }

            .admin-users-table td[data-label="Actions"]::before {
                margin-bottom: 0.25rem;
            }

            /* Make buttons fill width nicely on mobile */
            .admin-users-table td[data-label="Actions"] .btn {
                width: 100%;
                text-align: center;
            }
}
/* Wrapper to put both sections side by side */
.footer-wrapper {
    
    display: flex;
    justify-content: space-between;
    gap: 40px;
    flex-wrap: wrap; /* allows stacking on mobile */
    margin-bottom: 30px;
    align-items: center;
}

.ms-footer {
    background: #b4b4b4;
    color: #333;
}

.footer-section {
    flex: 1;
    min-width: 260px;
    text-align: center;
}

.footer-heading {
    font-weight: bold;
    font-size: 18px;
    margin-bottom: 10px;
}

.footer-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

    .footer-list li {
        margin-bottom: 6px;
    }

/* Social icons */
.social-icons-list {
    display: flex;
    gap: 15px;
    padding: 0;
    list-style: none;
    justify-content: center;
}

    .social-icons-list a {
        color: #333;
        transition: color 0.2s ease;
    }

        .social-icons-list a:hover {
            color: #0d6efd; /* Bootstrap primary blue */
        }

/* Accessibility block stays full width */
.footer-accessibility hr {
    border: none;
    height: 2px;
    background: #ccc;
    margin: 20px 0;
}

.footer-accessibility p {
    margin-bottom: 12px;
}
