html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

a, .btn-link {
    color: #006bb7;
}

/* =========================================================
   Global Buttons
   ========================================================= */

.btn-primary {
    color: #fff;
    background-color: #3f6f9f;
    border-color: #3f6f9f;
}

    .btn-primary:hover {
        color: #fff;
        background-color: #355f89;
        border-color: #355f89;
    }

    .btn-primary:focus,
    .btn-primary:active {
        color: #fff;
        background-color: #355f89;
        border-color: #355f89;
    }

.btn-secondary {
    color: #44515d;
    background-color: #f5f7f9;
    border-color: #d9e0e6;
}

    .btn-secondary:hover {
        color: #36414b;
        background-color: #e9eef2;
        border-color: #cbd4dc;
    }

.btn-danger {
    color: #fff;
    background-color: #b95656;
    border-color: #b95656;
}

    .btn-danger:hover {
        color: #fff;
        background-color: #a44747;
        border-color: #a44747;
    }

.btn-primary,
.btn-secondary,
.btn-danger {
    border-radius: 10px;
    padding: .7rem 1rem;
    cursor: pointer;
    font: inherit;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

    .btn-primary:disabled,
    .btn-secondary:disabled,
    .btn-danger:disabled {
        opacity: .55;
        cursor: not-allowed;
    }

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #8fb2d3;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred.";
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}


/* =========================================================
   SabMoodle Login
   ========================================================= */

.login-empty-layout {
    min-height: 100vh;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: #f4f5f7;
}

.login-card {
    width: 100%;
    max-width: 390px;
    padding: 34px 36px 30px;
    background: #fff;
    border: 1px solid #dfe3e7;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

    .login-logo img {
        display: block;
        max-width: 150px;
        max-height: 85px;
        object-fit: contain;
    }

.login-logo-placeholder {
    min-width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d7dce1;
    border-radius: 50%;
    font-weight: 600;
    color: #5d6670;
}

.login-app-name {
    margin: 0 0 24px;
    text-align: center;
    font-size: 1.35rem;
    font-weight: 500;
    color: #333;
}

.login-user-types {
    display: flex;
    margin-bottom: 24px;
    border-bottom: 1px solid #dfe3e7;
}

.login-user-type {
    flex: 1;
    padding: 10px 8px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: #5d6670;
}

    .login-user-type:hover {
        color: #3f6f9f;
    }

    .login-user-type.active {
        border-bottom-color: #3f6f9f;
        color: #3f6f9f;
        font-weight: 600;
    }

.login-field {
    margin-bottom: 18px;
}

    .login-field label {
        display: block;
        margin-bottom: 7px;
        color: #3f454b;
    }

    .login-field .form-control {
        min-height: 42px;
        border-radius: 3px;
    }

.login-submit {
    width: 100%;
    min-height: 42px;
    margin-top: 4px;
    border-radius: 3px;
}

.login-new-user {
    margin-top: 18px;
    text-align: center;
}

.login-error {
    margin-bottom: 18px;
    padding: 10px 12px;
    border: 1px solid #e6b8b8;
    background: #fff5f5;
    color: #a12626;
    border-radius: 3px;
}


/* =========================================================
   Empty Layout Language
   ========================================================= */

.empty-layout-language {
    position: fixed;
    top: 20px;
    inset-inline-end: 24px;
    z-index: 10;
}

    .empty-layout-language a {
        font-size: 0.9rem;
        text-decoration: none;
        cursor: pointer;
    }

/* =========================================================
   SabMoodle Administration UI
   Shared by all management pages
   ========================================================= */

.admin-page {
    padding: 1rem 1.5rem;
    min-height: 100%;
    background: #f8fafc;
    font-size: .9rem;
}

.admin-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    margin-bottom: .55rem;
    background: #fff;
    border: 1px solid #edf1f5;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(31,56,88,.04);
}

    .admin-page-header h1 {
        margin: 0;
        color: #182333;
        font-size: 1.35rem;
        font-weight: 700;
    }

    .admin-page-header p {
        margin: .25rem 0 0;
        color: #8490a0;
        font-size: .82rem;
    }

