/* Profile panel — responsive RTL layout */
body.profile-panel-page,
html.profile-panel-page {
    background: var(--surface-page);
}

.profile-header {
    direction: rtl;
    background: var(--surface-card);
    box-shadow: var(--shadow-header);
}

.profile-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    max-width: 90rem;
    margin: 0 auto;
    padding-block: clamp(1rem, 2.5vw, 1.5rem);
    padding-inline: clamp(1rem, 6vw, 7.5rem);
}

.profile-header__brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.profile-header__menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--surface-card);
    color: var(--text-heading);
    cursor: pointer;
}

.profile-header__menu-icon,
.profile-header__menu-icon::before,
.profile-header__menu-icon::after {
    display: block;
    width: 1.125rem;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
    transition: transform 0.2s ease, top 0.2s ease, opacity 0.2s ease;
}

.profile-header__menu-icon {
    position: relative;
}

.profile-header__menu-icon::before,
.profile-header__menu-icon::after {
    content: "";
    position: absolute;
    inset-inline-start: 0;
}

.profile-header__menu-icon::before {
    top: -0.375rem;
}

.profile-header__menu-icon::after {
    top: 0.375rem;
}

body.profile-sidebar-open .profile-header__menu-icon {
    background: transparent;
}

body.profile-sidebar-open .profile-header__menu-icon::before {
    top: 0;
    transform: rotate(45deg);
}

body.profile-sidebar-open .profile-header__menu-icon::after {
    top: 0;
    transform: rotate(-45deg);
}

.profile-header__logo img {
    height: clamp(2.5rem, 5vw, 3.5rem);
    width: auto;
}

.profile-header__phone {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: var(--text-on-primary) !important;
    font-size: clamp(0.875rem, 1.6vw, 1.125rem);
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
    text-decoration: none !important;
}

.profile-header__phone:hover {
    color: var(--text-on-primary) !important;
    background: var(--primary-hover);
}

.profile-header__actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.625rem;
    margin-inline-start: auto;
}

.profile-header__admin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--secondary-50);
    color: var(--secondary-700) !important;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
    text-decoration: none !important;
}

.profile-header__admin:hover {
    background: var(--secondary-100);
    color: var(--secondary-800) !important;
}

.profile-header__logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1rem;
    border: 1px solid var(--danger);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--danger) !important;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
    text-decoration: none !important;
    transition: background 0.15s ease, color 0.15s ease;
}

.profile-header__logout:hover {
    background: #FDEDED;
    color: var(--danger) !important;
}

.profile-header__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-heading) !important;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none !important;
}

.profile-header__link:hover {
    background: var(--surface-muted);
}

.profile-header--guest .profile-header__inner {
    justify-content: space-between;
}

.profile-shell {
    direction: rtl;
    font-family: var(--font-family);
    width: 100%;
    max-width: 90rem;
    margin: 0 auto;
    padding-block: clamp(1rem, 3vw, 2rem);
    padding-inline: clamp(1rem, 6vw, 7.5rem);
}

.profile-shell__body {
    display: grid;
    grid-template-columns: minmax(11rem, 15rem) minmax(0, 1fr);
    gap: clamp(1rem, 2vw, 1.5rem);
    align-items: start;
}

.profile-shell__content {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    min-width: 0;
}

/* Toolbar: name (inline-end) · credits (center) · institute (inline-start) */
.profile-toolbar-card {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    padding: 1rem;
    background: var(--surface-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

.profile-toolbar-card__user {
    flex: 1 1 12rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem clamp(1rem, 4vw, 3rem);
    color: var(--text-heading);
    font-size: clamp(0.875rem, 1.5vw, 1rem);
    font-weight: 400;
    line-height: 1.75;
    min-width: 0;
}

.profile-toolbar-card__user > strong {
    color: var(--text-heading);
    font-size: inherit;
    font-weight: 400;
    white-space: nowrap;
}

.profile-toolbar-card__credits {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem clamp(1rem, 3vw, 2.5rem);
}

.profile-toolbar-card__credits span strong,
.profile-toolbar-card__extra strong {
    color: var(--text-heading);
    font-weight: 400;
}

.profile-toolbar-card__institute {
    flex: 0 1 auto;
    margin-inline-start: auto;
}

.profile-toolbar-card__institute select {
    width: 100%;
    min-width: min(100%, 15.25rem);
    height: 3rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    padding: 0.375rem 1rem;
    font-size: 1rem;
    color: var(--neutral-400);
    background: var(--surface-card);
}

.profile-toolbar-card__national-wrap {
    position: relative;
    display: inline-block;
}

#missingNationalCode {
    color: var(--danger);
    cursor: pointer;
    animation: profilePulse 1.5s infinite;
}

@keyframes profilePulse {
    0% { opacity: 1; }
    50% { opacity: 0.35; }
    100% { opacity: 1; }
}

.profile-national-tooltip {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    inset-inline-start: 50%;
    transform: translateX(-50%);
    z-index: 30;
    min-width: 15rem;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    background: var(--secondary-900);
    color: #fff;
    box-shadow: var(--shadow-card);
}

.profile-national-tooltip.is-visible {
    display: block;
}

.profile-national-tooltip input {
    width: 100%;
    margin: 0.5rem 0;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
}

.profile-national-tooltip button {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--secondary);
    color: #fff;
    cursor: pointer;
}

