/**
 * MarkMatrix — SIMATS student portal theme (Metronic darkblue + portlet colors)
 * Matched to arms.sse.saveetha.com MyCourse.aspx reference
 */

/* —— Theme tokens (darkblue.css / Metronic) —— */
:root {
    --header-bg: #2b3643;
    --header-bg-top: #364150;
    --sidebar-bg: #364150;
    --sidebar-hover: #3e4b5c;
    --page-content-bg: #eff3f8;
    --text-dark: #333333;
    --text-muted: #737373;
    --link-color: #337ab7;

    /* Portlet box colors */
    --portlet-green: #35aa47;
    --portlet-green-border: #35aa47;
    --portlet-red-intense: #e35b5a;
    --portlet-purple-soft: #8877a9;
    --portlet-blue: #4b8df8;

    /* Badges (portal JS: badge-success / badge-danger) */
    --badge-success-bg: #45b6af;
    --badge-danger-bg: #f3565d;

    --navbar-height: 50px;
    --modal-top-gap: 20px;
}

html, body {
    height: 100%;
}

body.page-header-fixed {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#dashboard-view {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

body {
    font-family: "Open Sans", sans-serif;
    font-size: 13px;
    color: var(--text-dark);
}

.hidden {
    display: none !important;
}

/* —— Login page (Login.aspx + login.css / edubg) —— */
body.login {
    background: url("/img/edubg.jpg") no-repeat center center fixed;
    background-size: cover;
    min-height: 100vh;
}

#login-view-container {
    min-height: 100vh;
    position: relative;
}

body.login .login-content.content {
    width: 360px;
    margin: 120px auto 0;
    padding: 20px 30px 30px;
    background: rgba(255, 255, 255, 0.6) !important;
    border-radius: 4px;
}

body.login .logo {
    text-align: center;
    margin: 0 auto 15px;
    padding: 15px 0 10px;
}

body.login .logo img {
    max-width: 200px;
    height: auto;
}

