:root {
    --app-bg: #f5f7fb;
    --app-surface: #ffffff;
    --app-border: #e2e8f0;
    --app-primary: #334155;
    --app-primary-hover: #1e293b;
    --app-accent: #2563eb;
    --app-success: #198754;
    --app-danger: #dc3545;
    --app-warning: #f59e0b;
    --app-text: #1f2937;
    --app-text-muted: #64748b;
    --app-radius: 0.625rem;
    --app-shadow: 0 0.125rem 0.625rem rgb(0 0 0 / 6%);
}

/* =========================
   BASE
========================= */

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--app-bg);
    color: var(--app-text);
    font-family: Arial, "Segoe UI", sans-serif;
}

body {
    font-size: 0.875rem;
}

/* =========================
   APPLICATION LAYOUT
========================= */

.app-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--app-bg);
}


/* =========================
   HEADER
========================= */

.app-header {
    width: 100%;
    min-height: 4.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 2%;
    background: var(--app-surface);
    border-bottom: 0.0625rem solid var(--app-border);
    box-shadow: 0 0.125rem 0.5rem rgb(0 0 0 / 5%);
    box-sizing: border-box;
}


/* =========================
   HEADER BRAND
========================= */

.app-header-brand {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    min-width: 0;
}

.app-header-logo {
    width: auto;
    height: 3rem;
    object-fit: contain;
    flex-shrink: 0;
}

.app-header-system {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-header-system-name {
    color: var(--app-text);
    font-size: 1.05rem;
    font-weight: 600;
    white-space: nowrap;
}

.app-header-system-name-en {
    color: var(--app-text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}


/* =========================
   HEADER USER
========================= */

.app-header-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.app-header-user-icon {
    width: 2.3rem;
    height: 2.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f1f5f9;
    font-size: 1.1rem;
}

.app-header-user-info {
    display: flex;
    flex-direction: column;
}

.app-header-user-name {
    color: var(--app-text);
    font-weight: 600;
    white-space: nowrap;
}

.app-header-user-role {
    color: var(--app-text-muted);
    font-size: 0.75rem;
}



/* Keep the contents themselves in the correct writing direction */
.app-body.arabic-layout .app-menu,
.app-body.arabic-layout .app-content {
    direction: rtl;
}

.app-body.english-layout .app-menu,
.app-body.english-layout .app-content {
    direction: ltr;
}

/* =========================
   MAIN CONTENT
========================= */

.app-main {
    width: 100%;
    box-sizing: border-box;
}


/* =========================
   MOBILE HEADER
========================= */

@media (max-width: 48rem) {

    .app-header {
        padding-inline: 4%;
    }

    .app-header-logo {
        height: 2.5rem;
    }

    .app-header-system-name {
        font-size: 0.9rem;
    }

    .app-header-system-name-en {
        display: none;
    }

    .app-header-user-role {
        display: none;
    }

    .app-header-user-name {
        font-size: 0.8rem;
    }
}

/* =========================
   PAGE
========================= */

.page-container {
    padding: 1.5rem;
}

.page-title {
    margin: 0;
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--app-text);
}

.page-subtitle {
    margin-top: 0.25rem;
    color: var(--app-text-muted);
}

/* =========================
   TOOLBAR
========================= */

.page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.125rem;
    margin-bottom: 1rem;
    background: var(--app-surface);
    border: 0.0625rem solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow);
}

    .page-toolbar h3 {
        margin: 0;
        font-size: 1.125rem;
        font-weight: 600;
    }

/* =========================
   BUTTONS
========================= */

.btn-add,
.btn-app-primary {
    padding: 0.5rem 1rem;
    background: var(--app-accent);
    color: white;
    border: 0.0625rem solid var(--app-accent);
    border-radius: 0.4375rem;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, transform .1s ease;
}

    .btn-add:hover,
    .btn-app-primary:hover {
        background: #1d4ed8;
        border-color: #1d4ed8;
    }

    .btn-add:active,
    .btn-app-primary:active {
        transform: scale(.98);
    }

.btn-app-secondary {
    padding: 0.5rem 1rem;
    background: white;
    color: var(--app-text);
    border: 0.0625rem solid var(--app-border);
    border-radius: 0.4375rem;
    cursor: pointer;
}

    .btn-app-secondary:hover {
        background: #f8fafc;
    }

.btn-app-danger {
    padding: 0.5rem 1rem;
    background: var(--app-danger);
    color: white;
    border: 0.0625rem solid var(--app-danger);
    border-radius: 0.4375rem;
    cursor: pointer;
}

    .btn-app-danger:hover {
        background: #bb2d3b;
    }

.btn-icon {
    padding: 0.3125rem 0.5rem;
    border: 0;
    border-radius: 0.375rem;
    background: transparent;
    cursor: pointer;
}

    .btn-icon:hover {
        background: #f1f5f9;
    }


/* =========================
   ICON ACTION BUTTONS
========================= */

.btn-icon-action {
    width: 2.2rem;
    height: 2.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: var(--app-surface);
    color: var(--app-text);
    border: 0.0625rem solid var(--app-border);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease, border-color .2s ease, transform .15s ease, box-shadow .2s ease;
}

    .btn-icon-action i {
        font-size: 0.95rem;
        line-height: 1;
    }

    .btn-icon-action:hover {
        transform: translateY(-0.0625rem);
        box-shadow: 0 0.125rem 0.375rem rgb(0 0 0 / 8%);
    }

    .btn-icon-action:active {
        transform: scale(.95);
    }

    .btn-icon-action.add,
    .btn-icon-action.edit {
        color: #1d4ed8;
        background: #e8efff;
        border-color: #b8c8f5;
    }

        .btn-icon-action.add:hover,
        .btn-icon-action.edit:hover {
            background: #dce7ff;
            border-color: #8eabec;
        }

    .btn-icon-action.save {
        color: #157347;
        background: #e2f3e9;
        border-color: #acd5bb;
    }

        .btn-icon-action.save:hover {
            background: #d4eadc;
            border-color: #8cc29f;
        }

    .btn-icon-action.delete {
        color: #b91c1c;
        background: #fbe7e7;
        border-color: #e7b2b2;
    }

        .btn-icon-action.delete:hover {
            background: #f6d8d8;
            border-color: #d99191;
        }

    .btn-icon-action.cancel {
        color: #475569;
        background: #e9edf2;
        border-color: #cbd5e1;
    }

        .btn-icon-action.cancel:hover {
            background: #dce2e9;
            border-color: #aebaca;
        }

/* =========================
   CARD
========================= */