/* Shared add action */
.add-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 30px;
    background: #eef4fa;
    color: #356fb6;
    border: 1px solid #d6e3ef;
    border-radius: 50%;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

    .add-btn:hover {
        background: #356fb6;
        color: #fff;
        border-color: #356fb6;
    }

    .add-btn:focus {
        outline: none;
        box-shadow: 0 0 0 3px rgba(53,111,182,.10);
    }

/* Search */
.filter-toggle-row {
    display: flex;
    justify-content: flex-end;
    margin: 0 0 .55rem;
}

[dir="rtl"] .filter-toggle-row {
    justify-content: flex-start;
}

.search-toggle-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    color: #536f8c;
    border: 1px solid #dce5ee;
    border-radius: 8px;
    font-size: .85rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

    .search-toggle-btn:hover {
        background: #eef4fa;
        color: #356fb6;
        border-color: #cbdbea;
    }

    .search-toggle-btn:focus {
        outline: none;
        box-shadow: 0 0 0 3px rgba(53, 111, 182, .09);
    }

.filter-toggle-row .btn-secondary {
    min-height: 36px;
    padding: .42rem .8rem;
    background: #fff;
    color: #53677f;
    border: 1px solid #e3e9ef;
    border-radius: 9px;
    box-shadow: 0 2px 8px rgba(31,56,88,.03);
    font-size: .8rem;
    font-weight: 500;
}



.filter-card {
    position: relative;
    padding: .85rem 1rem;
    margin-bottom: .65rem;
    background: #fff;
    border: 1px solid #edf1f5;
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(31,56,88,.04);
}

.filter-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: .7rem;
    align-items: end;
}

/* Shared fields */
.field {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    margin-bottom: 0;
}

    .field label {
        color: #39485b;
        font-size: .77rem;
        font-weight: 600;
    }

    .field input,
    .field select,
    .field textarea {
        width: 100%;
        min-height: 38px;
        box-sizing: border-box;
        padding: .5rem .7rem;
        background: #fff;
        color: #27384c;
        border: 1px solid #dfe6ed;
        border-radius: 9px;
        font: inherit;
        font-size: .84rem;
        transition: border-color .15s ease, box-shadow .15s ease;
    }

    .field textarea {
        min-height: auto;
        resize: vertical;
    }

        .field input::placeholder,
        .field textarea::placeholder {
            color: #a0aab6;
            font-size: .8rem;
        }

        .field input:hover,
        .field select:hover,
        .field textarea:hover {
            border-color: #cbd6e1;
        }

        .field input:focus,
        .field select:focus,
        .field textarea:focus {
            outline: none;
            border-color: #6f9ac7;
            box-shadow: 0 0 0 3px rgba(53,111,182,.08);
        }

.filter-actions {
    display: flex;
    align-items: center;
    gap: .45rem;
}

    .filter-actions .btn-primary,
    .filter-actions .btn-secondary {
        min-height: 38px;
        padding: .48rem .9rem;
        border-radius: 9px;
        font-size: .8rem;
        font-weight: 500;
    }

/* Shared table */
.table-card {
    overflow: hidden;
    background: #fff;
    border: 1px solid #edf1f5;
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(31,56,88,.04);
}

.table-scroll {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    min-width: 850px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .83rem;
}

    .data-table th {
        padding: .7rem .9rem;
        background: #f7f9fc;
        color: #435268;
        border-bottom: 1px solid #e8edf2;
        font-size: .75rem;
        font-weight: 700;
        text-align: start;
        white-space: nowrap;
    }

    .data-table td {
        padding: .7rem .9rem;
        color: #2d3b4e;
        border-bottom: 1px solid #f0f2f5;
        font-size: .83rem;
        text-align: start;
        vertical-align: middle;
    }

    .data-table tbody tr:hover {
        background: #fafcff;
    }

    .data-table tbody tr:last-child td {
        border-bottom: 0;
    }

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: .25rem .55rem;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 600;
}

    .status-pill.active {
        background: #edf8f0;
        color: #34824b;
    }

    .status-pill.inactive {
        background: #f2f4f6;
        color: #7d8792;
    }

.actions-column {
    width: 100px;
}