.app-brand-name {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0.06em;
    margin: 0 0 4px;
    background: linear-gradient(120deg, #0f82cf 0%, #35aa47 55%, #8877a9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-tagline {
    text-align: center;
    font-size: 12px;
    color: #555;
    margin: 0 0 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

body.login .form-title {
    color: #0f82cf !important;
    text-align: center;
    font-size: 20px;
    font-weight: 400 !important;
    margin-bottom: 20px;
}

.page-title small {
    color: #35aa47;
    font-weight: 600;
}

body.login .content .form-control {
    background-color: #ede1d1 !important;
    border: 1px solid #e5e5e5;
    height: 43px;
    border-radius: 0;
}

body.login .content .form-control:focus {
    border-color: #0f82cf;
    box-shadow: none;
}

body.login .form-actions {
    margin-top: 10px;
    border: 0;
    padding: 0;
}

body.login .btn-success.uppercase {
    width: 100%;
    letter-spacing: 0.05em;
    font-weight: 600;
    padding: 10px 16px;
}

body.login .copyright {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 10px 15px;
    color: #fff !important;
    font-size: 12px;
    z-index: 1;
}

body.login .copyright a {
    color: #fff;
    text-decoration: underline;
}

.alert.display-hide:not(.hidden) {
    display: block !important;
}

.alert.display-hide.hidden {
    display: none !important;
}

.page-logo .logo-default {
    height: 35px;
    width: auto;
    max-width: 160px;
    padding-bottom: 1px;
    margin-top: 8px;
}

.loader {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* —— Fixed header (page-header navbar) —— */
.page-header.navbar {
    background-color: var(--header-bg);
    border: 0;
    margin: 0;
    min-height: 50px;
    z-index: 9995;
}

.page-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    min-height: 50px;
}

.header-start {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1 1 auto;
}

.page-logo {
    display: block;
    min-width: 0;
}

.logo-default-text {
    color: #fff !important;
    font-size: 18px;
    font-weight: 700;
    text-decoration: none !important;
    line-height: 50px;
    display: inline-block;
}

.logo-default-text span {
    font-weight: 400;
    font-size: 14px;
    opacity: 0.9;
}

.top-menu {
    flex-shrink: 0;
}

.top-menu .nav {
    margin: 0;
    list-style: none;
    display: flex;
    align-items: center;
}

.top-menu .nav > li > a {
    padding: 16px 12px 14px;
    color: #c6cfda !important;
    text-decoration: none;
}

.top-menu .nav > li > a:hover {
    background: rgba(255, 255, 255, 0.05);
}

.top-menu .badge-default {
    background-color: #1caf9a;
    color: #fff;
    font-size: 10px;
    padding: 2px 5px;
    position: relative;
    top: -8px;
    left: -6px;
}

.top-menu .img-circle {
    width: 29px;
    height: 29px;
    margin-right: 6px;
    vertical-align: middle;
}

.top-menu .username {
    color: #c6cfda;
    font-size: 13px;
}

.nav-user-block {
    pointer-events: none;
}

.nav-user-link {
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 10px 12px !important;
    cursor: default;
}

.top-menu .nav > li.nav-user-block > .nav-user-link:hover {
    background: transparent !important;
}

/* Prevent theme/Bootstrap empty profile dropdown panel on click */
.dropdown-user .dropdown-menu,
.nav-user-block .dropdown-menu {
    display: none !important;
}

.nav-user-avatar {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    object-fit: cover;
    object-position: center top;
    border: 2px solid rgba(255, 255, 255, 0.85);
    background: #e8e8e8;
}

.nav-user-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.25;
    text-align: left;
}

.nav-user-name {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-user-reg {
    color: #a8b4c4;
    font-size: 11px;
    font-weight: 400;
}

.marks-bg-banner {
    margin-bottom: 12px;
    padding: 10px 14px;
    font-size: 13px;
}

.marks-bg-banner .fa {
    margin-right: 8px;
}

/* Simple line icons substitute via Font Awesome mapping */
.icon-bell::before { content: "\f0f3"; font-family: FontAwesome; font-style: normal; }
.icon-envelope-open::before { content: "\f2b6"; font-family: FontAwesome; font-style: normal; }
.icon-logout::before { content: "\f08b"; font-family: FontAwesome; font-style: normal; }
.icon-graduation::before { content: "\f19d"; font-family: FontAwesome; font-style: normal; }
.icon-calculator::before { content: "\f1ec"; font-family: FontAwesome; font-style: normal; }

/* —— Page layout —— */
.page-container {
    margin-top: 50px;
    display: flex;
    min-height: calc(100vh - 50px);
}

.page-sidebar-wrapper {
    width: 235px;
    flex-shrink: 0;
}

.page-sidebar {
    background-color: var(--sidebar-bg);
    min-height: 100%;
    width: 235px;
}

.page-sidebar-menu {
    list-style: none;
    padding: 18px 0 0;
    margin: 0;
}

.page-sidebar-menu > li > a {
    display: block;
    padding: 12px 15px 12px 18px;
    color: #b4bcc8;
    text-decoration: none;
    border-top: 1px solid #3d4957;
}

.page-sidebar-menu > li:first-child > a {
    border-top: none;
}

.page-sidebar-menu > li > a i {
    margin-right: 8px;
    width: 18px;
    display: inline-block;
}

.page-sidebar-menu > li.active > a,
.page-sidebar-menu > li > a:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.page-sidebar-menu > li.active > a {
    border-left: 3px solid #1caf9a;
    padding-left: 15px;
}

.page-content-wrapper {
    flex: 1;
    min-width: 0; /* allow inner horizontal scroll on mobile flex layout */
    background: var(--page-content-bg);
    overflow-x: hidden;
    max-width: 100%;
}

.page-content {
    padding: 15px 20px 30px;
    background-color: var(--page-content-bg);
    min-width: 0;
    max-width: 100%;
}

.page-title {
    font-size: 22px;
    font-weight: 400;
    color: #666;
    margin: 0;
    padding: 0;
}

.page-title small {
    color: #999;
    font-size: 13px;
}

/* —— Portlets (exact Metronic box colors) —— */
.view-panel {
    text-align: left;
    overflow: visible;
    min-width: 0;
    max-width: 100%;
}

.portlet {
    margin-bottom: 25px;
    clear: both;
    overflow: visible;
}

.portlet.box {
    border: 1px solid var(--portlet-green-border);
    border-radius: 4px;
    overflow: visible;
    background: #fff;
}

.portlet.box > .portlet-title {
    border-radius: 4px 4px 0 0;
    padding: 12px 15px;
    min-height: 44px;
    overflow: visible;
    position: relative;
    z-index: 1;
}

.portlet.box > .portlet-title::after {
    content: "";
    display: table;
    clear: both;
}

.portlet.box.green {
    border-color: var(--portlet-green-border);
}

.portlet.box.green > .portlet-title {
    background-color: var(--portlet-green);
    border-bottom: 1px solid var(--portlet-green);
    border-radius: 3px 3px 0 0;
}

#mycourse-section .form-group,
#cgpa-section .form-group {
    overflow: visible;
    min-width: 0;
    max-width: 100%;
}

#mycourse-section .portlet-body,
#cgpa-section .portlet-body {
    min-width: 0;
    max-width: 100%;
}