.app-card {
    background: var(--app-surface);
    border: 0.0625rem solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow);
}

/* =========================
   TABLE
========================= */

.table-container {
    width: 100%;
    overflow-x: auto;
    background: var(--app-surface);
    border: 0.0625rem solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow);
}

.app-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

    .app-table thead th {
        padding: 0.6rem 0.75rem;
        background: #f8fafc;
        color: #475569;
        font-weight: 600;
        border-bottom: 0.0625rem solid var(--app-border);
        text-align: start;
        white-space: nowrap;
    }

    .app-table tbody td {
        padding: 0.52rem 0.75rem;
        border-bottom: 0.0625rem solid #edf1f5;
        vertical-align: middle;
        text-align: start;
    }

    .app-table tbody tr {
        transition: background-color .15s ease;
    }

        .app-table tbody tr:hover {
            background: #fafcff;
        }

        .app-table tbody tr:last-child td {
            border-bottom: 0;
        }

.actions,
.table-actions {
    width: 1%;
    white-space: nowrap;
    text-align: end;
}

    .actions button {
        margin-inline-start: 0.375rem;
    }

/* =========================
   FORM
========================= */

.form-label {
    display: block;
    margin-bottom: 0.375rem;
    color: #374151;
    font-weight: 500;
}

.form-control,
.form-select,
.app-input {
    width: 100%;
    padding: 0.5625rem 0.6875rem;
    border: 0.0625rem solid #cbd5e1;
    border-radius: 0.4375rem;
    background: white;
    color: var(--app-text);
    outline: none;
    box-sizing: border-box;
    transition: border-color .2s ease, box-shadow .2s ease;
}

    .form-control:focus,
    .form-select:focus,
    .app-input:focus {
        border-color: var(--app-accent);
        box-shadow: 0 0 0 0.2rem rgb(37 99 235 / 12%);
    }

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.625rem;
}

/* =========================
   DYNAMIC DRAWER
========================= */

.app-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgb(15 23 42 / 40%);
    z-index: 1040;
    opacity: 0;
    animation: appFadeIn .2s ease forwards;
}

.app-drawer {
    position: fixed;
    background: var(--app-surface);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0.5rem 1.875rem rgb(0 0 0 / 18%);
    opacity: 1;
    box-sizing: border-box;
    overflow: hidden;
}

    .app-drawer *,
    .app-drawer *::before,
    .app-drawer *::after {
        box-sizing: border-box;
        max-width: 100%;
    }

    /* RIGHT */

    .app-drawer.right {
        top: 0;
        right: 0;
        width: var(--drawer-width, 45vw);
        max-width: 100vw;
        height: 100vh;
        animation: drawerFromRight .3s ease;
    }

    /* LEFT */

    .app-drawer.left {
        top: 0;
        left: 0;
        width: var(--drawer-width, 45vw);
        max-width: 100vw;
        height: 100vh;
        animation: drawerFromLeft .3s ease;
    }

    /* TOP */

    .app-drawer.top {
        top: 0;
        left: 0;
        width: 100%;
        height: var(--drawer-height, 40vh);
        max-height: 100vh;
        animation: drawerFromTop .3s ease;
    }

    /* BOTTOM */

    .app-drawer.bottom {
        bottom: 0;
        left: 0;
        width: 100%;
        height: var(--drawer-height, 40vh);
        max-height: 100vh;
        animation: drawerFromBottom .3s ease;
    }

/* =========================
   DRAWER HEADER
========================= */

.app-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.125rem 1.25rem;
    border-bottom: 0.0625rem solid var(--app-border);
    flex-shrink: 0;
}

    .app-drawer-header h3,
    .app-drawer-header h4 {
        margin: 0;
        font-size: 1.125rem;
        font-weight: 600;
    }

/* =========================
   DRAWER FORM
========================= */

.app-drawer-form {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* =========================
   DRAWER BODY
========================= */


.app-drawer-body {
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
    padding: 1.25rem;
    overflow-y: scroll;
    overflow-x: hidden;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
}

    .app-drawer-body .form-group {
        margin-bottom: 1rem;
    }

/* =========================
   DRAWER FOOTER
========================= */

.app-drawer-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    border-top: 0.0625rem solid var(--app-border);
    flex-shrink: 0;
}

/* =========================
   CONFIRM / MODAL
========================= */

.confirm-overlay,
.app-modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgb(15 23 42 / 40%);
    z-index: 1060;
    animation: appFadeIn .2s ease;
}

.confirm-box,
.app-modal {
    width: 30vw;
    max-width: 92vw;
    background: white;
    border-radius: var(--app-radius);
    box-shadow: 0 0.9375rem 2.5rem rgb(0 0 0 / 18%);
    animation: appModalIn .2s ease;
}

.confirm-box {
    padding: 1.5rem;
}

.app-modal-header {
    padding: 1.125rem 1.25rem;
    border-bottom: 0.0625rem solid var(--app-border);
}

.app-modal-body {
    padding: 1.25rem;
}

.app-modal-footer,
.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.625rem;
}

.app-modal-footer {
    padding: 0.875rem 1.25rem;
    border-top: 0.0625rem solid var(--app-border);
}

.confirm-actions {
    margin-top: 1.25rem;
}

/* =========================
   NOTIFICATION
========================= */

.notification,
.app-notification {
    position: fixed;
    top: 2vh;
    min-width: 18rem;
    max-width: 35vw;
    padding: 0.8125rem 1rem;
    border-radius: 0.5rem;
    color: white;
    box-shadow: 0 0.5rem 1.5625rem rgb(0 0 0 / 15%);
    z-index: 2000;
    animation: notificationIn .25s ease;
}

    .notification.success,
    .app-notification-success {
        background: var(--app-success);
    }

    .notification.error,
    .app-notification-error {
        background: var(--app-danger);
    }
/* Arabic -> Left */
html[dir="rtl"] .app-notification {
    left: 1.5rem;
    right: auto;
}

/* English -> Right */
html[dir="ltr"] .app-notification {
    right: 1.5rem;
    left: auto;
}
/* =========================
   STATUS
========================= */

.status-active {
    display: inline-block;
    padding: 0.25rem 0.5625rem;
    border-radius: 1.25rem;
    background: #dcfce7;
    color: #166534;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-inactive {
    display: inline-block;
    padding: 0.25rem 0.5625rem;
    border-radius: 1.25rem;
    background: #fee2e2;
    color: #991b1b;
    font-size: 0.75rem;
    font-weight: 600;
}

/* =========================
   SIDEBAR
========================= */