.row-actions {
    display: flex;
    align-items: center;
    gap: .35rem;
}

.icon-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: #f2f6fa;
    color: #356fb6;
    border: 0;
    border-radius: 8px;
    font-size: .78rem;
    cursor: pointer;
    transition: background-color .15s ease;
}

    .icon-btn:hover {
        background: #e6eef7;
    }

    .icon-btn.danger {
        background: #fff1f1;
        color: #c04d4d;
    }

        .icon-btn.danger:hover {
            background: #fde5e5;
        }

.empty-state {
    padding: 2.5rem 1.25rem;
    color: #8a96a4;
    font-size: .84rem;
    text-align: center;
}

/* Shared drawer */
.drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 1090;
    background: rgba(20,32,48,.38);
    backdrop-filter: blur(2px);
}

.app-drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    width: min(560px,94vw);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(39,64,92,.06), 0 0 45px rgba(20,37,58,.25);
    font-size: .88rem;
}

.drawer-left {
    left: 0;
    border-radius: 0 18px 18px 0;
    animation: drawerFromLeft .2s ease-out;
}

.drawer-right {
    right: 0;
    border-radius: 18px 0 0 18px;
    animation: drawerFromRight .2s ease-out;
}

@keyframes drawerFromLeft {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes drawerFromRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
    padding: 1rem 1.25rem;
    background: #f2f6fb;
    border-bottom: 1px solid #dce6f0;
    border-top: 4px solid #356fb6;
}

    .drawer-header h2 {
        margin: 0;
        color: #17283d;
        font-size: 1.12rem;
        font-weight: 700;
    }

    .drawer-header p {
        margin: .22rem 0 0;
        color: #66788d;
        font-size: .77rem;
    }

.drawer-close {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: #fff;
    color: #50657c;
    border: 1px solid #d9e3ed;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
}

    .drawer-close:hover {
        background: #e5edf6;
        color: #244d78;
    }

.drawer-body {
    flex: 1;
    padding: 1.1rem 1.25rem;
    overflow-y: auto;
    background: #fff;
}

.drawer-section {
    position: relative;
    padding: 1rem;
    margin-bottom: .85rem;
    background: #fafbfd;
    border: 1px solid #e3e9ef;
    border-radius: 12px;
}

    .drawer-section:last-child {
        margin-bottom: 0;
    }

    .drawer-section h3 {
        margin: 0 0 .85rem;
        color: #27425f;
        font-size: .86rem;
        font-weight: 700;
    }

        .drawer-section h3::before {
            content: "";
            display: inline-block;
            width: 4px;
            height: 14px;
            margin-inline-end: .45rem;
            background: #4d82ba;
            border-radius: 5px;
            vertical-align: -2px;
        }

.drawer-body .field {
    margin-bottom: .7rem;
}

    .drawer-body .field:last-child {
        margin-bottom: 0;
    }

.two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .7rem;
}

.role-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem;
}

.role-check {
    display: flex;
    align-items: center;
    gap: .5rem;
    min-height: 38px;
    padding: .5rem .65rem;
    background: #fff;
    border: 1px solid #dce4ec;
    border-radius: 9px;
    color: #34485e;
    font-size: .8rem;
    cursor: pointer;
}

    .role-check:hover {
        background: #f0f5fa;
        border-color: #b9ccde;
    }

    .role-check input {
        accent-color: #356fb6;
    }

.drawer-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .5rem;
    padding: .85rem 1.25rem;
    background: #f3f6f9;
    border-top: 1px solid #dce4eb;
}

    .drawer-footer .btn-primary,
    .drawer-footer .btn-secondary,
    .drawer-footer .btn-danger {
        min-height: 38px;
        padding: .48rem 1rem;
        border-radius: 9px;
        font-size: .8rem;
        font-weight: 600;
    }

.validation-message {
    margin-top: .7rem;
    padding: .7rem .85rem;
    background: #fff2f2;
    color: #9e3e3e;
    border: 1px solid #f0cccc;
    border-radius: 9px;
    font-size: .8rem;
}