.profile-national-tooltip__error {
    display: none;
    margin: 0.5rem 0 0;
    color: #fca5a5;
    font-size: 0.8125rem;
}

.profile-content-card {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    border: none;
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.profile-content-card__body {
    padding: clamp(1rem, 2.5vw, 1.5rem);
}

.profile-content-card__body--calendar {
    padding: clamp(1rem, 2.5vw, 1.5rem);
}

.profile-sidebar {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    border: none;
    box-shadow: var(--shadow-sidebar);
    padding: 0.75rem;
    position: sticky;
    top: 1rem;
}

.profile-sidebar__nav {
    list-style: none;
    margin: 0;
    padding: 0;
}

.profile-sidebar__item {
    margin: 0;
}

.profile-sidebar__link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.5rem;
    border-radius: var(--radius-sm);
    color: var(--text-primary) !important;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.75;
    text-decoration: none !important;
    transition: background 0.15s ease;
}

.profile-sidebar__link > span {
    flex: 1;
    text-align: right;
    min-width: 0;
}

.profile-sidebar__link > i:first-child {
    flex-shrink: 0;
    width: 1.25rem;
    text-align: center;
    color: var(--text-primary);
    font-size: 1rem;
}

.profile-sidebar__link:hover {
    background: var(--surface-muted);
}

.profile-sidebar__item.is-active .profile-sidebar__link {
    background: var(--surface-muted);
    color: var(--neutral-1000) !important;
}

.profile-sidebar__item.is-active .profile-sidebar__link > i:first-child {
    color: var(--neutral-1000);
}

.profile-sidebar__logout {
    margin-top: 0.25rem;
    padding-top: 0.25rem;
    border-top: 1px solid var(--surface-muted);
}

.profile-sidebar__logout .profile-sidebar__link {
    color: var(--danger) !important;
}

.profile-sidebar__logout .profile-sidebar__link > i:first-child {
    color: var(--danger);
}

.profile-sidebar__logout .profile-sidebar__link:hover {
    background: var(--surface-muted);
}

.profile-sidebar__chevron {
    flex-shrink: 0;
    font-size: 0.6875rem;
    color: var(--secondary-600);
}

.profile-sidebar__item--group.is-expanded > .profile-sidebar__link {
    background: var(--surface-muted);
    color: var(--neutral-1000) !important;
}

.profile-sidebar__item--group.is-expanded > .profile-sidebar__link > i:first-child {
    color: var(--neutral-1000);
}

.profile-sidebar__subnav {
    list-style: none;
    margin: 0.25rem 0 0.5rem;
    padding: 0 0.5rem 0 0;
}

.profile-sidebar__subitem {
    margin: 0;
}

.profile-sidebar__sublink {
    display: block;
    padding: 0.625rem 0.75rem 0.625rem 2rem;
    border-radius: var(--radius-sm);
    color: var(--text-primary) !important;
    font-size: 0.8125rem;
    font-weight: 400;
    line-height: 1.6;
    text-decoration: none !important;
    transition: background 0.15s ease;
}

.profile-sidebar__sublink:hover {
    background: var(--surface-muted);
}

.profile-sidebar__subitem.is-active .profile-sidebar__sublink {
    background: var(--surface-muted);
    color: var(--neutral-1000) !important;
    font-weight: 500;
}

.profile-sidebar-backdrop {
    display: none;
}