.app-sidebar {
    background: var(--app-primary);
    color: white;
}

    .app-sidebar a {
        color: #cbd5e1;
        text-decoration: none;
    }

        .app-sidebar a:hover {
            color: white;
        }

        .app-sidebar a.active {
            background: rgb(255 255 255 / 10%);
            color: white;
        }

/* =========================
   TOPBAR
========================= */

.app-topbar {
    height: 3.625rem;
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    background: white;
    border-bottom: 0.0625rem solid var(--app-border);
}

/* =========================
   ANIMATIONS
========================= */

@keyframes appFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes drawerFromRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes drawerFromLeft {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes drawerFromTop {
    from {
        transform: translateY(-100%);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes drawerFromBottom {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes appModalIn {
    from {
        opacity: 0;
        transform: scale(.96);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes notificationIn {
    from {
        opacity: 0;
        transform: translateY(-10%);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* =========================
   DRAWER CLOSE ANIMATIONS
========================= */

.app-drawer.right.closing {
    animation: drawerToRight .3s ease forwards;
}

.app-drawer.left.closing {
    animation: drawerToLeft .3s ease forwards;
}

.app-drawer.top.closing {
    animation: drawerToTop .3s ease forwards;
}

.app-drawer.bottom.closing {
    animation: drawerToBottom .3s ease forwards;
}

.app-drawer-overlay.closing {
    animation: appFadeOut .3s ease forwards;
}

@keyframes drawerToRight {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(100%);
    }
}

@keyframes drawerToLeft {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-100%);
    }
}

@keyframes drawerToTop {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-100%);
    }
}

@keyframes drawerToBottom {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(100%);
    }
}

@keyframes appFadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}
/* =========================
   RESPONSIVE
========================= */

@media (max-width: 48rem) {

    .page-container {
        padding: 0.875rem;
    }

    .page-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .app-drawer.right,
    .app-drawer.left {
        width: 95vw;
        max-width: 95vw;
    }

    .app-drawer.top,
    .app-drawer.bottom {
        height: 90vh;
        max-height: 90vh;
    }

    .confirm-box,
    .app-modal {
        width: 90vw;
        max-width: 90vw;
    }

    .notification,
    .app-notification {
        left: 4vw;
        right: 4vw;
        min-width: auto;
        max-width: none;
    }
}


/* =========================
   HEADER ACTIONS
========================= */

.app-header-actions,
.app-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}


/* =========================
   LANGUAGE BUTTON
========================= */

.app-language-button {
    min-width: 2.35rem;
    height: 2.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0 0.65rem;
    border: 0.0625rem solid #cbd5e1;
    border-radius: 0.5rem;
    background: #e2e8f0;
    color: var(--app-primary);
    font-weight: 700;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, transform .15s ease;
}

    .app-language-button:hover {
        background: #cbd5e1;
        border-color: #94a3b8;
        transform: translateY(-0.0625rem);
    }

    .app-language-button:active {
        transform: scale(.95);
    }


/* =========================
   FOOTER
========================= */

.app-footer {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0.75rem 2%;
    background: var(--app-surface);
    color: var(--app-text-muted);
    border-top: 0.0625rem solid var(--app-border);
    text-align: center;
    font-size: 0.8rem;
    box-sizing: border-box;
}

/* =========================
   MAIN LAYOUT BODY
========================= */

.app-body {
    display: flex;
    flex-direction: row;
    direction: ltr;
    width: 100%;
    flex: 1;
    min-height: 0;
}

    /* English: menu LEFT */
    .app-body.english-layout {
        flex-direction: row;
    }

    /* Arabic: menu RIGHT */
    .app-body.arabic-layout {
        flex-direction: row-reverse;
    }

/* =========================
   MAIN MENU - RIGHT SIDE
========================= */

.app-menu {
    width: 0;
    flex-shrink: 0;
    overflow: hidden;
    background: var(--app-primary);
    color: white;
    transition: width .3s ease;
}

    .app-menu.open {
        width: 22vw;
    }

.app-menu-inner {
    width: 22vw;
    min-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}


/* Keep the contents themselves in the correct writing direction */
.app-body.arabic-layout .app-menu,
.app-body.arabic-layout .app-content {
    direction: rtl;
}

.app-body.english-layout .app-menu,
.app-body.english-layout .app-content {
    direction: ltr;
}

/* =========================
   MAIN CONTENT
========================= */

.app-content {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
    transition: width .3s ease;
}

/* =========================
   HEADER RIGHT / MENU BUTTON
========================= */

.app-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.app-menu-button {
    width: 2.45rem;
    height: 2.45rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 0;
    border-radius: 0.5rem;
    background: #f1f5f9;
    color: var(--app-text);
    font-size: 1.25rem;
    cursor: pointer;
    transition: background-color .2s ease, transform .2s ease;
}

    .app-menu-button:hover {
        background: #e2e8f0;
    }

    .app-menu-button:active {
        transform: scale(.95);
    }

@media (max-width: 48rem) {
    .app-menu.open {
        width: 75vw;
    }

    .app-menu-inner {
        width: 75vw;
    }
}

/* =========================
   NAV MENU
========================= */

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    padding: 0.65rem 0.6rem;
}

.nav-menu-item {
    width: 100%;
}

.nav-menu-link,
.nav-menu-parent {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding-block: 0.48rem;
    padding-inline-start: calc(0.65rem + (var(--menu-level) * 0.9rem));
    padding-inline-end: 0.65rem;
    box-sizing: border-box;
    border-radius: 0.5rem;
    color: rgb(255 255 255 / 82%);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease;
}

    .nav-menu-link:hover,
    .nav-menu-parent:hover {
        background: rgb(255 255 255 / 8%);
        color: white;
    }

    .nav-menu-link.active {
        background: rgb(255 255 255 / 12%);
        color: white;
    }