.delete-message {
    padding: .9rem;
    background: #fff5f5;
    color: #633d3d;
    border: 1px solid #efcece;
    border-radius: 11px;
    font-size: .84rem;
}

    .delete-message p {
        margin: .35rem 0 0;
        color: #856363;
    }

/* Shared DB notification */
.db-notification {
    position: fixed;
    top: 1rem;
    width: min(350px,calc(100vw - 2rem));
    z-index: 1200;
    display: grid;
    gap: .2rem;
    padding: .8rem 2.3rem .8rem .9rem;
    background: #fff;
    border: 1px solid #e9edf1;
    border-inline-start: 4px solid;
    border-radius: 11px;
    box-shadow: 0 8px 25px rgba(24,44,68,.14);
    font-size: .82rem;
}

[dir="rtl"] .db-notification {
    left: 1rem;
    right: auto;
}

[dir="ltr"] .db-notification {
    right: 1rem;
    left: auto;
}

.db-notification.success {
    border-inline-start-color: #3c9858;
}

.db-notification.error {
    border-inline-start-color: #c74f4f;
}

.db-notification strong {
    color: #29394d;
    font-size: .84rem;
}

.db-notification span {
    color: #748194;
    font-size: .76rem;
}

.db-notification button {
    position: absolute;
    top: .3rem;
    inset-inline-end: .4rem;
    padding: .15rem .35rem;
    background: transparent;
    color: #8591a0;
    border: 0;
    font-size: 1rem;
    cursor: pointer;
}

button:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* Administration responsive */
@media (max-width: 1000px) {
    .filter-grid {
        grid-template-columns: 1fr 1fr;
    }

    .filter-actions {
        align-self: end;
    }
}

@media (max-width: 700px) {
    .admin-page {
        padding: .7rem;
    }

    .admin-page-header {
        padding: .85rem 1rem;
    }

        .admin-page-header h1 {
            font-size: 1.2rem;
        }

    .filter-grid {
        grid-template-columns: 1fr;
    }

    .filter-actions {
        width: 100%;
    }

        .filter-actions button {
            flex: 1;
        }

    .two-columns,
    .role-list {
        grid-template-columns: 1fr;
    }

    .app-drawer {
        width: 100%;
        max-width: none;
        border-radius: 0;
    }
}
/* =========================================================
   Shared Symbol Action Buttons
   ========================================================= */

.action-symbol-btn {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    color: #536f8c;
    border: 1px solid #d8e2ec;
    border-radius: 8px;
    font-family: Arial, sans-serif;
    font-size: 1.15rem;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

    .action-symbol-btn:hover {
        background: #eef4fa;
        color: #356fb6;
        border-color: #c6d8e8;
    }

    .action-symbol-btn.primary {
        background: #356fb6;
        color: #ffffff;
        border-color: #356fb6;
    }

        .action-symbol-btn.primary:hover {
            background: #2e639f;
            border-color: #2e639f;
        }

    .action-symbol-btn:focus {
        outline: none;
        box-shadow: 0 0 0 3px rgba(53, 111, 182, .09);
    }


/* زر إظهار/إخفاء البحث */
.filter-toggle-row .action-symbol-btn {
    margin: 0;
}


/* أزرار البحث والمسح داخل الفلتر */
.filter-actions {
    display: flex;
    align-items: center;
    gap: .4rem;
}

/* =========================================================
   Drawer Action Icon Buttons
   ========================================================= */

.drawer-action-btn {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    color: #53677f;
    border: 1px solid #d6dfe8;
    border-radius: 9px;
    font-family: Arial, sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

    .drawer-action-btn:hover {
        background: #eef3f7;
        color: #344b63;
        border-color: #c7d3de;
    }


    /* Save */

    .drawer-action-btn.primary {
        background: #356fb6;
        color: #ffffff;
        border-color: #356fb6;
    }

        .drawer-action-btn.primary:hover {
            background: #2e639f;
            border-color: #2e639f;
        }


    /* Disabled / Saving */

    .drawer-action-btn:disabled {
        opacity: .5;
        cursor: not-allowed;
    }


/* Footer itself */

.drawer-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .4rem;
    padding: .7rem 1.25rem;
    background: #f3f6f9;
    border-top: 1px solid #dce4eb;
}
/* =========================================================
   Global Loading
   ========================================================= */

.global-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .55);
    backdrop-filter: blur(1px);
}