.portlet.box.purple-soft {
    border-color: var(--portlet-purple-soft);
}

.portlet.box.purple-soft > .portlet-title {
    background-color: var(--portlet-purple-soft);
    border-bottom: 1px solid var(--portlet-purple-soft);
}

.portlet.box.red-intense > .portlet-title {
    background-color: var(--portlet-red-intense);
    border-bottom: 1px solid var(--portlet-red-intense);
}

.portlet.box.purple-soft > .portlet-title {
    background-color: var(--portlet-purple-soft);
    border-bottom: 1px solid var(--portlet-purple-soft);
}

.portlet.box.blue > .portlet-title {
    background-color: var(--portlet-blue);
    border-bottom: 1px solid var(--portlet-blue);
}

.portlet-title > .caption {
    float: left;
    display: inline-block;
    font-size: 14px;
    line-height: 18px;
    color: #fff;
    font-weight: 600;
}

.portlet-title > .caption > i {
    margin-right: 8px;
    font-size: 15px;
}

.portlet-title > .caption > .caption-subject {
    font-size: 13px;
    font-weight: 600;
}

.portlet-title > .tools {
    float: right;
    display: inline-block;
    padding: 0;
}

.portlet-title > .tools > a {
    color: #fff;
    font-size: 14px;
    text-decoration: none;
}

.portlet-title > .tools > a.collapse::before {
    content: "\f078";
    font-family: FontAwesome;
}

.portlet-body {
    background: #fff;
    padding: 15px;
    border-radius: 0 0 4px 4px;
}

/* —— Tables (DataTables bootstrap style) —— */
.table-bordered {
    border: 1px solid #e7ecf1;
}

.table-bordered > thead > tr > th {
    background-color: #f5f8fa;
    border-bottom: 2px solid #e7ecf1;
    color: #333;
    font-weight: 600;
    font-size: 13px;
    padding: 10px 12px;
}

.table-striped > tbody > tr:nth-of-type(odd) {
    background-color: #fbfcfd;
}

.table-hover > tbody > tr:hover {
    background-color: #f5f9fc;
}

.table > tbody > tr > td {
    padding: 10px 12px;
    vertical-align: middle;
    border-color: #e7ecf1;
    font-size: 13px;
}

/* Courses table — horizontal scroll on narrow screens */
.courses-table-wrap,
.cgpa-table-wrap,
.marks-detail-table-wrap {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    touch-action: auto;
    position: relative;
    isolation: isolate;
    scrollbar-width: thin;
    scrollbar-color: #aab4c0 transparent;
}

.courses-table-wrap {
    margin-bottom: 4px;
}

.courses-table-scroll-hint {
    display: none;
    font-size: 11px;
    color: #737373;
    text-align: right;
    margin: 0 0 6px;
    padding: 0 2px;
}

.courses-table-wrap.can-scroll-x + .courses-table-scroll-hint,
.cgpa-table-wrap.can-scroll-x + .courses-table-scroll-hint {
    display: block;
}

.courses-table-wrap::after,
.cgpa-table-wrap::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 20px;
    pointer-events: none;
    background: linear-gradient(to left, rgba(255, 255, 255, 0.98), transparent);
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 1;
}