.nav-menu-icon {
    width: 1.15rem;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.nav-menu-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-menu-arrow {
    flex-shrink: 0;
    margin-inline-start: auto;
    margin-inline-end: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    font-size: 0.65rem;
    opacity: 0.75;
}

.nav-submenu {
    display: flex;
    flex-direction: column;
    gap: 0.08rem;
}

/* =========================
   PAGER
========================= */

.app-pager {
    width: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.85rem;
    /* نفس مستوى الجدول من اليمين واليسار */
    margin-inline: 2rem;
}


/* Page Size */

.pager-page-size {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.pager-page-size-label {
    color: var(--app-text-muted);
    font-size: 0.82rem;
    font-weight: 600;
}

.pager-page-size-select {
    height: 2.2rem;
    min-width: 4rem;
    padding-inline: 0.6rem;
    border: 0.0625rem solid var(--app-border);
    border-radius: 0.5rem;
    background: var(--app-surface);
    color: var(--app-text);
    font-size: 0.82rem;
    outline: none;
    cursor: pointer;
}

    .pager-page-size-select:focus {
        border-color: var(--app-accent);
    }


/* Navigation */

.pager-navigation {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    direction: ltr;
}


/* Buttons */

.pager-button {
    width: 2.2rem;
    height: 2.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0.0625rem solid #b8c8f5;
    border-radius: 0.5rem;
    background: #e8efff;
    color: #1d4ed8;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, transform .15s ease, box-shadow .2s ease;
}

    .pager-button i {
        font-size: 0.8rem;
    }

    .pager-button:hover:not(:disabled) {
        background: #dce7ff;
        border-color: #8eabec;
        transform: translateY(-0.0625rem);
        box-shadow: 0 0.125rem 0.375rem rgb(0 0 0 / 8%);
    }

    .pager-button:active:not(:disabled) {
        transform: scale(.95);
    }

    .pager-button:disabled {
        background: #f1f5f9;
        border-color: #e2e8f0;
        color: #94a3b8;
        cursor: default;
        box-shadow: none;
    }


/* Page Number */

.pager-info {
    min-width: 4.5rem;
    height: 2.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding-inline: 0.75rem;
    background: var(--app-surface);
    border: 0.0625rem solid var(--app-border);
    border-radius: 0.5rem;
    color: var(--app-text-muted);
    font-size: 0.82rem;
    font-weight: 600;
}

.pager-current {
    color: var(--app-accent);
    font-weight: 700;
}

.pager-separator {
    color: #94a3b8;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

    .toolbar-actions .toolbar-btn {
        position: static;
        width: 2.75rem;
        height: 2.75rem;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 0.65rem;
        flex-shrink: 0;
    }

        .toolbar-actions .toolbar-btn i {
            font-size: 1.15rem;
        }

    /* Search */
    .toolbar-actions .filter {
        background: #ffffff;
        border: 0.0625rem solid #d8e0eb;
        color: #334155;
    }

        .toolbar-actions .filter:hover {
            background: #f8fafc;
        }

    /* Clear active filters */
    .toolbar-actions .clear-filter {
        background: #fff5f5;
        border: 0.0625rem solid #fecaca;
        color: #dc2626;
    }

        .toolbar-actions .clear-filter:hover {
            background: #fee2e2;
        }

.clear-filter {
    position: relative !important;
}

.clear-filter-x {
    position: absolute;
    right: 0.15rem;
    bottom: 0.1rem;
    font-size: 0.9rem !important;
    font-weight: 700;
}

/* ================================
   RESPONSIVE TABLE VISIBILITY
   ================================ */

/* Desktop: كل الأعمدة ظاهرة */
.hide-tablet,
.hide-mobile,
.mobile-only,
.tablet-only {
    display: table-cell;
}

/* Tablet */
@media (max-width: 64rem) {

    .hide-tablet {
        display: none !important;
    }

    .tablet-only {
        display: table-cell !important;
    }
}

/* Mobile */
@media (max-width: 48rem) {

    .hide-mobile,
    .hide-tablet {
        display: none !important;
    }

    .mobile-only {
        display: table-cell !important;
    }

    .app-table {
        width: 100%;
        table-layout: auto;
    }

        .app-table th,
        .app-table td {
            white-space: nowrap;
        }

    .table-container {
        width: 100%;
        overflow-x: auto;
    }
}

/* Desktop فقط */
@media (min-width: 48.01rem) {

    .mobile-only {
        display: none !important;
    }
}

/* خارج التابلت */
@media (min-width: 64.01rem) {

    .tablet-only {
        display: none !important;
    }
}

/* =========================================================
   RESPONSIVE MAIN LAYOUT - TABLET & MOBILE
   ========================================================= */

@media (max-width: 64rem) {

    /* منع الصفحة بالكامل من التوسع خارج عرض الجهاز */
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .app-layout {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* =========================
       HEADER
       ========================= */

    .app-header {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding: 0.65rem 0.75rem;
        gap: 0.5rem;
        overflow: hidden;
    }

    .app-header-brand {
        min-width: 0;
        flex: 0 1 auto;
        gap: 0.5rem;
    }

    .app-header-logo {
        height: 2.4rem;
        max-width: 5rem;
        flex-shrink: 0;
    }

    .app-header-system {
        min-width: 0;
        overflow: hidden;
    }

    .app-header-system-name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .app-header-system-name-en {
        display: none;
    }

    .app-header-actions,
    .app-header-right {
        min-width: 0;
        flex-shrink: 0;
        gap: 0.4rem;
    }

    .app-header-user {
        min-width: 0;
        gap: 0.35rem;
    }

    .app-header-user-info {
        min-width: 0;
    }

    .app-header-user-name {
        max-width: 6rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .app-header-user-role {
        display: none;
    }

    .app-header-user-icon {
        width: 2.15rem;
        height: 2.15rem;
        flex-shrink: 0;
    }

    .app-language-button {
        min-width: 2.2rem;
        height: 2.2rem;
        padding-inline: 0.45rem;
    }

    .app-menu-button {
        width: 2.2rem;
        height: 2.2rem;
    }


    /* =========================
       BODY
       ========================= */

    .app-body,
    .app-body.english-layout,
    .app-body.arabic-layout {
        position: relative;
        width: 100%;
        max-width: 100%;
        flex-direction: row;
        overflow-x: hidden;
    }


    /* =========================
       CONTENT
       ========================= */

    .app-content {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        flex: 1 1 100%;
        overflow-x: hidden;
    }

    .app-main {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }


    /* =========================
       MENU AS OVERLAY
       ========================= */

    .app-menu {
        position: fixed;
        top: 4.5rem;
        bottom: 0;
        width: 0;
        max-width: 80vw;
        z-index: 1030;
        overflow: hidden;
        box-shadow: 0 0.5rem 1.5rem rgb(0 0 0 / 18%);
        transition: width .3s ease;
    }

    /* Arabic -> menu from right */
    .app-body.arabic-layout .app-menu {
        right: 0;
        left: auto;
    }

    /* English -> menu from left */
    .app-body.english-layout .app-menu {
        left: 0;
        right: auto;
    }

    .app-menu.open {
        width: 75vw;
    }

    .app-menu-inner {
        width: 75vw;
        height: 100%;
        min-height: 100%;
        overflow-y: auto;
        overflow-x: hidden;
    }


    /* =========================
       PAGE
       ========================= */

    .page-container {
        width: 100%;
        max-width: 100%;
        padding: 1rem;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .page-toolbar {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .table-container {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        box-sizing: border-box;
    }


    /* =========================
       PAGER
       ========================= */

    .app-pager {
        width: 100%;
        margin-inline: 0;
        padding-inline: 0.5rem;
        box-sizing: border-box;
        gap: 0.5rem;
    }
}


/* =========================================================
   MOBILE ONLY
   ========================================================= */

@media (max-width: 48rem) {

    /* بالموبايل نخلي الهيدر أخف */
    .app-header {
        min-height: 4rem;
        padding: 0.55rem 0.6rem;
    }

    .app-header-logo {
        height: 2.15rem;
        max-width: 4.5rem;
    }

    /*
       نخفي اسم النظام بالموبايل.
       اللوقو يبقى ظاهر ويعطينا مساحة للأزرار.
    */
    /*.app-header-system {
        display: none;
    }*/

    /*
       اسم المستخدم مو ضروري بالموبايل،
       الأيقونة تبقى ظاهرة.
    */
    /*.app-header-user-info {
        display: none;
    }*/

    .app-header-actions,
    .app-header-right {
        gap: 0.3rem;
    }

    .app-menu {
        top: 4rem;
        max-width: 82vw;
    }

        .app-menu.open {
            width: 82vw;
        }

    .app-menu-inner {
        width: 82vw;
    }

    .page-container {
        padding: 0.75rem;
    }

    /*
       لا نخلي toolbar يصير عمودي.
       العنوان وزر الإضافة يظلون بنفس السطر.
    */
    .page-toolbar {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        padding: 0.75rem;
    }

        .page-toolbar h3 {
            min-width: 0;
            font-size: 1rem;
        }

    /* Pager يبقى داخل الشاشة */
    .app-pager {
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .pager-navigation {
        flex-shrink: 0;
    }

    .pager-page-size {
        flex-shrink: 0;
    }
}

@media (max-width: 48rem) {

    .responsive-card-table thead {
        display: none;
    }

    .responsive-card-table,
    .responsive-card-table tbody {
        display: block;
        width: 100%;
    }

        .responsive-card-table tbody tr {
            display: grid;
            grid-template-columns: minmax(0, 1fr) auto;
            width: 100%;
            padding: 1rem;
            margin-bottom: 0.75rem;
            background: #fff;
            border: 0.0625rem solid #e2e8f0;
            border-radius: 0.9rem;
            box-sizing: border-box;
        }

        .responsive-card-table td {
            border: 0;
        }

        .responsive-card-table .card-main {
            display: block !important;
            grid-column: 1;
            grid-row: 1;
            padding: 0;
            font-size: 1rem;
            font-weight: 700;
            white-space: normal;
        }

        .responsive-card-table .card-status {
            display: flex !important;
            grid-column: 2;
            grid-row: 1;
            align-items: center;
            justify-content: center;
            padding: 0;
        }

        .responsive-card-table .card-detail {
            display: grid !important;
            grid-template-columns: auto minmax(0, 1fr);
            gap: 0.5rem;
            grid-column: 1 / -1;
            width: 100%;
            padding: 0.35rem 0;
            white-space: normal;
            box-sizing: border-box;
        }

            .responsive-card-table .card-detail::before {
                content: attr(data-label) ":";
                font-weight: 700;
                white-space: nowrap;
            }

            .responsive-card-table .card-main + .card-detail,
            .responsive-card-table .card-detail:first-of-type {
                margin-top: 0.7rem;
            }

        .responsive-card-table .card-actions {
            display: flex !important;
            grid-column: 1 / -1;
            justify-content: flex-end;
            align-items: center;
            gap: 0.5rem;
            width: 100%;
            margin-top: 0.75rem;
            padding: 0.75rem 0 0;
            border-top: 0.0625rem solid #edf1f5;
            box-sizing: border-box;
        }

            .responsive-card-table .card-actions .btn-icon-action {
                position: static !important;
                flex-shrink: 0;
            }

        /* أعمدة hide-tablet لازم ترجع تظهر داخل Card بالموبايل */
        .responsive-card-table .hide-tablet.card-detail,
        .responsive-card-table .hide-tablet.card-status {
            display: grid !important;
        }

        .responsive-card-table .hide-tablet.card-status {
            display: flex !important;
        }
}

/* =========================================================
   QUIZ GAME - PAGE
   ========================================================= */

.quiz-game-page {
    position: relative;
    width: 100%;
    max-width: 1100px;
    min-height: 75vh;
    margin: 0 auto;
    padding: 3rem 1.5rem 5rem;
    direction: rtl;
    overflow: hidden;
}


    /* =========================================================
   DECORATIVE BACKGROUND
   ========================================================= */

    .quiz-game-page::before {
        content: "";
        position: absolute;
        width: 28rem;
        height: 28rem;
        border-radius: 50%;
        background: rgba(111, 66, 193, 0.10);
        top: -12rem;
        right: -10rem;
        filter: blur(2rem);
        animation: gameBlobOne 8s ease-in-out infinite alternate;
        pointer-events: none;
    }

    .quiz-game-page::after {
        content: "";
        position: absolute;
        width: 25rem;
        height: 25rem;
        border-radius: 50%;
        background: rgba(13, 110, 253, 0.08);
        bottom: -10rem;
        left: -8rem;
        filter: blur(2rem);
        animation: gameBlobTwo 10s ease-in-out infinite alternate;
        pointer-events: none;
    }


/* =========================================================
   START CARD
   ========================================================= */

.game-start-card {
    position: relative;
    z-index: 1;
    max-width: 720px;
    margin: 2rem auto;
    padding: 4rem 3rem;
    text-align: center;
    background: linear-gradient( 145deg, rgba(255, 255, 255, 0.96), rgba(248, 249, 255, 0.92) );
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 2rem;
    box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

    .game-start-card::before {
        content: "";
        position: absolute;
        top: 0;
        right: 15%;
        left: 15%;
        height: 0.25rem;
        border-radius: 0 0 1rem 1rem;
        background: linear-gradient( 90deg, transparent, #6f42c1, #0d6efd, transparent );
    }


/* =========================================================
   TROPHY
   ========================================================= */

.game-start-icon {
    width: 6.5rem;
    height: 6.5rem;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.2rem;
    color: #6f42c1;
    background: linear-gradient( 145deg, rgba(111, 66, 193, 0.12), rgba(13, 110, 253, 0.08) );
    box-shadow: 0 0 0 0.7rem rgba(111, 66, 193, 0.035);
    animation: gameTrophyEnter 0.8s cubic-bezier(.34, 1.56, .64, 1), gameTrophyFloat 3s ease-in-out 1s infinite;
}


/* =========================================================
   START TITLE
   ========================================================= */

.game-start-card h1 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 800;
    color: #202633;
    animation: gameTitleEnter 0.65s ease-out both;
    animation-delay: 0.15s;
}

.game-instructions {
    max-width: 520px;
    margin: 1.2rem auto 0;
    color: #6c757d;
    font-size: 1.05rem;
    line-height: 1.9;
    animation: gameTitleEnter 0.65s ease-out both;
    animation-delay: 0.25s;
}


/* =========================================================
   GAME INFO
   ========================================================= */

.game-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    max-width: 450px;
    margin: 2.5rem auto;
}

.game-info-item {
    position: relative;
    padding: 1.4rem 1rem;
    border-radius: 1.3rem;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    animation: gameInfoEnter 0.6s ease-out both;
}

    .game-info-item:nth-child(1) {
        animation-delay: 0.35s;
    }

    .game-info-item:nth-child(2) {
        animation-delay: 0.45s;
    }

    .game-info-item:hover {
        transform: translateY(-0.35rem);
        box-shadow: 0 0.8rem 2rem rgba(0, 0, 0, 0.07);
    }

    .game-info-item i {
        font-size: 1.6rem;
        margin-bottom: 0.4rem;
        color: #6f42c1;
    }

.game-info-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: #202633;
}

.game-info-label {
    margin-top: 0.15rem;
    color: #777;
    font-size: 0.9rem;
}


/* =========================================================
   START BUTTON
   ========================================================= */

.game-start-button {
    position: relative;
    min-width: 230px;
    border: none;
    border-radius: 999rem;
    padding: 1rem 2.2rem;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient( 120deg, #6f42c1, #5b5bd6, #0d6efd );
    background-size: 200% 200%;
    box-shadow: 0 0.8rem 2rem rgba(91, 91, 214, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    cursor: pointer;
    overflow: hidden;
    animation: gameButtonEnter 0.65s ease-out both, gameButtonGradient 5s ease infinite;
    animation-delay: 0.55s, 0s;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

    .game-start-button::before {
        content: "";
        position: absolute;
        top: -50%;
        left: -100%;
        width: 45%;
        height: 200%;
        background: linear-gradient( 90deg, transparent, rgba(255,255,255,0.4), transparent );
        transform: rotate(20deg);
        animation: gameButtonShine 3.5s ease-in-out infinite;
    }

    .game-start-button:hover {
        transform: translateY(-0.25rem) scale(1.02);
        box-shadow: 0 1rem 2.5rem rgba(91, 91, 214, 0.32);
    }

    .game-start-button:active {
        transform: scale(0.96);
    }

    .game-start-button:disabled {
        opacity: 0.65;
        cursor: default;
    }

    .game-start-button i {
        font-size: 1.3rem;
    }


/* =========================================================
   PLAY AREA
   ========================================================= */

.game-play-container {
    position: relative;
    z-index: 1;
    max-width: 850px;
    margin: 1rem auto;
}


/* =========================================================
   TOP BAR
   ========================================================= */

.game-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    animation: gameTopEnter 0.45s ease-out;
}

.game-question-number {
    padding: 0.7rem 1.2rem;
    border-radius: 999rem;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 0.4rem 1.5rem rgba(0,0,0,0.04);
    color: #606570;
}

    .game-question-number strong {
        color: #202633;
        font-size: 1.15rem;
    }


/* =========================================================
   TIMER
   ========================================================= */

.game-timer {
    min-width: 8rem;
    padding: 0.7rem 1.2rem;
    border-radius: 999rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 800;
    border: 1px solid transparent;
    box-shadow: 0 0.4rem 1.5rem rgba(0,0,0,0.05);
    transition: color 0.35s ease, background 0.35s ease, border-color 0.35s ease;
}

.game-timer-normal {
    color: #0d6efd;
    background: #eef5ff;
    border-color: #d7e7ff;
}

.game-timer-warning {
    color: #b66b00;
    background: #fff5df;
    border-color: #ffe0a6;
}

.game-timer-danger {
    color: #dc3545;
    background: #fff0f2;
    border-color: #ffc9cf;
    animation: gameTimerPulse 0.75s ease-in-out infinite;
}


/* =========================================================
   PROGRESS
   ========================================================= */

.game-progress {
    position: relative;
    width: 100%;
    height: 0.55rem;
    margin-bottom: 1.5rem;
    border-radius: 999rem;
    background: rgba(0,0,0,0.06);
    overflow: hidden;
}

.game-progress-bar {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient( 90deg, #6f42c1, #0d6efd );
    transition: width 0.45s cubic-bezier(.34, 1.56, .64, 1);
}


/* =========================================================
   QUESTION CARD
   ========================================================= */

.game-question-card {
    position: relative;
    padding: 2.7rem;
    border-radius: 2rem;
    background: linear-gradient( 145deg, rgba(255,255,255,0.98), rgba(248,249,255,0.96) );
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 1.5rem 4rem rgba(0,0,0,0.07);
}

.game-question-text {
    position: relative;
    padding-bottom: 1.7rem;
    margin-bottom: 1.5rem;
    font-size: clamp(1.2rem, 3vw, 1.55rem);
    font-weight: 750;
    line-height: 1.9;
    color: #202633;
}

    .game-question-text::after {
        content: "";
        position: absolute;
        bottom: 0;
        right: 0;
        width: 4rem;
        height: 0.22rem;
        border-radius: 999rem;
        background: linear-gradient( 90deg, #6f42c1, #0d6efd );
    }


/* =========================================================
   CHOICES
   ========================================================= */

.game-choices {
    display: grid;
    gap: 0.9rem;
}

.game-choice {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 1.2rem;
    padding: 1rem 1.2rem;
    background: #fff;
    display: flex;
    align-items: center;
    gap: 1rem;
    text-align: right;
    cursor: pointer;
    opacity: 0;
    animation: gameChoiceEnter 0.45s cubic-bezier(.22,.61,.36,1) forwards;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

    .game-choice:hover {
        transform: translateX(-0.35rem);
        border-color: rgba(111,66,193,0.45);
        background: #fcfbff;
        box-shadow: 0 0.6rem 1.8rem rgba(111,66,193,0.08);
    }

    .game-choice:active {
        transform: translateX(-0.2rem) scale(0.985);
    }

    .game-choice:disabled {
        cursor: default;
    }

.game-choice-marker {
    width: 2.7rem;
    height: 2.7rem;
    flex: 0 0 2.7rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6f42c1;
    font-weight: 800;
    background: linear-gradient( 145deg, rgba(111,66,193,0.12), rgba(13,110,253,0.07) );
    transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.game-choice:hover .game-choice-marker {
    color: #fff;
    background: linear-gradient( 145deg, #6f42c1, #0d6efd );
    transform: scale(1.08);
}

.game-choice-text {
    flex: 1;
    min-width: 0;
    color: #303642;
    font-size: 1.02rem;
    line-height: 1.7;
}


/* =========================================================
   LOADING / ERROR / FINISH
   ========================================================= */

.game-state-card {
    position: relative;
    z-index: 1;
    max-width: 650px;
    margin: 4rem auto;
    padding: 3.5rem 2rem;
    text-align: center;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 2rem;
    box-shadow: 0 1.5rem 4rem rgba(0,0,0,0.07);
}

    .game-state-card h1,
    .game-state-card h2 {
        color: #202633;
    }

    .game-state-card p {
        color: #6c757d;
        line-height: 1.8;
    }

.game-state-icon {
    font-size: 3.5rem;
    color: #6f42c1;
}

    .game-state-icon.error {
        color: #dc3545;
    }


/* =========================================================
   FINISH
   ========================================================= */

.game-finish-card {
    animation: gameFinishCard 0.6s cubic-bezier(.22,.61,.36,1);
}

.game-finish-icon {
    width: 6rem;
    height: 6rem;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.8rem;
    animation: gameFinishIcon 0.7s cubic-bezier(.34,1.56,.64,1);
}

    .game-finish-icon.success {
        color: #198754;
        background: #eaf8f0;
    }

    .game-finish-icon.time {
        color: #dc3545;
        background: #fff0f2;
    }

.game-finish-progress {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    color: #6c757d;
}

    .game-finish-progress strong {
        color: #202633;
        font-size: 1.4rem;
    }


/* =========================================================
   GENERAL ANIMATION CLASSES
   ========================================================= */

.game-fade-in {
    animation: gameFadeIn 0.6s ease-out both;
}

.game-question-enter {
    animation: gameQuestionEnter 0.5s cubic-bezier(.22,.61,.36,1);
}


/* =========================================================
   KEYFRAMES
   ========================================================= */

@keyframes gameFadeIn {

    from {
        opacity: 0;
        transform: translateY(1.2rem);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


@keyframes gameTrophyEnter {

    from {
        opacity: 0;
        transform: translateY(-2rem) scale(0.5) rotate(-12deg);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0);
    }
}


@keyframes gameTrophyFloat {

    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-0.45rem);
    }
}


@keyframes gameTitleEnter {

    from {
        opacity: 0;
        transform: translateY(1.3rem);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


@keyframes gameInfoEnter {

    from {
        opacity: 0;
        transform: translateY(1rem) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


@keyframes gameButtonEnter {

    from {
        opacity: 0;
        transform: translateY(1.5rem) scale(0.94);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


@keyframes gameButtonGradient {

    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}


@keyframes gameButtonShine {

    0% {
        left: -100%;
    }

    45% {
        left: -100%;
    }

    70% {
        left: 150%;
    }

    100% {
        left: 150%;
    }
}


@keyframes gameBlobOne {

    from {
        transform: translate(0,0) scale(1);
    }

    to {
        transform: translate(-3rem,2rem) scale(1.15);
    }
}


@keyframes gameBlobTwo {

    from {
        transform: translate(0,0) scale(1);
    }

    to {
        transform: translate(3rem,-2rem) scale(1.12);
    }
}


@keyframes gameTopEnter {

    from {
        opacity: 0;
        transform: translateY(-1rem);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


@keyframes gameQuestionEnter {

    from {
        opacity: 0;
        transform: translateX(2rem) scale(0.985);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}


@keyframes gameChoiceEnter {

    from {
        opacity: 0;
        transform: translateX(1.5rem);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}


@keyframes gameTimerPulse {

    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
    }
}


@keyframes gameFinishIcon {

    from {
        opacity: 0;
        transform: scale(0.3) rotate(-20deg);
    }

    to {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}


@keyframes gameFinishCard {

    from {
        opacity: 0;
        transform: translateY(1.5rem) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 650px) {

    .quiz-game-page {
        padding: 1.5rem 0.8rem 3rem;
    }

    .game-start-card {
        padding: 2.5rem 1.2rem;
        border-radius: 1.5rem;
    }

    .game-start-icon {
        width: 5rem;
        height: 5rem;
        font-size: 2.5rem;
    }

    .game-info-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.6rem;
    }

    .game-info-item {
        padding: 1rem 0.5rem;
    }

    .game-start-button {
        width: 100%;
    }

    .game-question-card {
        padding: 1.4rem;
        border-radius: 1.4rem;
    }

    .game-top-bar {
        gap: 0.5rem;
    }

    .game-question-number {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }

    .game-timer {
        min-width: 6.5rem;
        padding: 0.6rem 0.8rem;
        font-size: 1rem;
    }

    .game-choice {
        padding: 0.85rem;
    }

    .game-choice-marker {
        width: 2.3rem;
        height: 2.3rem;
        flex-basis: 2.3rem;
    }
}


/* =========================================================
   ACCESSIBILITY - REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    .game-start-icon,
    .game-start-card h1,
    .game-instructions,
    .game-info-item,
    .game-start-button,
    .game-fade-in,
    .game-question-enter,
    .game-choice,
    .game-timer-danger,
    .game-finish-icon,
    .game-finish-card,
    .quiz-game-page::before,
    .quiz-game-page::after {
        animation: none !important;
    }

    .game-choice {
        opacity: 1;
    }
}

/* ============================================================
   USER PLAY / RESULTS
   ============================================================ */

.user-play-page {
    position: relative;
}


/* ============================================================
   EMPTY / LOADING / ERROR STATE
   ============================================================ */

.user-result-state {
    width: min(100%, 700px);
    margin: 3rem auto;
    padding: 3rem 2rem;
    text-align: center;
    background: var(--app-surface);
    border-radius: 1.5rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.08);
    animation: userResultFadeIn 0.45s ease both;
}

.user-result-state-icon {
    width: 4.5rem;
    height: 4.5rem;
    margin: 0 auto 1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background: rgba(13, 110, 253, 0.1);
}

    .user-result-state-icon.error {
        background: rgba(220, 53, 69, 0.1);
    }

.user-result-state h3 {
    margin-bottom: 0.65rem;
}

.user-result-state p {
    margin: 0;
    opacity: 0.7;
}


/* ============================================================
   GAME SELECTOR
   ============================================================ */

.user-result-game-selector {
    max-width: 600px;
    margin-bottom: 1.5rem;
}


/* ============================================================
   GAME HEADER
   ============================================================ */

.user-result-game-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.25rem 1.5rem;
    background: var(--app-surface);
    border-radius: 1.25rem;
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.06);
    animation: userResultFadeIn 0.45s ease both;
}

.user-result-game-icon {
    width: 4rem;
    height: 4rem;
    flex: 0 0 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 1.15rem;
    font-size: 1.8rem;
    background: linear-gradient( 135deg, rgba(255, 193, 7, 0.22), rgba(255, 193, 7, 0.07) );
}

.user-result-game-header h2 {
    margin: 0 0 0.25rem;
}

.user-result-game-header span {
    opacity: 0.65;
}


/* ============================================================
   ROUNDS
   ============================================================ */

.user-rounds-section {
    margin-bottom: 2rem;
}

.user-rounds-title {
    margin-bottom: 0.85rem;
    font-weight: 700;
}

.user-round-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0.85rem;
}

.user-round-card {
    appearance: none;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: var(--app-surface);
    border-radius: 1rem;
    padding: 1rem;
    text-align: right;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

    .user-round-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 0.75rem 1.8rem rgba(0, 0, 0, 0.08);
    }

    .user-round-card.selected {
        border-color: rgba(13, 110, 253, 0.65);
        box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.1);
    }

.user-round-number {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.7rem;
}

    .user-round-number strong {
        font-size: 1.15rem;
    }

.user-round-date {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.9rem;
    opacity: 0.7;
    margin-bottom: 0.7rem;
}

.user-round-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
}

    .user-round-status.completed {
        background: rgba(25, 135, 84, 0.1);
        color: #198754;
    }

    .user-round-status.incomplete {
        background: rgba(255, 193, 7, 0.14);
        color: #9a7300;
    }


/* ============================================================
   ROUND SUMMARY
   ============================================================ */

.user-round-summary {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: var(--app-surface);
    border-radius: 1.4rem;
    box-shadow: 0 0.6rem 2rem rgba(0, 0, 0, 0.06);
    animation: userResultFadeIn 0.4s ease both;
}

.user-round-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.3rem;
}

    .user-round-summary-header h2 {
        margin: 0 0 0.35rem;
    }

.user-round-summary-date {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    opacity: 0.65;
    font-size: 0.9rem;
}

.user-round-big-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.9rem;
    border-radius: 999px;
    font-weight: 700;
    white-space: nowrap;
}

    .user-round-big-status.completed {
        color: #198754;
        background: rgba(25, 135, 84, 0.1);
    }

    .user-round-big-status.incomplete {
        color: #9a7300;
        background: rgba(255, 193, 7, 0.15);
    }


/* ============================================================
   STATISTICS
   ============================================================ */

.user-result-statistics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.user-result-stat {
    min-height: 110px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    border-radius: 1rem;
    background: rgba(0, 0, 0, 0.025);
}

    .user-result-stat i {
        font-size: 1.25rem;
        opacity: 0.7;
    }

.user-result-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
}

.user-result-stat-label {
    font-size: 0.82rem;
    opacity: 0.65;
}

.user-incomplete-summary {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.9rem 1rem;
    border-radius: 0.85rem;
    background: rgba(255, 193, 7, 0.1);
}


/* ============================================================
   QUESTION CARDS
   ============================================================ */

.user-result-questions {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.user-result-question-card {
    padding: 1.4rem;
    background: var(--app-surface);
    border-radius: 1.35rem;
    box-shadow: 0 0.6rem 2rem rgba(0, 0, 0, 0.055);
    animation: userQuestionEnter 0.45s ease both;
}

.user-result-question-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1.2rem;
}

.user-result-question-number {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    font-weight: 800;
    background: rgba(13, 110, 253, 0.1);
}

.user-result-question-text {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.8;
}

.user-question-result {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
}

    .user-question-result.correct {
        color: #198754;
        background: rgba(25, 135, 84, 0.1);
    }

    .user-question-result.wrong {
        color: #dc3545;
        background: rgba(220, 53, 69, 0.1);
    }


/* ============================================================
   CHOICES
   ============================================================ */

.user-result-choices {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.user-result-choice {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.8rem;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(0, 0, 0, 0.07);
    border-radius: 0.9rem;
    background: rgba(0, 0, 0, 0.015);
}

.user-result-choice-marker {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.user-result-choice-text {
    line-height: 1.6;
}

.user-result-choice-labels {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.4rem;
}

.choice-label {
    padding: 0.3rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

    .choice-label.user-answer {
        background: rgba(13, 110, 253, 0.1);
    }

    .choice-label.correct-answer {
        color: #198754;
        background: rgba(25, 135, 84, 0.1);
    }


/* ============================================================
   CORRECT / WRONG CHOICE
   ============================================================ */

.user-result-choice.user-choice-correct {
    border-color: rgba(25, 135, 84, 0.45);
    background: rgba(25, 135, 84, 0.07);
}

    .user-result-choice.user-choice-correct
    .user-result-choice-marker {
        color: #198754;
        background: rgba(25, 135, 84, 0.12);
    }


.user-result-choice.user-choice-wrong {
    border-color: rgba(220, 53, 69, 0.4);
    background: rgba(220, 53, 69, 0.06);
}

    .user-result-choice.user-choice-wrong
    .user-result-choice-marker {
        color: #dc3545;
        background: rgba(220, 53, 69, 0.1);
    }


.user-result-choice.correct-choice {
    border-color: rgba(25, 135, 84, 0.35);
    background: rgba(25, 135, 84, 0.045);
}

    .user-result-choice.correct-choice
    .user-result-choice-marker {
        color: #198754;
    }


/* ============================================================
   QUESTION FOOTER
   ============================================================ */

.user-result-question-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.4rem;
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 0.9rem;
}

    .user-result-question-footer strong {
        font-size: 1rem;
    }


/* ============================================================
   ANIMATIONS
   ============================================================ */

@keyframes userResultFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes userQuestionEnter {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.99);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 700px) {

    .user-result-statistics {
        grid-template-columns: repeat(2, 1fr);
    }

    .user-round-summary-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .user-result-question-header {
        grid-template-columns: auto 1fr;
    }

    .user-question-result {
        grid-column: 1 / -1;
        width: fit-content;
    }

    .user-result-choice {
        grid-template-columns: auto 1fr;
    }

    .user-result-choice-labels {
        grid-column: 1 / -1;
        justify-content: flex-start;
        padding-right: 2.8rem;
    }
}