.global-loading-box {
    width: 54px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #dce5ee;
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(31, 54, 79, .12);
}

.global-loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #dce8f3;
    border-top-color: #356fb6;
    border-radius: 50%;
    animation: global-loading-spin .7s linear infinite;
}

@keyframes global-loading-spin {
    to {
        transform: rotate(360deg);
    }
}
/* Login mobile */
@media (max-width: 576px) {
    .login-page {
        padding: 0;
        background: #fff;
    }

    .login-card {
        max-width: none;
        min-height: 100vh;
        padding: 36px 24px;
        border: 0;
        box-shadow: none;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}

/* =========================================================
   Administration Mobile Record Cards
   Tables become stacked record cards on small screens
   ========================================================= */
@media (max-width: 700px) {
    .table-card {
        overflow: visible;
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .table-scroll {
        overflow: visible;
    }

    .data-table {
        width: 100%;
        min-width: 0;
        border-collapse: separate;
        border-spacing: 0;
        font-size: .83rem;
    }

        .data-table thead {
            display: none;
        }

        .data-table tbody,
        .data-table tr,
        .data-table td {
            display: block;
            width: 100%;
            box-sizing: border-box;
        }

        .data-table tbody {
            display: grid;
            gap: .7rem;
        }

            .data-table tbody tr {
                position: relative;
                padding: .9rem 1rem 3.65rem;
                background: #fff;
                border: 1px solid #e6edf3;
                border-radius: 14px;
                box-shadow: 0 4px 14px rgba(31,56,88,.05);
            }

                .data-table tbody tr:hover {
                    background: #fff;
                }

                .data-table tbody tr:last-child td,
                .data-table td {
                    padding: .48rem 0;
                    border-bottom: 1px solid #f0f3f6;
                    text-align: start;
                    white-space: normal;
                    overflow-wrap: anywhere;
                }

                    .data-table td:last-child {
                        border-bottom: 0;
                    }

                    /*
       The current Razor tables do not carry data-label attributes,
       so each value is presented cleanly as a stacked field.
       Actions are separated into a horizontal footer area.
    */
                    .data-table td.row-actions {
                        position: absolute;
                        bottom: .75rem;
                        width: auto;
                        padding: 0;
                        border: 0;
                        display: flex;
                        flex-direction: row;
                        align-items: center;
                        gap: .4rem;
                    }

    /* Arabic / RTL: actions on the left */
    [dir="rtl"] .data-table td.row-actions {
        left: 1rem;
        right: auto;
        justify-content: flex-start;
    }

    /* English / LTR: actions on the right */
    [dir="ltr"] .data-table td.row-actions {
        right: 1rem;
        left: auto;
        justify-content: flex-end;
    }

    .data-table .row-actions .icon-btn {
        flex: 0 0 32px;
    }
}
/* =========================================================
   Shared Pagination
   ========================================================= */

.pagination-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
    padding: .8rem 1rem;
    background: #fff;
    border-top: 1px solid #edf1f5;
    font-size: .78rem;
}

.pagination-info {
    color: #7b8796;
    justify-self: start;
    white-space: nowrap;
}

.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .3rem;
}

.pagination-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 .45rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: #536f8c;
    border: 1px solid #dce5ee;
    border-radius: 8px;
    font: inherit;
    font-size: .78rem;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

    .pagination-btn:hover:not(:disabled):not(.active) {
        background: #eef4fa;
        color: #356fb6;
        border-color: #cbdbea;
    }

    .pagination-btn.active {
        background: #356fb6;
        color: #fff;
        border-color: #356fb6;
        font-weight: 600;
    }

    .pagination-btn:disabled {
        opacity: .45;
        cursor: not-allowed;
    }

.pagination-dots {
    min-width: 24px;
    text-align: center;
    color: #8995a3;
}

