@font-face {
    font-family: 'Tajawal';
    font-style: normal;
    font-weight: 300;
    font-display: swap;
    src: url('https://fonts.gstatic.com/s/tajawal/v9/Iurf6YBj_oCad4k1l5qjHrRpiYlJ.woff2') format('woff2');
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EFD-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}

@font-face {
    font-family: 'Tajawal';
    font-style: normal;
    font-weight: 300;
    font-display: swap;
    src: url('https://fonts.gstatic.com/s/tajawal/v9/Iurf6YBj_oCad4k1l5qjHrFpiQ.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Tajawal';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('https://fonts.gstatic.com/s/tajawal/v9/Iura6YBj_oCad4k1nzSBC45I.woff2') format('woff2');
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EFD-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}

@font-face {
    font-family: 'Tajawal';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('https://fonts.gstatic.com/s/tajawal/v9/Iura6YBj_oCad4k1nzGBCw.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Droid Arabic Kufi';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/DroidKufi-Regular.woff2') format('woff2'), url('../fonts/DroidKufi-Regular.woff') format('woff'), url('../fonts/DroidKufi-Regular.ttf') format('truetype');
}

@font-face {
    font-family: 'Droid Arabic Kufi';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/DroidKufi-Bold.woff2') format('woff2'), url('../fonts/DroidKufi-Bold.woff') format('woff'), url('../fonts/DroidKufi-Bold.ttf') format('truetype');
}

:root {
    --hc-font-family: 'Tajawal', 'Droid Arabic Kufi', 'Segoe UI', Tahoma, Arial, sans-serif;
    --hc-primary-dark: #14274A;
    --hc-primary-dark-2: #1A315C;
    --hc-primary-blue: #48A0D8;
    --hc-accent-gold: #FFCD35;
    --hc-soft-bg: #F4F7FB;
    --hc-border: #E4EAF2;
    --hc-text: #223046;
    --hc-text-light: #6E7B8F;
}

html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body.hamadchat-body {
    margin-bottom: 0;
    font-family: var(--hc-font-family);
}

.page-shell {
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 0.5rem 1.5rem rgba(0,0,0,.06);
    padding: 1.5rem;
}

.access-denied-page {
    background: radial-gradient(circle at top right, rgba(72, 160, 216, .16), transparent 34%), var(--hc-soft-bg);
}

.access-denied-hero {
    min-height: calc(100vh - 120px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8rem 1rem 4rem;
}

.access-denied-card {
    width: min(100%, 620px);
    background: rgba(255, 255, 255, .96);
    border: 1px solid var(--hc-border);
    border-radius: 2rem;
    box-shadow: 0 1.5rem 4rem rgba(20, 39, 74, .12);
    padding: 3rem;
    text-align: center;
}

.access-denied-icon {
    width: 5rem;
    height: 5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 1.5rem;
    background: linear-gradient(135deg, var(--hc-primary-blue), var(--hc-primary-dark));
    color: #fff;
    font-size: 2.4rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 .8rem 2rem rgba(72, 160, 216, .25);
}

.access-denied-card h1 {
    color: var(--hc-primary-dark);
    font-weight: 800;
    margin-bottom: 1rem;
}

.access-denied-card p {
    color: var(--hc-text-light);
    line-height: 1.9;
    margin: 0 auto 1.5rem;
    max-width: 34rem;
}

.access-denied-path {
    background: #f8fafc;
    border: 1px dashed rgba(72, 160, 216, .35);
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
    color: var(--hc-text);
}

.access-denied-path code {
    display: block;
    direction: ltr;
    margin-top: .5rem;
    white-space: normal;
    word-break: break-word;
}

.access-denied-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.access-denied-primary,
.access-denied-secondary {
    border-radius: 999px;
    padding: .75rem 1.25rem;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-weight: 700;
}

.access-denied-primary {
    background: var(--hc-primary-dark);
    color: #fff;
}

.access-denied-primary:hover {
    background: var(--hc-primary-dark-2);
    color: #fff;
}

.access-denied-secondary {
    border: 1px solid rgba(72, 160, 216, .35);
    color: var(--hc-primary-dark);
    background: #fff;
}

.access-denied-secondary:hover {
    border-color: var(--hc-primary-blue);
    color: var(--hc-primary-dark-2);
}

.not-found-page {
    background: radial-gradient(circle at top left, rgba(255, 205, 53, .18), transparent 36%), var(--hc-soft-bg);
}

.not-found-hero {
    min-height: calc(100vh - 120px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8rem 1rem 4rem;
}

.not-found-card {
    width: min(100%, 660px);
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, .96);
    border: 1px solid var(--hc-border);
    border-radius: 2rem;
    box-shadow: 0 1.5rem 4rem rgba(15, 23, 42, .12);
    padding: 3rem;
    text-align: center;
}

.not-found-code {
    position: absolute;
    inset-inline-start: -1rem;
    top: -2.2rem;
    color: rgba(20, 39, 74, .08);
    font-size: 8rem;
    font-weight: 900;
    line-height: 1;
}

.not-found-icon {
    width: 5rem;
    height: 5rem;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 1.5rem;
    background: linear-gradient(135deg, var(--hc-accent-gold), var(--hc-primary-blue));
    color: #fff;
    font-size: 2.3rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 .8rem 2rem rgba(72, 160, 216, .24);
}

.not-found-card h1 {
    color: var(--hc-primary-dark);
    font-weight: 800;
    margin-bottom: 1rem;
}

.not-found-card p {
    color: var(--hc-text-light);
    line-height: 1.9;
    margin: 0 auto 1.5rem;
    max-width: 35rem;
}

.not-found-path {
    background: #f8fafc;
    border: 1px dashed rgba(72, 160, 216, .35);
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
    color: var(--hc-text);
}

.not-found-path code {
    display: block;
    direction: ltr;
    margin-top: .5rem;
    white-space: normal;
    word-break: break-word;
}

.not-found-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.not-found-primary,
.not-found-secondary {
    border-radius: 999px;
    padding: .75rem 1.25rem;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-weight: 700;
}

.not-found-primary {
    background: var(--hc-primary-dark);
    color: #fff;
}

.not-found-primary:hover {
    background: var(--hc-primary-dark-2);
    color: #fff;
}

.not-found-secondary {
    border: 1px solid rgba(72, 160, 216, .35);
    color: var(--hc-primary-dark);
    background: #fff;
}

.not-found-secondary:hover {
    border-color: var(--hc-primary-blue);
    color: var(--hc-primary-dark-2);
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: .5rem;
}

.page-subtitle {
    color: #6c757d;
    margin-bottom: 1.5rem;
}

.select2-container--default .select2-selection--multiple {
    min-height: 38px;
    border-color: #dee2e6;
    border-radius: .375rem;
}

.select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: #86b7fe;
    box-shadow: 0 0 0 .25rem rgba(13, 110, 253, .25);
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #eaf4fb;
    border-color: #b9ddf2;
    color: #14274a;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: #6c757d;
}

.stat-card {
    border: 0;
    border-radius: 1rem;
    box-shadow: 0 0.5rem 1.2rem rgba(0,0,0,.05);
}

.dashboard-shell {
    border: 1px solid #e4ebf3;
    background: linear-gradient(180deg, #f8fbff 0%, #ffffff 220px);
    box-shadow: 0 1rem 2.5rem rgba(20, 39, 74, .08);
}

.dashboard-header-panel {
    border: 1px solid #dfeaf5;
    border-radius: 1.25rem;
    background: linear-gradient(135deg, rgba(72, 160, 216, .10), rgba(255, 255, 255, .95));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.85), 0 .75rem 1.5rem rgba(20, 39, 74, .05);
    padding: 1.25rem;
}

.dashboard-kpi-card,
.dashboard-chart-card,
.dashboard-panel-card {
    border: 1px solid #e3ebf4 !important;
    background: rgba(255,255,255,.96);
    box-shadow: 0 .75rem 1.75rem rgba(20, 39, 74, .07) !important;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.dashboard-kpi-card {
    position: relative;
    overflow: hidden;
}

.dashboard-kpi-card::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #48a0d8, #14274a);
}

.dashboard-kpi-card:hover,
.dashboard-chart-card:hover,
.dashboard-panel-card:hover {
    border-color: #c4d9ec !important;
    box-shadow: 0 1rem 2.25rem rgba(20, 39, 74, .11) !important;
    transform: translateY(-2px);
}

.dashboard-kpi-icon {
    width: 46px;
    height: 46px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.55), 0 .5rem 1rem rgba(20, 39, 74, .08);
}

.dashboard-chart-card .card-body,
.dashboard-panel-card .card-body {
    border-radius: 1rem;
}

.dashboard-chart-container {
    height: 340px;
    border: 1px solid #edf2f7;
    border-radius: 1rem;
    background: linear-gradient(180deg, #ffffff, #fbfdff);
    padding: .5rem;
}

.placeholder-box {
    border: 1px dashed #ced4da;
    border-radius: .9rem;
    padding: 1rem;
    background: #fafbfc;
    color: #6c757d;
}

.widget-tree-shell {
    min-height: 0;
}

.widget-tree-scroll,
.widget-preview-scroll {
    overflow: auto;
    min-height: 0;
    max-height: calc(100vh - 260px);
    padding-inline-end: .25rem;
}

.widget-tree-node {
    position: relative;
    margin-top: .9rem;
}

.widget-tree-scroll > .widget-tree-node:first-child {
    margin-top: 0;
}

.widget-tree-node::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: -.9rem;
    right: 1rem;
    border-right: 2px solid #e4eaf2;
}

.widget-tree-node:last-child::before {
    bottom: calc(100% - 1.8rem);
}

.widget-tree-card {
    position: relative;
    z-index: 1;
    margin-right: 2rem;
    border: 1px solid #e4eaf2;
    border-radius: 1rem;
    background: #fff;
    padding: 1rem;
    box-shadow: 0 .4rem 1rem rgba(20, 39, 74, .06);
}

.widget-tree-card::before {
    content: "";
    position: absolute;
    top: 1.75rem;
    right: -1rem;
    width: 1rem;
    border-top: 2px solid #e4eaf2;
}

.widget-tree-main {
    min-width: 0;
}

.widget-tree-title-row {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.widget-tree-title {
    color: #14274a;
    font-weight: 700;
}

.widget-tree-desc {
    margin-top: .35rem;
    color: #6c757d;
}

.widget-tree-meta,
.widget-node-meta {
    color: #6c757d;
    font-size: .85rem;
}

.widget-tree-toggle,
.widget-tree-toggle-placeholder {
    width: 1.85rem;
    height: 1.85rem;
    flex: 0 0 1.85rem;
}

.widget-tree-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d8e2ef;
    border-radius: 50%;
    background: #f8fafe;
    color: #48a0d8;
    transition: background-color .2s ease, color .2s ease, transform .2s ease;
}

.widget-tree-toggle:hover {
    background: #48a0d8;
    color: #fff;
}

.widget-tree-toggle.collapsed i {
    transform: rotate(90deg);
}

.widget-tree-toggle i {
    transition: transform .2s ease;
}

.widget-tree-children {
    position: relative;
    margin-right: 2rem;
    padding-right: 0;
}

.widget-node-title {
    color: #14274a;
    font-weight: 700;
}

.widget-node-desc {
    margin-top: .35rem;
    color: #6c757d;
    font-size: .92rem;
}


/* Ensure footer sticks to bottom */
html, body {
    height: 100%;
    margin: 0;
}

    body.hamadchat-body {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
    }

main {
    flex: 1 0 auto;
}

.main-footer {
    flex-shrink: 0;
}

/* Landing page specific */
body.landing-page {
    background: white;
}

body.login-page {
    background: #f4f7fb;
}

body.login-page .main-footer {
    display: none;
}

.login-hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    overflow: hidden;
    padding: 7rem 0 3rem;
    background:
        radial-gradient(circle at 18% 18%, rgba(72, 160, 216, .18), transparent 32%),
        radial-gradient(circle at 80% 70%, rgba(255, 205, 53, .16), transparent 28%),
        linear-gradient(135deg, #f8fbff 0%, #eef5fb 48%, #ffffff 100%);
}

.login-hero-glow {
    position: absolute;
    border-radius: 999px;
    filter: blur(8px);
    opacity: .7;
    pointer-events: none;
}

.login-hero-glow-primary {
    width: 300px;
    height: 300px;
    top: 12%;
    left: 8%;
    background: rgba(72, 160, 216, .18);
}

.login-hero-glow-gold {
    width: 220px;
    height: 220px;
    right: 10%;
    bottom: 8%;
    background: rgba(255, 205, 53, .2);
}

.login-shell {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr);
    gap: 2rem;
    align-items: stretch;
}

