/* =========================================================
   Legacy admin form cleanup
   Applied only to pages that still use the old
   `.card > .tab-content.card-body > form` + bootstrap row
   layout (User Management student/professor pages).
   ========================================================= */

.legacy-form-theme .mdk-drawer-layout__content .card {
    border: 1px solid #e3ebf4;
    border-radius: 14px;
    box-shadow: 0 6px 20px rgba(15, 32, 54, .05);
}

.legacy-form-theme .mdk-drawer-layout__content .card > .tab-content.card-body {
    padding: 24px;
}

/* Remove the manual <br> spacing between legacy rows */
.legacy-form-theme .card > .tab-content.card-body > br,
.legacy-form-theme .card > .tab-content.card-body .exchange > br {
    display: none;
}

/* Hide rows that contain no form control at all */
.legacy-form-theme .card > .tab-content.card-body .row:not(:has(input, select, textarea, button, a, label, p, ul, table)) {
    display: none;
}

/* ---------- label / field / error rows ---------- */
.legacy-form-theme .card > .tab-content.card-body .row:has(> .offset-sm-2),
.legacy-form-theme .card > .tab-content.card-body .row:has(> .offset-md-2) {
    display: grid;
    grid-template-columns: minmax(180px, 280px) minmax(0, 1fr);
    align-items: center;
    gap: 4px 24px;
    margin: 0 0 16px;
}

.legacy-form-theme .card > .tab-content.card-body .row:has(> .offset-sm-2) > [class*="col-"],
.legacy-form-theme .card > .tab-content.card-body .row:has(> .offset-md-2) > [class*="col-"] {
    width: auto;
    max-width: none;
    flex: none;
    padding: 0;
    margin: 0;
}

.legacy-form-theme .card > .tab-content.card-body .row:has(> .offset-sm-2) > [class*="col-"]:first-child,
.legacy-form-theme .card > .tab-content.card-body .row:has(> .offset-md-2) > [class*="col-"]:first-child {
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #546e7a;
}

.legacy-form-theme .card > .tab-content.card-body .row:has(> .offset-sm-2) > [class*="col-"]:nth-child(2),
.legacy-form-theme .card > .tab-content.card-body .row:has(> .offset-md-2) > [class*="col-"]:nth-child(2) {
    min-width: 0;
}

.legacy-form-theme .card > .tab-content.card-body .row:has(> .offset-sm-2) > [class*="col-"]:nth-child(3),
.legacy-form-theme .card > .tab-content.card-body .row:has(> .offset-md-2) > [class*="col-"]:nth-child(3) {
    grid-column: 1 / -1;
    color: #e53935;
    font-size: 12.5px;
}

.legacy-form-theme .card > .tab-content.card-body .row:has(> .offset-sm-2) > [class*="col-"]:nth-child(3):empty,
.legacy-form-theme .card > .tab-content.card-body .row:has(> .offset-md-2) > [class*="col-"]:nth-child(3):empty {
    display: none;
}

/* ---------- widgets ---------- */
.legacy-form-theme .card > .tab-content.card-body .row:has(> .offset-sm-2) > [class*="col-"]:nth-child(2) input[type="text"],
.legacy-form-theme .card > .tab-content.card-body .row:has(> .offset-sm-2) > [class*="col-"]:nth-child(2) input[type="email"],
.legacy-form-theme .card > .tab-content.card-body .row:has(> .offset-sm-2) > [class*="col-"]:nth-child(2) input[type="password"],
.legacy-form-theme .card > .tab-content.card-body .row:has(> .offset-sm-2) > [class*="col-"]:nth-child(2) input[type="number"],
.legacy-form-theme .card > .tab-content.card-body .row:has(> .offset-sm-2) > [class*="col-"]:nth-child(2) input[type="date"],
.legacy-form-theme .card > .tab-content.card-body .row:has(> .offset-sm-2) > [class*="col-"]:nth-child(2) input[type="tel"],
.legacy-form-theme .card > .tab-content.card-body .row:has(> .offset-sm-2) > [class*="col-"]:nth-child(2) input[type="url"],
.legacy-form-theme .card > .tab-content.card-body .row:has(> .offset-sm-2) > [class*="col-"]:nth-child(2) textarea,
.legacy-form-theme .card > .tab-content.card-body .row:has(> .offset-sm-2) > [class*="col-"]:nth-child(2) select {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid #dbe6f1;
    border-radius: 10px;
    background: #fff;
    color: #0f2036;
    font-size: 14px;
    box-shadow: none;
}

.legacy-form-theme .card > .tab-content.card-body .row:has(> .offset-sm-2) > [class*="col-"]:nth-child(2) input[type="file"] {
    width: 100%;
}

.legacy-form-theme .card > .tab-content.card-body .row:has(> .offset-sm-2) > [class*="col-"]:nth-child(2) input[type="checkbox"],
.legacy-form-theme .card > .tab-content.card-body .row:has(> .offset-sm-2) > [class*="col-"]:nth-child(2) input[type="radio"] {
    width: 18px;
    height: 18px;
    min-height: 0;
}

.legacy-form-theme .chosen-container {
    width: 100% !important;
}

/* ---------- submit rows ---------- */
.legacy-form-theme .card > .tab-content.card-body .row:has(input[type="submit"]),
.legacy-form-theme .card > .tab-content.card-body .row:has(button[type="submit"]) {
    display: block;
    margin-top: 8px;
}