.pagination-size {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .45rem;
    color: #7b8796;
    white-space: nowrap;
}

    .pagination-size select {
        min-width: 65px;
        height: 32px;
        padding: 0 .45rem;
        background: #fff;
        color: #405268;
        border: 1px solid #dce5ee;
        border-radius: 8px;
        font: inherit;
        font-size: .78rem;
    }

        .pagination-size select:focus {
            outline: none;
            border-color: #6f9ac7;
            box-shadow: 0 0 0 3px rgba(53,111,182,.08);
        }


/* Pagination Mobile */
@media (max-width: 700px) {

    .pagination-container {
        grid-template-columns: 1fr;
        gap: .7rem;
        padding: .8rem;
    }

    .pagination-info {
        justify-self: center;
        order: 2;
    }

    .pagination-controls {
        width: 100%;
        order: 1;
        flex-wrap: wrap;
    }

    .pagination-size {
        justify-content: center;
        order: 3;
    }

    .pagination-btn {
        min-width: 34px;
        height: 34px;
    }
}

/* =========================================================
   MAIN HEADER - CURRENT USER
   ========================================================= */

.main-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.main-header-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.main-header-user-name {
    font-weight: 600;
    white-space: nowrap;
}

.main-header-settings {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .main-header-settings:hover {
        background: #f1f3f5;
    }


/* =========================================================
   USER SETTINGS DRAWER
   ========================================================= */



.user-settings-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.9rem 0;
    border-bottom: 1px solid #eee;
}

    .user-settings-item span {
        font-size: 0.82rem;
        opacity: 0.65;
    }

    .user-settings-item strong {
        font-size: 0.95rem;
        font-weight: 600;
    }

.main-header-user-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.2;
}

.main-header-user-role {
    margin-top: 0.15rem;
    font-size: 0.75rem;
    font-weight: 400;
    color: #8a8f98;
}


/* =========================================================
   SabMoodle Layout Direction - Desktop + Mobile
   Arabic: RTL / sidebar right / header user left
   English: LTR / sidebar left / header user right
   ========================================================= */

[dir="rtl"] .page {
    direction: rtl;
    flex-direction: row-reverse;
}

[dir="ltr"] .page {
    direction: ltr;
    flex-direction: row;
}

[dir="rtl"] .main-header {
    justify-content: flex-start;
    direction: rtl;
}

[dir="ltr"] .main-header {
    justify-content: flex-end;
    direction: ltr;
}

[dir="rtl"] .main-header-user-info {
    text-align: right;
}

[dir="ltr"] .main-header-user-info {
    text-align: left;
}

[dir="rtl"] main,
[dir="rtl"] .content,
[dir="rtl"] .admin-page,
[dir="rtl"] .drawer-body {
    direction: rtl;
    text-align: right;
}

[dir="ltr"] main,
[dir="ltr"] .content,
[dir="ltr"] .admin-page,
[dir="ltr"] .drawer-body {
    direction: ltr;
    text-align: left;
}

[dir="rtl"] .sidebar,
[dir="rtl"] .nav-scrollable {
    direction: rtl;
    text-align: right;
}

[dir="ltr"] .sidebar,
[dir="ltr"] .nav-scrollable {
    direction: ltr;
    text-align: left;
}

[dir="rtl"] .app-drawer {
    right: 0;
    left: auto;
    border-radius: 18px 0 0 18px;
    animation: drawerFromRight .2s ease-out;
}

[dir="ltr"] .app-drawer {
    left: 0;
    right: auto;
    border-radius: 0 18px 18px 0;
    animation: drawerFromLeft .2s ease-out;
}

[dir="rtl"] .drawer-footer {
    justify-content: flex-start;
}

[dir="ltr"] .drawer-footer {
    justify-content: flex-end;
}