@media (max-width: 991px) {
    body.profile-panel-page .profile-header__menu-toggle {
        display: inline-flex;
    }

    .profile-shell__body {
        grid-template-columns: 1fr;
    }

    .profile-sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1090;
        background: rgba(1, 23, 37, 0.45);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, visibility 0.25s ease;
    }

    body.profile-sidebar-open .profile-sidebar-backdrop {
        opacity: 1;
        visibility: visible;
    }

    .profile-sidebar {
        position: fixed;
        inset-block: 0;
        inset-inline-start: 0;
        z-index: 1100;
        width: min(18rem, 86vw);
        max-height: 100dvh;
        margin: 0;
        border-radius: 0;
        overflow-y: auto;
        transform: translateX(100%);
        transition: transform 0.25s ease;
        top: 0;
    }

    body.profile-sidebar-open .profile-sidebar {
        transform: translateX(0);
    }

    .profile-sidebar__nav {
        display: block;
    }

    .profile-sidebar__link {
        padding: 0.75rem 0.625rem;
        font-size: 0.875rem;
    }

    .profile-sidebar__logout {
        border-top: 1px solid var(--surface-muted);
        margin-top: 0.25rem;
        padding-top: 0.25rem;
    }

    .profile-toolbar-card {
        flex-direction: column;
        align-items: stretch;
    }

    .profile-toolbar-card__institute {
        margin-inline-start: 0;
        width: 100%;
    }

    .profile-toolbar-card__institute select {
        min-width: 0;
    }

    .profile-toolbar-card__user {
        flex-direction: column;
        align-items: flex-start;
    }

    .profile-header__actions {
        width: 100%;
        justify-content: flex-end;
    }

    .profile-header__phone,
    .profile-header__admin,
    .profile-header__logout {
        font-size: 0.8125rem;
        padding: 0.5625rem 0.875rem;
    }
}
/* Profile / Courses — course cards (inner content only) */
.course-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 18.5rem), 1fr));
    gap: clamp(1rem, 2.5vw, 1.5rem);
    direction: rtl;
}

.course-cards__empty {
    margin: 0;
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 1rem;
}

.course-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: visible;
}

.course-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--secondary-50);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.course-card__logo {
    height: clamp(2rem, 5vw, 2.75rem);
    width: auto;
    object-fit: contain;
}

.course-card__menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--secondary-600);
    font-size: 1.125rem;
    cursor: pointer;
    flex-shrink: 0;
}

    .course-card__menu-btn:hover,
    .course-card__menu-btn[aria-expanded="true"] {
        background: var(--secondary-100);
        color: var(--secondary-700);
    }

.course-card__body {
    flex: 1;
    padding: 1rem 1.25rem 0.75rem;
}

.course-card__title {
    margin: 0 0 1rem;
    font-size: clamp(0.9375rem, 2vw, 1.0625rem);
    font-weight: 700;
    line-height: 1.6;
    color: var(--text-heading);
    text-align: right;
}

.course-card__meta {
    margin: 0;
    padding: 0;
}

.course-card__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    padding-block: 0.375rem;
}

    .course-card__row dt {
        margin: 0;
        flex-shrink: 0;
        font-size: 0.875rem;
        font-weight: 400;
        line-height: 1.6;
        color: var(--neutral-400);
        text-align: right;
    }

    .course-card__row dd {
        margin: 0;
        min-width: 0;
        font-size: 0.875rem;
        font-weight: 400;
        line-height: 1.6;
        color: var(--text-heading);
        text-align: left;
        direction: rtl;
    }

        .course-card__row dd.is-muted {
            color: var(--neutral-400);
        }

.course-card__foot {
    padding: 0.75rem 1.25rem 1.25rem;
}

.course-card__sessions-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 2.75rem;
    padding: 0.625rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: var(--text-on-primary);
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease;
}

    .course-card__sessions-btn:hover:not(:disabled) {
        background: var(--primary-hover);
        color: var(--text-on-primary);
    }

    .course-card__sessions-btn:disabled {
        background: var(--neutral-200);
        color: var(--neutral-500);
        cursor: not-allowed;
    }

.course-card__menu-wrap {
    position: relative;
    flex-shrink: 0;
}

.course-card__menu {
    position: absolute;
    top: calc(100% + 0.25rem);
    inset-inline-end: 0;
    z-index: 30;
    min-width: 11.5rem;
    padding: 0.375rem;
    background: var(--surface-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

    .course-card__menu[hidden] {
        display: none;
    }

.course-card__menu-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.625rem;
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-heading);
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    text-align: right;
    cursor: pointer;
    text-decoration: none;
}

    .course-card__menu-item span {
        flex: 1;
        text-align: right;
    }

    .course-card__menu-item:hover {
        background: var(--surface-muted);
    }

    .course-card__menu-item i {
        width: 1.125rem;
        text-align: center;
        color: var(--secondary-600);
        font-size: 0.9375rem;
        flex-shrink: 0;
    }

/* Session modal helpers (legacy) */
.fontp {
    font-size: 13px;
}

.titlefont {
    font-size: 18px;
}

.btnmargine {
    margin-inline-start: 0;
}

.cardstyle {
    box-shadow: var(--shadow-card);
    border-radius: var(--radius-sm);
}

.backcolor {
    background-color: var(--secondary-600);
    border-radius: var(--radius-sm);
}

#chat3 .form-control {
    border-color: transparent;
}

    #chat3 .form-control:focus {
        border-color: transparent;
        box-shadow: inset 0 0 0 1px transparent;
    }

.badge-dot {
    border-radius: 50%;
    height: 10px;
    width: 10px;
    margin-inline-start: 2.9rem;
    margin-top: -0.75rem;
}

@media (max-width: 575px) {
    .course-card__row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.125rem;
    }

        .course-card__row dd {
            text-align: right;
        }
}