.courses-table-wrap.can-scroll-x::after,
.cgpa-table-wrap.can-scroll-x::after {
    opacity: 1;
}

#courses-table,
#cgpa-table {
    width: auto;
    min-width: 720px;
    margin-bottom: 0;
    table-layout: auto;
    border-collapse: collapse;
}

#cgpa-table {
    min-width: 640px;
}

#courses-table thead,
#courses-table tbody,
#courses-table tfoot,
#cgpa-table thead,
#cgpa-table tbody,
#cgpa-table tfoot {
    display: table-row-group;
}

#courses-table tr,
#cgpa-table tr {
    display: table-row;
}

#courses-table th,
#courses-table td,
#cgpa-table th,
#cgpa-table td {
    display: table-cell;
    white-space: nowrap;
    vertical-align: middle;
}

#courses-table td:nth-child(3) {
    white-space: normal;
    min-width: 160px;
    max-width: 240px;
    word-break: break-word;
}

#courses-table td:nth-child(7),
#courses-table th:last-child {
    text-align: center;
}

/* Large screens — table stretches to full content width */
@media (min-width: 992px) {
    #mycourse-section,
    #cgpa-section,
    #mycourse-section .portlet,
    #cgpa-section .portlet,
    #mycourse-section .portlet.box,
    #cgpa-section .portlet.box,
    #mycourse-section .portlet-body,
    #cgpa-section .portlet-body {
        width: 100%;
        max-width: none;
    }

    .courses-table-wrap,
    .cgpa-table-wrap {
        width: 100%;
        max-width: none;
        overflow-x: visible;
    }

    #courses-table,
    #cgpa-table {
        width: 100%;
        min-width: 100%;
        table-layout: fixed;
    }

    #courses-table th:nth-child(1),
    #courses-table td:nth-child(1) {
        width: 5%;
    }

    #courses-table th:nth-child(2),
    #courses-table td:nth-child(2) {
        width: 11%;
    }

    #courses-table th:nth-child(3),
    #courses-table td:nth-child(3) {
        width: 32%;
        max-width: none;
    }

    #courses-table th:nth-child(4),
    #courses-table td:nth-child(4) {
        width: 8%;
    }

    #courses-table th:nth-child(5),
    #courses-table td:nth-child(5) {
        width: 10%;
    }

    #courses-table th:nth-child(6),
    #courses-table td:nth-child(6) {
        width: 18%;
    }

    #courses-table th:nth-child(7),
    #courses-table td:nth-child(7) {
        width: 16%;
    }

    #cgpa-table th:nth-child(1),
    #cgpa-table td:nth-child(1) {
        width: 6%;
    }

    #cgpa-table th:nth-child(2),
    #cgpa-table td:nth-child(2) {
        width: 12%;
    }

    #cgpa-table th:nth-child(3),
    #cgpa-table td:nth-child(3) {
        width: 34%;
    }

    #cgpa-table th:nth-child(4),
    #cgpa-table td:nth-child(4) {
        width: 10%;
    }

    #cgpa-table th:nth-child(5),
    #cgpa-table td:nth-child(5) {
        width: 14%;
    }

    #cgpa-table th:nth-child(6),
    #cgpa-table td:nth-child(6) {
        width: 12%;
    }

    .courses-table-wrap.can-scroll-x::after,
    .cgpa-table-wrap.can-scroll-x::after {
        opacity: 0;
    }
}

#marks-detail-table {
    width: auto;
    min-width: 480px;
    margin-bottom: 0;
}

/* Sortable table headers */
th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

th.sortable:hover {
    background-color: #eef2f6 !important;
}

th.sortable .sort-icon {
    margin-left: 4px;
    font-size: 11px;
    color: #999;
}

th.sortable.sort-asc .sort-icon,
th.sortable.sort-desc .sort-icon {
    color: #35aa47;
}

/* Course links like portal labels */
label.course-link {
    color: var(--link-color);
    font-weight: 600;
    cursor: pointer;
    margin: 0;
    font-size: 13px;
}

label.course-link:hover {
    color: #23527c;
    text-decoration: underline;
}

/* Badges — exact portal markup (BindCompletedSubject) */
.badge {
    display: inline-block;
    min-width: 10px;
    padding: 3px 7px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    vertical-align: middle;
    white-space: nowrap;
    text-align: center;
    border-radius: 12px;
}