@media (max-width: 640.98px) {
    [dir="rtl"] .sidebar {
        right: 0;
        left: auto;
    }

    [dir="ltr"] .sidebar {
        left: 0;
        right: auto;
    }

    [dir="rtl"] .main-header {
        justify-content: flex-start;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    [dir="ltr"] .main-header {
        justify-content: flex-end;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .main-header-user {
        min-width: 0;
        max-width: 100%;
    }

    .main-header-user-info {
        min-width: 0;
    }

    .main-header-user-name,
    .main-header-user-role {
        max-width: min(65vw, 280px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    [dir="rtl"] .app-drawer,
    [dir="ltr"] .app-drawer {
        left: 0;
        right: 0;
        width: 100%;
        max-width: none;
        border-radius: 0;
    }

    [dir="rtl"] .drawer-header,
    [dir="rtl"] .drawer-body,
    [dir="rtl"] .drawer-section {
        direction: rtl;
        text-align: right;
    }

    [dir="ltr"] .drawer-header,
    [dir="ltr"] .drawer-body,
    [dir="ltr"] .drawer-section {
        direction: ltr;
        text-align: left;
    }

    [dir="rtl"] .data-table td.row-actions {
        left: 1rem;
        right: auto;
        justify-content: flex-start;
    }

    [dir="ltr"] .data-table td.row-actions {
        right: 1rem;
        left: auto;
        justify-content: flex-end;
    }
}


/* =========================================================
   User Profile
   Append to wwwroot/app.css
   ========================================================= */

.user-profile-page {
    position: relative;
}

.profile-card {
    position: relative;
    max-width: 980px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid #e8edf3;
    border-radius: 18px;
    box-shadow: 0 8px 28px rgba(20, 37, 58, .08);
    overflow: hidden;
}

.profile-edit-btn {
    position: absolute;
    top: 1rem;
    inset-inline-end: 1rem;
    width: 42px;
    height: 42px;
    border: 1px solid #dce4ed;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    font-size: 1.2rem;
    z-index: 2;
}

    .profile-edit-btn:hover {
        background: #f2f6fb;
    }

.profile-hero {
    padding: 2.2rem 1.5rem 1.6rem;
    text-align: center;
    background: #f7f9fc;
    border-bottom: 1px solid #edf1f5;
}

.profile-avatar {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    object-fit: cover;
    background: #fff;
    border: 5px solid #fff;
    box-shadow: 0 6px 20px rgba(20, 37, 58, .14);
}

.profile-hero h1 {
    margin: 1rem 0 .25rem;
    font-size: 1.45rem;
    font-weight: 700;
}

.profile-login-name {
    color: #7a8491;
    font-size: .9rem;
}

.profile-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    padding: .5rem 1.5rem 1.5rem;
}

.profile-detail {
    padding: 1rem;
    border-bottom: 1px solid #eef1f4;
}

    .profile-detail span {
        display: block;
        margin-bottom: .35rem;
        color: #7b8490;
        font-size: .78rem;
    }

    .profile-detail strong {
        display: block;
        font-size: .95rem;
        font-weight: 600;
        overflow-wrap: anywhere;
    }

.profile-detail-wide {
    grid-column: 1 / -1;
}

.profile-password-section {
    margin: 0 1.5rem 1.5rem;
    padding: 1rem 1.15rem;
    border: 1px solid #e8edf3;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

    .profile-password-section h2 {
        margin: 0 0 .2rem;
        font-size: 1rem;
    }

    .profile-password-section p {
        margin: 0;
        color: #7b8490;
        font-size: .82rem;
    }

.profile-secondary-btn {
    border: 1px solid #ccd7e3;
    background: #fff;
    border-radius: 10px;
    padding: .55rem .9rem;
    cursor: pointer;
    white-space: nowrap;
}

    .profile-secondary-btn:hover {
        background: #f2f6fb;
    }

.profile-drawer-image {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

    .profile-drawer-image img {
        width: 110px;
        height: 110px;
        border-radius: 50%;
        object-fit: cover;
        border: 4px solid #fff;
        box-shadow: 0 5px 18px rgba(20, 37, 58, .15);
    }

.profile-description-field {
    margin-top: .8rem;
}

    .profile-description-field textarea {
        resize: vertical;
        min-height: 100px;
    }

.upload-file {
    display: grid;
    gap: .5rem;
}

    .upload-file input[type="file"] {
        width: 100%;
    }

.upload-file-error {
    padding: .65rem .8rem;
    border-radius: 9px;
    background: #fff4f4;
    color: #a32626;
    font-size: .82rem;
}

.upload-file-status {
    color: #657180;
    font-size: .82rem;
}

@media (max-width: 700px) {
    .profile-details-grid {
        grid-template-columns: 1fr;
        padding-inline: .8rem;
    }

    .profile-detail-wide {
        grid-column: auto;
    }

    .profile-password-section {
        flex-direction: column;
        align-items: stretch;
    }

    .profile-secondary-btn {
        width: 100%;
    }

    .profile-avatar {
        width: 110px;
        height: 110px;
    }
}
/* =========================================================
   COURSE PLAN MASTER
   ========================================================= */

.course-plan-master {
    width: 100%;
}

    /* Header */
    .course-plan-master .admin-page-header {
        margin-bottom: 18px;
    }

/* =========================================================
   MASTER MENU
   ========================================================= */

.course-plan-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin-bottom: 18px;
    padding: 8px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    overflow-x: auto;
}

.course-plan-menu-item {
    appearance: none;
    border: 0;
    outline: none;
    background: transparent;
    padding: 11px 18px;
    border-radius: 10px;
    font: inherit;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

    .course-plan-menu-item:hover {
        background: #f5f6f8;
    }

    .course-plan-menu-item.active {
        background: #f0f2f6;
        box-shadow: inset 0 0 0 1px #d9dee7;
    }

/* =========================================================
   SECTION HEADER
   ========================================================= */

.course-plan-master .section-header {
    margin-top: 8px;
    margin-bottom: 14px;
}

    .course-plan-master .section-header h2 {
        margin: 0;
    }

/* =========================================================
   GENERAL TAB
   ========================================================= */

.plan-summary-card {
    padding: 0;
}

    .plan-summary-card .drawer-section {
        display: grid;
        gap: 24px;
        padding: 24px;
    }

    .plan-summary-card .two-columns {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 24px;
    }

    .plan-summary-card strong {
        display: block;
        margin-bottom: 6px;
        font-size: 0.88rem;
        font-weight: 700;
    }

        .plan-summary-card strong + div {
            min-height: 24px;
            line-height: 1.7;
        }

    /* Give long description/instruction values room */
    .plan-summary-card .drawer-section > div:not(.two-columns) {
        padding-top: 4px;
    }

/* =========================================================
   RTL / LTR
   ========================================================= */

[dir="rtl"] .course-plan-menu {
    direction: rtl;
}

[dir="ltr"] .course-plan-menu {
    direction: ltr;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 800px) {

    .course-plan-menu {
        justify-content: flex-start;
    }

    .plan-summary-card .two-columns {
        grid-template-columns: 1fr;
    }

    .plan-summary-card .drawer-section {
        padding: 18px;
        gap: 18px;
    }
}

/* Drawer close button */
.drawer-close-btn {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid #d9e1ec;
    border-radius: 10px;
    background: #ffffff;
    color: #334155;
    font-size: 22px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

    .drawer-close-btn:hover {
        background: #f5f7fa;
        border-color: #c7d2e0;
    }

    .drawer-close-btn:active {
        transform: scale(0.96);
    }

    .drawer-close-btn:disabled {
        opacity: 0.5;
        cursor: default;
    }

/* =========================================================
   QUESTION CHOICES
   ========================================================= */

.question-choice-card {
    position: relative;
    margin-bottom: 14px;
    padding: 18px;
    background: #ffffff;
    border: 1px solid #e3eaf3;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.025);
}

    .question-choice-card + .question-choice-card {
        margin-top: 14px;
    }

.question-choice-meta {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #edf1f6;
}

    .question-choice-meta > label {
        display: flex;
        align-items: center;
        gap: 7px;
        min-height: 40px;
        margin: 0;
        white-space: nowrap;
    }

    .question-choice-meta .compact {
        flex: 1;
        max-width: none;
    }

    .question-choice-meta .action-symbol-btn {
        flex: 0 0 auto;
        align-self: flex-end;
    }

@media (max-width: 700px) {
    .question-choice-card {
        padding: 14px;
    }

    .question-choice-meta {
        align-items: stretch;
        flex-direction: column;
    }

        .question-choice-meta .compact {
            width: 100%;
        }
}