.login-brand-panel,
.login-card {
    border: 1px solid rgba(196, 217, 236, .78);
    border-radius: 2rem;
    background: rgba(255, 255, 255, .88);
    box-shadow: 0 1.25rem 3rem rgba(20, 39, 74, .11);
    backdrop-filter: blur(14px);
}

.login-brand-panel {
    padding: clamp(2rem, 4vw, 3rem);
    color: #14274a;
    overflow: hidden;
}

.login-brand-logo {
    width: 140px;
    margin-bottom: 2rem;
}

.login-brand-logo img {
    width: 100%;
    height: auto;
    display: block;
}

.login-brand-badge {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: 1.25rem;
    padding: .45rem 1rem;
    border-radius: 999px;
    background: rgba(72, 160, 216, .1);
    color: #0d6efd;
    font-weight: 700;
    font-size: .9rem;
}

.login-brand-badge span {
    width: .55rem;
    height: .55rem;
    border-radius: 999px;
    background: #22c55e;
    box-shadow: 0 0 0 .35rem rgba(34, 197, 94, .14);
}

.login-brand-panel h1 {
    max-width: 680px;
    margin-bottom: 1rem;
    font-weight: 800;
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1.25;
}

.login-brand-panel p {
    max-width: 620px;
    color: #5f6f86;
    font-size: 1.05rem;
    line-height: 1.9;
}