.badge-success {
    background-color: var(--badge-success-bg);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
}

.badge-danger {
    background-color: var(--badge-danger-bg);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
}

.btn-view-marks {
    color: var(--link-color);
    background: none;
    border: none;
    padding: 0;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
}

.btn-view-marks:hover {
    text-decoration: underline;
}

/* Loading */
.loading-block {
    padding: 40px 20px;
    background: #fff;
    border: 1px solid #e7ecf1;
    margin-bottom: 20px;
}

.loading-block p {
    color: #666;
    margin-top: 12px;
}

.loading-spin {
    animation: spin 1s linear infinite;
}

/* Footer */
.page-footer {
    padding: 8px 20px;
    font-size: 12px;
    color: #98a6ba;
    background: #fff;
    border-top: 1px solid #e7ecf1;
    clear: both;
}

.page-footer-inner {
    padding-left: 235px;
}

/* Modal mark totals */
.marks-total-banner {
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
    border: 1px solid #c8e6c9;
    border-radius: 4px;
    padding: 14px 18px;
    margin-bottom: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    align-items: center;
    justify-content: space-between;
}

.marks-total-banner .total-block {
    flex: 1 1 140px;
    min-width: 120px;
}

.marks-total-banner .total-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #666;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.marks-total-banner .total-value {
    font-size: 22px;
    font-weight: 700;
    color: #35aa47;
    line-height: 1.2;
}

.marks-total-banner .total-value--secondary {
    font-size: 16px;
    color: #2b3643;
}

.marks-total-row td {
    background: #f5f8fa !important;
    font-size: 14px;
}

/* CGPA calculator */
.cgpa-summary-cards {
    margin-bottom: 18px;
}

.cgpa-stat-card {
    background: #f5f8fa;
    border: 1px solid #e7ecf1;
    border-radius: 4px;
    padding: 16px;
    text-align: center;
    margin-bottom: 12px;
    height: 100%;
}

.cgpa-stat-card--primary {
    background: linear-gradient(135deg, #f3eef8 0%, #faf8fc 100%);
    border-color: #d4c8e4;
}

.cgpa-stat-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #888;
    font-weight: 600;
    margin-bottom: 6px;
}

.cgpa-stat-value {
    display: block;
    font-size: 36px;
    font-weight: 700;
    color: var(--portlet-purple-soft);
    line-height: 1.1;
}

.cgpa-stat-value--sm {
    font-size: 28px;
    color: #35aa47;
}

.cgpa-stat-sub {
    font-size: 12px;
    color: #999;
}

.cgpa-hint {
    font-size: 12px;
    margin-bottom: 14px;
}

.cgpa-foot-row td {
    background: #f3eef8 !important;
}

#cgpa-table .grade-point-cell {
    font-weight: 700;
    color: #8877a9;
}

#cgpa-table tr.cgpa-row-excluded td {
    background-color: #fafafa;
    color: #999;
}

#cgpa-table tr.cgpa-row-excluded .grade-point-cell {
    color: #c0392b;
    font-weight: 600;
}

.page-heading-row {
    padding-top: 10px;
    margin-bottom: 4px;
}

.page-actions {
    padding-top: 8px;
    padding-bottom: 8px;
}

/* Mobile sidebar */
.mobile-sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #c6cfda;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.mobile-sidebar-toggle:hover,
.mobile-sidebar-toggle:focus {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    outline: none;
}

body.sidebar-mobile-open {
    overflow: hidden;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    top: 50px;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9994;
}

.sidebar-backdrop.hidden {
    display: none !important;
}

/* Modal — sit below fixed navbar with breathing room */
#detail-modal.modal {
    padding-top: calc(var(--navbar-height) + var(--modal-top-gap));
    padding-bottom: var(--modal-top-gap);
    padding-left: 12px;
    padding-right: 12px;
    overflow-y: auto;
    z-index: 10000;
}

#detail-modal.modal .modal-dialog {
    margin: 0 auto;
    width: 100%;
    max-width: 900px;
    max-height: calc(100vh - var(--navbar-height) - var(--modal-top-gap) * 2);
}