.legacy-form-theme .card > .tab-content.card-body .row:has(input[type="submit"]) > [class*="col-"],
.legacy-form-theme .card > .tab-content.card-body .row:has(button[type="submit"]) > [class*="col-"] {
    padding: 0;
    text-align: right;
}

.legacy-form-theme .card > .tab-content.card-body .row:has(input[type="submit"]) > [class*="col-"]:empty,
.legacy-form-theme .card > .tab-content.card-body .row:has(button[type="submit"]) > [class*="col-"]:empty {
    display: none;
}

.legacy-form-theme .card > .tab-content.card-body .row:has(input[type="submit"]) div[style*="text-align"],
.legacy-form-theme .card > .tab-content.card-body .row:has(button[type="submit"]) div[style*="text-align"] {
    text-align: right !important;
}

/* ---------- small helper rows ---------- */
.legacy-form-theme .card > .tab-content.card-body .row:has(> .col-sm-5 > p) {
    display: block;
    margin: -10px 0 14px;
}

.legacy-form-theme .card > .tab-content.card-body .row:has(> .col-sm-5 > p) > [class*="col-"] {
    width: 100%;
    max-width: 100%;
    padding: 0;
}

.legacy-form-theme .card > .tab-content.card-body .row:has(> .col-sm-5 > p) p {
    margin: 0;
    color: #78909c;
    font-size: 12.5px;
}

/* ---------- list page filters accordion ---------- */
.legacy-form-theme .search-bar + .accordion,
.legacy-form-theme button.accordion {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin: 14px 0 0;
    padding: 12px 16px;
    border: 1px solid #dbe6f1;
    border-radius: 10px;
    background: #f6f9fd;
    color: #37474f;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.legacy-form-theme button.accordion::after {
    content: '\f107';
    font-family: FontAwesome;
    font-size: 13px;
    color: #78909c;
    transition: transform .2s ease;
}

.legacy-form-theme button.accordion.active {
    background: #e3f2fd;
    border-color: #90caf9;
    color: #1565c0;
}

.legacy-form-theme button.accordion.active::after {
    transform: rotate(180deg);
    color: #1565c0;
}

.legacy-form-theme .filters .panel {
    padding: 18px;
    margin-top: -1px;
    border: 1px solid #e3ebf4;
    border-top: 0;
    border-radius: 0 0 10px 10px;
    background: #fff;
}

.legacy-form-theme .filters .panel .filter-opt p {
    margin: 0 0 8px;
    color: #37474f;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.legacy-form-theme .filters .panel label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px;
    color: #455a64;
    font-size: 13.5px;
    font-weight: 500;
}

.legacy-form-theme .filters .panel input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #1e88e5;
}

/* ---------- list page search / sort controls ---------- */
.legacy-form-theme .search-bar .search {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid #dbe6f1;
    border-radius: 10px;
    background: #fff;
    color: #0f2036;
    font-size: 14px;
    box-shadow: none;
}

.legacy-form-theme .search-bar .search:focus {
    border-color: #1e88e5;
    box-shadow: 0 0 0 3px rgba(30, 136, 229, .12);
    outline: 0;
}

.legacy-form-theme .search-bar .sort {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid #dbe6f1;
    border-radius: 10px;
    background: #fff;
    color: #37474f;
    font-size: 13px;
    font-weight: 600;
}

.legacy-form-theme .search-bar .sort:hover {
    background: #e3f2fd;
    color: #1565c0;
}

/* ---------- course / module form section headings ---------- */
.legacy-form-theme .form-section-title {
    /* margin: 4px 0 16px; */
    padding-bottom: 8px;
    border-bottom: 1px solid #e3ebf4;
    color: #1565c0;
    font-size: 12.5px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.legacy-form-theme .form-section-title:not(:first-child) {
    margin-top: 16px;
}

.legacy-form-theme .form-hint {
    margin: -6px 0 16px;
    color: #78909c;
    font-size: 12.5px;
}

.legacy-form-theme .course-list-table {
    margin-top: 20px;
}

.legacy-form-theme .course-list-table th {
    color: #37474f;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.legacy-form-theme .course-list-table td {
    vertical-align: middle;
}

.legacy-form-theme .dataTables_wrapper .dataTables_length,
.legacy-form-theme .dataTables_wrapper .dataTables_filter,
.legacy-form-theme .dataTables_wrapper .dataTables_info {
    color: #607d8b;
    font-size: 12.5px;
}

.legacy-form-theme .dataTables_wrapper .dataTables_length select {
    min-height: 38px;
    padding: 6px 30px 6px 12px;
    border: 1px solid #dbe6f1;
    border-radius: 8px;
    background-color: #fff;
}

.legacy-form-theme .dataTables_wrapper .dataTables_filter input {
    min-width: 220px;
    height: 38px;
    padding: 8px 12px;
    border: 1px solid #dbe6f1;
    border-radius: 8px;
}

@media (max-width: 767.98px) {
    .legacy-form-theme .card > .tab-content.card-body .row:has(> .offset-sm-2),
    .legacy-form-theme .card > .tab-content.card-body .row:has(> .offset-md-2) {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .legacy-form-theme .card > .tab-content.card-body .row:has(> .offset-sm-2) > [class*="col-"]:nth-child(3),
    .legacy-form-theme .card > .tab-content.card-body .row:has(> .offset-md-2) > [class*="col-"]:nth-child(3) {
        grid-column: 1;
    }
}