.login-feature-list {
    display: grid;
    gap: 1rem;
    margin-top: 2rem;
}

.login-feature-item {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: 1rem;
    border: 1px solid #e4eaf2;
    border-radius: 1.25rem;
    background: rgba(255, 255, 255, .7);
    color: #223046;
    font-weight: 700;
}

.login-feature-item i {
    width: 2.35rem;
    height: 2.35rem;
    display: inline-grid;
    place-items: center;
    flex: 0 0 2.35rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #48a0d8, #0d6efd);
    color: #fff;
}

.login-card {
    padding: clamp(1.5rem, 3vw, 2.25rem);
}

.login-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.login-card-icon {
    width: 3.25rem;
    height: 3.25rem;
    display: inline-grid;
    place-items: center;
    flex: 0 0 3.25rem;
    border-radius: 1rem;
    background: linear-gradient(135deg, #14274a, #48a0d8);
    color: #fff;
    font-size: 1.35rem;
    box-shadow: 0 .75rem 1.5rem rgba(72, 160, 216, .24);
}

.login-card h2 {
    margin: 0 0 .25rem;
    color: #14274a;
    font-weight: 800;
}

.login-card p {
    margin: 0;
    color: #6e7b8f;
}

.login-floating {
    position: relative;
}

.login-floating .form-control {
    min-height: 3.5rem;
    border: 1px solid #dfe8f3;
    border-radius: 1rem;
    padding-inline-end: 3rem;
    background-color: #fbfdff;
}

.login-floating .form-control:focus {
    border-color: #48a0d8;
    box-shadow: 0 0 0 .25rem rgba(72, 160, 216, .18);
}

.login-floating i {
    position: absolute;
    top: 1.05rem;
    left: 1rem;
    color: #48a0d8;
    z-index: 3;
}

.login-coming-soon {
    color: #6e7b8f;
    font-size: .85rem;
}

.login-submit,
.login-sso {
    min-height: 3.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border: 0;
    border-radius: 999px;
    font-weight: 800;
}

.login-submit {
    background: linear-gradient(135deg, #48a0d8, #0d6efd);
    color: #fff;
}

.login-submit:disabled {
    opacity: .55;
}

.login-sso {
    border: 1px solid rgba(72, 160, 216, .35);
    background: #fff;
    color: #14274a;
    text-decoration: none;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.login-sso:hover {
    border-color: #48a0d8;
    color: #14274a;
    box-shadow: 0 .75rem 1.5rem rgba(20, 39, 74, .08);
    transform: translateY(-2px);
}

.login-divider {
    position: relative;
    margin: 1.5rem 0;
    text-align: center;
    color: #6e7b8f;
}

.login-divider::before {
    content: "";
    position: absolute;
    top: 50%;
    right: 0;
    left: 0;
    border-top: 1px solid #e4eaf2;
}

.login-divider span {
    position: relative;
    padding: 0 1rem;
    background: rgba(255, 255, 255, .95);
}

.login-note {
    margin-top: 1rem;
    padding: .9rem 1rem;
    border: 1px dashed #c4d9ec;
    border-radius: 1rem;
    background: #f8fbff;
    color: #6e7b8f;
    font-size: .86rem;
    line-height: 1.7;
}

@media (max-width: 992px) {
    .login-shell {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .login-hero {
        padding-top: 6rem;
    }

    .login-card-header {
        align-items: flex-start;
    }
}

/* Mobile fixes */
@media (max-width: 768px) {
    .container-fluid.py-4 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }
}


/* Add to site.css - Accessibility & Performance */

/* Skip to content link */
.visually-hidden-focusable:not(:focus) {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.visually-hidden-focusable:focus {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 10000;
    background: var(--hc-primary-blue);
    color: white;
    padding: 0.75rem 1rem;
    text-decoration: none;
    font-weight: 600;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    body:not(.landing-page) *,
    body:not(.landing-page) *::before,
    body:not(.landing-page) *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 3px solid var(--hc-primary-blue);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Better touch targets on mobile */
@media (max-width: 768px) {
    .nav-link,
    .btn-login,
    .footer-links a {
        padding: 0.75rem 0.5rem;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
}

/* Loading state for navigation */
body.loading {
    cursor: wait;
}

    body.loading * {
        pointer-events: none;
    }

/* Smooth theme transition */
:root {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ======================================== */
/* PUBLIC USER MENU - Landing Page Styles */
/* ======================================== */

.public-user-menu {
    position: relative;
}

.public-user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: transparent;
    border: none;
    padding: 0.4rem 0.75rem;
    border-radius: 40px;
    transition: all 0.3s ease;
    cursor: pointer;
    background: var(--hc-soft-bg);
    border: 1px solid var(--hc-border);
}

    .public-user-menu-toggle:hover {
        background: var(--hc-white);
        border-color: var(--hc-primary-blue);
        transform: translateY(-1px);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }

/* Avatar Styles */
.user-avatar-sm {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.user-avatar-initials-sm {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--hc-primary-blue), var(--hc-primary-blue-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgba(72, 160, 216, 0.3);
}

.user-avatar-md {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.user-avatar-initials-md {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--hc-primary-blue), var(--hc-primary-blue-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(72, 160, 216, 0.3);
}

/* User Info */
.user-info-sm {
    display: flex;
    flex-direction: column;
    text-align: right;
}

.user-name-sm {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--hc-primary-dark);
    line-height: 1.2;
}

.user-role-sm {
    font-size: 0.7rem;
    color: var(--hc-text-light);
    line-height: 1.2;
}

.user-chevron-sm {
    font-size: 0.8rem;
    color: var(--hc-text-light);
    transition: transform 0.3s ease;
}

.public-user-menu-toggle[aria-expanded="true"] .user-chevron-sm {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.public-user-dropdown {
    min-width: 260px;
    border: none;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    padding: 0.5rem;
    margin-top: 12px;
    background: var(--hc-white);
    animation: dropdownSlideIn 0.3s ease;
}

@keyframes dropdownSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.public-user-dropdown .dropdown-header {
    padding: 0.75rem;
    border-bottom: 1px solid var(--hc-border);
    margin-bottom: 0.5rem;
}

.public-user-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.9rem;
    border-radius: 10px;
    color: var(--hc-text);
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

    .public-user-dropdown .dropdown-item i {
        font-size: 1.1rem;
        width: 22px;
        color: var(--hc-text-light);
        transition: all 0.2s ease;
    }

    .public-user-dropdown .dropdown-item:hover {
        background: var(--hc-soft-bg);
        color: var(--hc-primary-blue);
        transform: translateX(-4px);
    }

        .public-user-dropdown .dropdown-item:hover i {
            color: var(--hc-primary-blue);
        }

    .public-user-dropdown .dropdown-item.text-danger:hover {
        background: rgba(220, 53, 69, 0.1);
        color: #dc3545;
    }

.public-user-dropdown .dropdown-divider {
    margin: 0.5rem 0;
    border-color: var(--hc-border);
}

/* RTL Adjustments for User Menu */
[dir="rtl"] .public-user-dropdown .dropdown-item:hover {
    transform: translateX(4px);
}

/* Mobile Responsive */
@media (max-width: 991px) {
    .user-info-sm {
        display: none;
    }

    .public-user-menu-toggle {
        padding: 0.3rem 0.5rem;
        background: transparent;
        border: none;
    }

        .public-user-menu-toggle:hover {
            background: var(--hc-soft-bg);
            transform: none;
        }

    .user-chevron-sm {
        display: none;
    }

    .user-avatar-sm {
        width: 32px;
        height: 32px;
    }

    .user-avatar-initials-sm {
        font-size: 0.75rem;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .public-user-dropdown {
        background: var(--hc-primary-dark);
    }

        .public-user-dropdown .dropdown-item {
            color: rgba(255, 255, 255, 0.85);
        }

            .public-user-dropdown .dropdown-item:hover {
                background: rgba(72, 160, 216, 0.2);
            }
}

/* Collapsible filter toggle */
.filter-toggle:focus {
    box-shadow: none;
}

.filter-toggle .filter-toggle-icon {
    transition: transform 0.2s ease;
}

.filter-toggle[aria-expanded="true"] .filter-toggle-icon {
    transform: rotate(180deg);
}

/* Match Select2 single-select to Bootstrap .form-select metrics */
.select2-container {
    width: 100% !important;
}

.select2-container--default .select2-selection--single {
    height: calc(1.5em + 0.75rem + 2px);
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
}

    .select2-container--default .select2-selection--single .select2-selection__rendered {
        padding: 0;
        line-height: 1.5;
        color: var(--bs-body-color, #212529);
    }

    .select2-container--default .select2-selection--single .select2-selection__placeholder {
        color: var(--bs-secondary-color, #6c757d);
    }

    .select2-container--default .select2-selection--single .select2-selection__arrow {
        height: calc(1.5em + 0.75rem);
    }

/* Keep dropdown results from growing too tall */
.select2-dropdown .select2-results__options {
    max-height: 240px;
}

/* Focus ring consistent with Bootstrap */
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}
/* Fill-in-the-blank question markers shared by teacher and student surfaces. */
.hc-fill-blank-marker {
    display: inline-block;
    min-width: 5.5rem;
    margin-inline: .25rem;
    padding-inline: .2rem;
    border-bottom: 2px solid currentColor;
    text-align: center;
    font-weight: 600;
    unicode-bidi: isolate;
}

/* HamadChat Native MathML */
mjx-container.hc-native-math-container {
    display: inline;
}

mjx-container.hc-native-math-container[display="block"] {
    display: block;
    max-inline-size: 100%;
    margin-block: 0.5rem;
    overflow-x: auto;
    overflow-y: hidden;
}

/*
 * Direction belongs to the MathML dir attribute.
 * Do not force direction or transform MathML descendants here.
 */
mjx-container.hc-native-math-container > math {
    max-inline-size: 100%;
}