#detail-modal.modal .modal-content {
    max-height: calc(100vh - var(--navbar-height) - var(--modal-top-gap) * 2);
    display: flex;
    flex-direction: column;
}

#detail-modal.modal .modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-backdrop {
    z-index: 9999;
}

#detail-modal .well {
    margin-bottom: 15px;
    background: #f5f8fa;
    border-color: #e7ecf1;
}

@media (max-width: 991px) {
    .mobile-sidebar-toggle {
        display: inline-flex;
    }

    .page-footer-inner {
        padding-left: 0;
    }

    .page-container {
        display: block;
    }

    .page-sidebar-wrapper {
        position: fixed;
        left: 0;
        top: 50px;
        bottom: 0;
        width: 260px;
        max-width: min(85vw, 280px);
        z-index: 9996;
        transform: translateX(-105%);
        transition: transform 0.25s ease;
        visibility: hidden;
        pointer-events: none;
    }

    .page-sidebar-wrapper.sidebar-open {
        transform: translateX(0);
        visibility: visible;
        pointer-events: auto;
    }

    .page-sidebar-wrapper .page-sidebar {
        display: block !important;
        height: 100%;
        min-height: 0;
        width: 100%;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        box-shadow: 4px 0 16px rgba(0, 0, 0, 0.2);
    }

    .page-content-wrapper {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .courses-table-wrap,
    .cgpa-table-wrap {
        overflow-x: scroll;
        -webkit-overflow-scrolling: touch;
    }

    #courses-table,
    #cgpa-table {
        width: auto;
    }
}

@media (max-width: 767px) {
    .page-header-inner {
        padding: 0 10px;
    }

    .page-logo .logo-default {
        max-width: 120px;
        height: 30px;
        margin-top: 0;
    }

    .nav-user-text {
        display: none;
    }

    .nav-user-link {
        padding: 12px 8px !important;
    }

    .btn-block-xs {
        width: 100%;
        margin-top: 4px;
    }

    .page-content {
        padding: 12px 8px 24px;
        overflow-x: hidden;
        min-width: 0;
        width: 100%;
        box-sizing: border-box;
    }

    /* Bootstrap columns without .row — stop float overflow on mobile */
    .page-content > .col-md-12,
    .page-content > .view-panel,
    .page-content > .row {
        float: none;
        width: 100%;
        max-width: 100%;
        clear: both;
        margin-left: 0;
        margin-right: 0;
        padding-left: 0;
        padding-right: 0;
        box-sizing: border-box;
    }

    #mycourse-section,
    #cgpa-section,
    #mycourse-section .portlet,
    #cgpa-section .portlet,
    #mycourse-section .portlet-body,
    #cgpa-section .portlet-body,
    #mycourse-section .form-group,
    #cgpa-section .form-group {
        min-width: 0;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }

    .portlet.box {
        overflow: hidden;
    }

    .portlet-body {
        padding: 8px;
        overflow: hidden;
    }

    .courses-table-wrap,
    .cgpa-table-wrap {
        width: 100%;
        max-width: 100%;
        overflow-x: scroll;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        touch-action: auto;
    }

    #courses-table {
        min-width: 700px;
        width: auto;
        font-size: 12px;
    }

    #cgpa-table {
        min-width: 600px;
        width: auto;
    }

    .courses-table-scroll-hint {
        display: none;
    }

    .courses-table-wrap.can-scroll-x + .courses-table-scroll-hint,
    .cgpa-table-wrap.can-scroll-x + .courses-table-scroll-hint {
        display: block;
    }

    #detail-modal.modal {
        padding-top: calc(var(--navbar-height) + 12px);
        padding-left: 8px;
        padding-right: 8px;
    }

    #detail-modal.modal .modal-dialog {
        max-width: 100%;
    }

    #detail-modal.modal .modal-body {
        padding: 12px;
    }

    .marks-total-banner {
        flex-direction: column;
        align-items: flex-start;
    }

    .cgpa-stat-value {
        font-size: 28px;
    }

    th.sortable {
        font-size: 11px;
        padding: 8px 6px !important;
    }

    .table > tbody > tr > td {
        padding: 8px 6px;
        font-size: 12px;
    }
}
