/* === General Reset and Global Styles === */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif, 'Arial', 'Helvetica';
    line-height: 1.4;
    background-color: #f4f6f9;
    /* Light grey background like reference */
}

/* === Bilingual Support (Arabic + English) === */
* {
    /* Handle mixed RTL/LTR content properly */
    unicode-bidi: plaintext;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Ensure proper text rendering for Arabic */
.msc-course-container,
.msc-course-card,
.card-title,
.card-meta,
.msc-select,
.msc-register-btn {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* RTL Support for Arabic Content */
[dir="rtl"] .card-meta span::before {
    margin-right: 0;
    margin-left: 6px;
}

[dir="rtl"] .card-meta .location-detail {
    padding-left: 0;
    padding-right: 18px;
}

[dir="rtl"] .msc-select {
    text-align: right;
    padding-right: 10px;
    padding-left: 30px;
}



/* LTR Support for English Content */
[dir="ltr"] .card-meta span::before {
    margin-right: 6px;
    margin-left: 0;
}

[dir="ltr"] .card-meta .location-detail {
    padding-left: 18px;
    padding-right: 0;
}

[dir="ltr"] .msc-select {
    text-align: left;
}



.msc-course-container {
    max-width: 1400px;
    /* Container width for 6 columns */
    margin: 0 auto 1% auto;
    /* Removed top margin */
    padding: 0 40px;
    /* Side margins */
    padding-top: 0 !important;
    /* Force remove top padding */
}

/* --- FILTER BAR --- */
.msc-filter-row {
    background-color: #fff;
    padding: 10px 15px;
    margin-bottom: 25px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #ddd;
    /* White bar with border */
}

.msc-filter-form {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    /* Allow wrapping */
    align-items: flex-start;
    /* Align to top */
    flex-grow: 1;
}

.msc-form-group {
    flex-grow: 1;
    min-width: 150px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.msc-form-group label {
    font-weight: 700;
    font-size: 0.9rem;
    color: #444;
}

.msc-desktop-filter-title {
    display: block !important;
    width: 100%;
    margin-bottom: 15px;
    font-weight: bold;
    font-size: 1.2rem;
}

.msc-select {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    font-size: 0.85rem;
    color: #555;
    cursor: pointer;
    height: 34px;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msc-select[type="text"] {
    cursor: text;
    white-space: normal;
}

.msc-select[type="text"]::placeholder {
    color: #999;
}

.msc-select:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background-color: #eee;
}

.msc-clear-btn {
    padding: 6px 15px;
    background: #5A4917;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    height: 34px;
    white-space: nowrap;
}

.msc-clear-btn:hover {
    background-color: #1a252f;
}



/* === Course Cards Grid === */
.msc-course-grid {
    display: grid;
    /* Fixed 6 columns per row */
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    /* Spacing between cards */
}

/* --- COURSE CARD STYLING --- */
.msc-course-grid:not(.list-view) .msc-course-card {
    background: #fff;
    border: 1px solid #5A4917;
    /* Dark blue border per reference */
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s;
    height: 100%;
}

.msc-course-grid:not(.list-view) .msc-course-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.msc-course-grid:not(.list-view) .card-image {
    height: 140px;
    /* Reduced height */
    background-size: cover;
    background-position: center;
    background-color: #eee;
    position: relative;
    border-bottom: 1px solid #eee;
}

.status-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    color: #d32f2f;
    padding: 5px 10px;
    border-radius: 3px;
    font-weight: bold;
    font-size: 0.8rem;
    white-space: nowrap;
}

.plus-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #5A4917;
    color: #fff;
    padding: 4px 8px;
    font-size: 0.7rem;
    font-weight: bold;
    border-radius: 2px;
}

.card-content {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-title {
    font-size: 0.95rem;
    /* Smaller title */
    font-weight: 700;
    color: #333;
    margin: 0 0 10px 0;
    line-height: 1.4;
    min-height: 2.8em;
    /* Ensure 2 lines check */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    /* Handle long Arabic/English words */
    white-space: normal;
}

.card-meta {
    flex-grow: 1;
    margin-bottom: 10px;
}

.card-meta p {
    margin: 4px 0;
    font-size: 0.75rem;
    /* Compact text */
    color: #666;
    display: flex;
    align-items: center;
    word-break: break-word;
    /* Handle mixed languages */
    white-space: normal;
    line-height: 1.5;
}

.card-meta span::before {
    margin-right: 6px;
    font-size: 0.85rem;
    color: #e67e22;
    /* Orange icons like reference */
}

/* Icons */
.card-meta span.icon-calendar::before {
    content: "📅";
}

.card-meta span.icon-flag::before {
    content: "🏳️";
}

.card-meta span.icon-location::before {
    content: "🎓";
}

.card-meta span.icon-city::before {
    content: "📍";
}

.card-meta span.icon-clock::before {
    content: "⏰";
}

.card-meta span.icon-info::before {
    content: "ℹ️";
}

.card-meta .location-detail {
    margin-top: -3px;
    padding-left: 18px;
    font-size: 0.7rem;
    color: #888;
}

/* Dual Button Layout */
.card-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 12px;
    padding: 0 6px;
    margin-bottom: 4px;
}

.msc-explore-btn,
.msc-schedule-btn {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: unset !important;
    margin: 0 !important;
    padding: 9px 10px !important;
    text-align: center !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    font-size: 0.82rem !important;
    border-radius: 25px !important;
    cursor: pointer !important;
    font-family: inherit !important;
    transition: all 0.3s ease !important;
    box-sizing: border-box !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

.msc-explore-btn {
    background-color: #9D7D2E;
    /* Exact theme gold color */
    color: #ffffff;
    border: 1px solid transparent;
}

.msc-explore-btn:hover {
    background-color: #8f6f28;
}

.msc-schedule-btn {
    background-color: #ffffff;
    color: #777777;
    border: 1px solid #d5d5d5;
    /* Slightly more visible light grey */
}

.msc-schedule-btn:hover {
    background-color: #f5f5f5;
    color: #444444;
    border-color: #bbbbbb;
}

/* Legacy button styling (kept for backward compatibility) */
.msc-register-btn {
    display: block;
    width: 100%;
    margin-top: auto;
    background-color: #5A4917;
    color: #fff;
    text-align: center;
    padding: 8px 0;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 3px;
    border: none;
    cursor: default;
    font-family: inherit;
}

.msc-register-btn:hover {
    background-color: #5A4917;
}

.msc-no-courses-found {
    grid-column: 1/-1;
    text-align: center;
    padding: 50px;
    background: #f8f8f8;
    border-radius: 6px;
    border: 1px dashed #ccc;
    font-size: 1.2rem;
    color: #555;
}

/* --- Tablet Responsiveness --- */
@media (max-width: 992px) and (min-width: 769px) {
    .msc-filter-row {
        flex-direction: column;
        align-items: stretch;
        padding: 15px;
    }

    .msc-filter-form {
        gap: 10px;
        margin-bottom: 15px;
        justify-content: space-between;
    }

    .msc-form-group {
        flex: 1 1 45%;
        min-width: 140px;
    }
}

/* =========================================
   NEW SLIDING TOGGLE & LIST VIEW STYLES
   ========================================= */

/* --- Header Row --- */
.msc-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.msc-title {
    font-size: 1.75rem;
    color: #d7dce0;
    margin: 0;
    font-weight: 700;
}

/* --- Sliding Toggle Container --- */
/* ================================
   VIEW TOGGLE BUTTON (GRID / LIST)
   ================================ */

/* Toggle wrapper */
.msc-view-toggle-wrapper {
    display: flex;
    align-items: center;
}

/* Toggle container */
.msc-toggle-switch {
    position: relative;
    display: flex;
    background-color: #e6e6e6;
    /* light grey */
    border-radius: 50px;
    padding: 4px;
    border: 1px solid #dcdcdc;
    cursor: pointer;
    overflow: hidden;
    user-select: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Sliding pill */
.msc-toggle-slider {
    position: absolute;
    top: 4px;
    left: 4px;
    bottom: 4px;
    width: calc(50% - 4px);
    background-color: #5A4917;
    /* dark blue */
    border-radius: 50px;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    z-index: 1;
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* When List View is active */
.msc-toggle-switch.list-view-active .msc-toggle-slider {
    transform: translateX(100%);
}

/* Toggle options (Grid / List text) */
.msc-toggle-option {
    position: relative;
    z-index: 2;
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px 25px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.3s ease;
    text-align: center;
    font-family: inherit;
    outline: none;
    min-width: 100px;
}

/* Active option text */
.msc-toggle-option.active {
    color: #fff;
}

/* Hover (inactive only) */
.msc-toggle-option:hover:not(.active) {
    color: #333;
}

/* === RTL Support for Toggle Button === */
[dir="rtl"] .msc-toggle-switch {
    direction: ltr;
    /* Keep toggle behavior consistent */
}

[dir="rtl"] .msc-toggle-slider {
    /* Slider behavior remains same */
}

[dir="rtl"] .msc-toggle-option {
    /* Text color and active states work the same */
    color: #666;
}

[dir="rtl"] .msc-toggle-option.active {
    color: #fff;
    /* Active text white in both RTL and LTR */
}

[dir="rtl"] .msc-toggle-option:hover:not(.active) {
    color: #333;
    /* Hover effect same in both directions */
}


/* --- List View Logic --- */

.msc-course-grid.list-view {
    grid-template-columns: 100%;
}

.msc-course-grid.list-view .msc-course-card {
    display: flex;
    /* 🔴 THIS WAS MISSING */
    flex-direction: row;
    /* image left, text right */
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 15px;
    overflow: hidden;
}

.msc-course-grid.list-view .card-image {
    width: 250px;
    min-height: 160px;
    background-size: cover;
    background-position: center;
    border-right: 1px solid #eee;
    flex-shrink: 0;
    /* image squeeze na ho */
}

.msc-course-grid.list-view .card-content {
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Center everything */
    gap: 20px;
    /* More space between title and buttons */
    flex-grow: 1;
}

.msc-course-grid.list-view .card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1.4;
    word-break: break-word;
    white-space: normal;
    overflow-wrap: break-word;
    text-align: center;
    /* Center the title */
    width: 100%;
}

.msc-course-grid.list-view .card-meta {
    display: none;
    /* Hide meta in list view since we removed it */
}


.msc-course-grid.list-view .msc-register-btn {
    grid-area: button;
    min-width: 150px;
    padding: 10px 20px;
    white-space: nowrap;
    align-self: center;
    /* 🔴 vertical center */
    justify-self: center;
    /* 🔴 horizontal neat */
}

/* List View: Buttons in single horizontal line */
.msc-course-grid.list-view .card-buttons {
    flex-direction: row;
    gap: 10px;
    margin-top: 0;
    /* Remove extra margin since we have gap in parent */
    justify-content: center;
    /* Center the buttons */
    max-width: 400px;
    /* Limit button container width */
}

.msc-course-grid.list-view .msc-explore-btn,
.msc-course-grid.list-view .msc-schedule-btn {
    flex: 1;
    /* Equal width */
    min-width: 150px;
    /* Minimum button width */
}

/* Mobile Responsiveness */
@media (max-width: 768px) {

    /* Main Layout */
    .msc-course-container {
        padding: 0 15px;
    }

    /* Grid view: 2 columns with gap */
    .msc-course-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    /* --- FILTER LAYOUT --- */
    .msc-filter-row {
        padding: 0 0 20px 0;
        /* Remove padding */
        border: none;
        background: transparent;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        flex-wrap: nowrap;
        /* Keep them in one line */
    }

    /* Toggle Button (Visible on Mobile) */
    .msc-mobile-filter-trigger {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: #fff;
        border: 1px solid #5A4917;
        color: #5A4917;
        padding: 8px 15px;
        border-radius: 4px;
        font-weight: 600;
        cursor: pointer;
        flex: 1;
        /* Take half space */
        height: 42px;
        font-size: 0.95rem;
    }

    .msc-mobile-filter-trigger:hover {
        background: #f4f6f9;
    }

    /* Download Button (Visible on Mobile) */



    /* --- MODAL STYLES (Hide Form Initially) --- */
    .msc-filter-form {
        display: none;
        /* Hidden by default */
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        /* Dark Overlay */
        z-index: 9999;
        justify-content: center;
        align-items: center;
        /* Vertically enter */
        padding: 0 15px;
        /* Side padding so box has margins */
        box-sizing: border-box;
    }

    .msc-filter-form.open {
        display: flex;
        /* Show flex to center content */
    }

    /* New Content Wrapper - The White Box */
    .msc-modal-content {
        background: #fff;
        width: 100%;
        max-width: 380px;
        /* Nice popup width */
        border-radius: 12px;
        /* Rounded corners */
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
        overflow: hidden;
        display: flex;
        flex-direction: column;
        max-height: 85vh;
        overflow-y: auto;
    }

    /* Remove white bg from form itself since wrapper has it */
    .msc-filter-form.open {
        background: rgba(0, 0, 0, 0.5);
    }

    /* Inside Modal Layout */
    .msc-filter-form.open>* {
        width: 100%;
    }

    /* Modal Header */
    .msc-mobile-modal-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 15px 20px;
        background: #fff;
        border-bottom: 1px solid #eee;
        margin-bottom: 15px;
        flex: 0 0 auto;
    }

    .msc-mobile-modal-header h3 {
        margin: 0;
        font-size: 1.1rem;
        color: #333;
        font-weight: 700;
    }

    .msc-close-modal {
        background: none;
        border: none;
        font-size: 2rem;
        color: #999;
        cursor: pointer;
        line-height: 0.8;
        padding: 0;
        margin-top: -5px;
    }

    /* Filter Inputs in Modal */
    .msc-form-group {
        padding: 0 20px;
        margin-bottom: 15px;
        flex: 0 0 auto;
        /* Stop resizing */
        width: 100% !important;
        box-sizing: border-box;
    }

    .msc-search-group {
        margin-bottom: 20px;
    }

    .msc-select {
        height: 45px;
        /* Larger touch targets */
        font-size: 1rem;
        width: 100%;
    }

    /* Clear Button */
    .msc-clear-btn {
        width: calc(100% - 40px);
        margin: 0 20px 10px 20px;
        background: transparent;
        color: #666;
        border: 1px solid #ccc;
        height: 45px;
    }

    /* Apply Filter Button */
    .msc-mobile-apply-btn {
        display: block;
        width: calc(100% - 40px);
        margin: 10px 20px 20px 20px;
        background: #5A4917;
        color: #fff;
        border: none;
        border-radius: 4px;
        height: 48px;
        font-size: 1.1rem;
        font-weight: 600;
        cursor: pointer;
    }


    /* List view adjustments */
    .msc-course-grid.list-view .msc-course-card {
        flex-direction: column;
        height: auto;
    }

    .msc-course-grid.list-view .card-image {
        width: 100%;
        height: 180px;
        border-right: none;
        border-bottom: 1px solid #d1d1d1;
    }

    .msc-course-grid.list-view .card-content {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .msc-course-grid.list-view .card-meta {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .msc-course-grid.list-view .msc-register-btn {
        width: 100%;
        margin-left: 0;
    }

    .msc-header-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .msc-view-toggle-wrapper {
        margin-left: auto;
        /* Keep toggle visible but compact if needed */
        margin-top: 10px;
    }
}

/* Hide Mobile Elements on Desktop AND Fix Layout */
@media (min-width: 769px) {

    .msc-mobile-filter-trigger,
    .msc-mobile-modal-header,
    .msc-mobile-apply-btn {
        display: none;
    }

    /* Force the modal content wrapper to behave like a horizontal row on desktop */
    .msc-modal-content {
        display: flex !important;
        flex-direction: row !important;
        background: transparent !important;
        box-shadow: none !important;
        width: 100% !important;
        max-width: none !important;
        gap: 10px;
        align-items: center;
        padding: 0 !important;
        overflow: visible !important;
        max-height: none !important;
        border-radius: 0 !important;
    }

    /* Ensure form groups don't fill 100% like on mobile */
    .msc-form-group {
        width: auto !important;
        margin-bottom: 0 !important;
        padding: 0 !important;
    }

    .msc-clear-btn {
        margin: 0 !important;
        width: auto !important;
    }
}

/* Language Toggle Styles */
.msc-lang-toggle {
    display: inline-flex;
    background: #eef1f6;
    border-radius: 8px;
    padding: 3px;
    margin-right: 15px;
    /* Spacing between lang toggle and view toggle */
}

.msc-lang-btn {
    background: transparent;
    border: none;
    padding: 6px 14px;
    font-size: 14px;
    font-family: inherit;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.msc-lang-btn:hover {
    color: #1e293b;
}

.msc-lang-btn.active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

/* RTL Adjustments for Toggle Wrapper */
.msc-course-container[dir='rtl'] .msc-lang-toggle {
    margin-right: 0;
    margin-left: 15px;
}

/* =========================================
   REGISTRATION MODAL STYLES
   ========================================= */

.msc-reg-modal {
    display: none;
    /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

.msc-reg-modal-content {
    background: #fff;
    width: 100%;
    max-width: 1200px;
    /* Increased from 800px to accommodate new columns */
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.msc-reg-header {
    background: #5A4917;
    color: #fff;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.msc-reg-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #fff;
}

.msc-close-reg-modal {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.msc-reg-body {
    padding: 20px;
    overflow-y: auto;
}

.msc-readonly-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.msc-form-row {
    display: flex;
    flex-direction: column;
}

.msc-form-row.full-width {
    grid-column: 1 / -1;
}

.msc-form-row label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 5px;
}

.msc-form-row input {
    background: #f9f9f9;
    border: 1px solid #ddd;
    padding: 8px 10px;
    border-radius: 4px;
    color: #333;
    font-weight: 500;
    font-size: 0.95rem;
}

.msc-reg-table-wrapper {
    border: 1px solid #eee;
    border-radius: 4px;
    overflow: hidden;
    overflow-x: auto;
    /* Enable horizontal scrolling for wide tables */
}

.msc-reg-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.msc-reg-table th {
    background: #f1f2f3;
    text-align: left;
    padding: 10px 15px;
    font-weight: 600;
    color: #444;
    border-bottom: 2px solid #ddd;
}

.msc-reg-table td {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    color: #555;
    vertical-align: middle;
    cursor: pointer;
    white-space: nowrap;
    /* Prevent text wrapping */
    font-size: 0.85rem;
    /* Slightly smaller for more columns */
}

/* Radio Button Cell */
.msc-radio-cell {
    width: 40px;
    text-align: center;
}

.msc-reg-table tr:hover {
    background-color: #fcfcfc;
}

.msc-reg-table tr.selected-row {
    background-color: #f0f7ff;
}

.msc-reg-table tr.selected-row td {
    color: #333;
    font-weight: 500;
}

/* Footer & Buttons */
.msc-reg-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
    background: #fbfbfb;
}

.msc-reg-warning {
    color: #d32f2f;
    font-size: 0.9rem;
    font-weight: 500;
    display: none;
}

.msc-btn-cancel {
    background: #fff;
    border: 1px solid #ddd;
    padding: 8px 16px;
    border-radius: 4px;
    color: #555;
    cursor: pointer;
    font-weight: 500;
}

.msc-btn-confirm {
    background: #5A4917;
    border: none;
    padding: 8px 24px;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: opacity 0.2s;
}

.msc-btn-confirm:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.7;
}

/* RTL Support for Modal */
[dir="rtl"] .msc-reg-table th {
    text-align: right;
}

[dir="rtl"] .msc-close-reg-modal {
    float: left;
}

/* --- NEW OVERRIDE STYLES (EXACT MATCH) --- */
body {
    background-color: #f8f9fa !important;
    font-family: 'Inter', 'Segoe UI', sans-serif;
}

.msc-course-container {
    max-width: 1250px;
    margin: 0 auto;
    padding: 30px;
    background: transparent;
}

/* Top Section */
.msc-top-section {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 25px;
}

.msc-top-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 15px;
}

.msc-breadcrumbs {
    font-size: 0.9rem;
    color: #666;
    letter-spacing: 0.5px;
}

.msc-breadcrumbs strong {
    color: #222;
    font-weight: 700;
}

.msc-divider {
    color: #ccc;
    margin: 0 4px;
}

.msc-search-container {
    position: relative;
    width: 380px;
}

.msc-search-input {
    width: 100%;
    padding: 12px 45px 12px 20px;
    border: 1px solid #e0e0e0;
    border-radius: 40px;
    font-size: 0.95rem;
    color: #555;
    outline: none;
    background: #fff;
    transition: all 0.3s;
}

.msc-search-input::placeholder {
    color: #999;
}

.msc-search-input:focus {
    border-color: #9D7D2E;
    box-shadow: 0 0 0 3px rgba(165, 129, 50, 0.1);
}

.msc-search-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    display: flex;
    align-items: center;
    pointer-events: none;
}

/* RTL Support for Search Bar */
[dir="rtl"] .msc-search-input {
    padding: 12px 20px 12px 45px !important;
}

[dir="rtl"] .msc-search-icon {
    right: auto !important;
    left: 20px !important;
}

/* Filter Row */
.msc-filter-row-new {
    display: flex;
    align-items: flex-end;
    /* Align to bottom so reset button aligns with select boxes */
    background: #fff;
    padding: 20px 25px;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
    margin-bottom: 20px;
    border: 1px solid #eee;
    gap: 30px;
}

.msc-reset-col {
    padding-right: 15px;
    /* removed border */
    height: 42px;
    /* matches select box height */
    display: flex;
    align-items: center;
}

.msc-reset-filters-btn {
    background: none;
    border: none;
    color: #c0392b;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    padding: 0;
}

.msc-reset-filters-btn:hover {
    color: #b71c1c;
}

.msc-filter-form-new {
    display: flex;
    gap: 25px;
    flex-grow: 1;
    align-items: flex-end;
    /* Aligns all form groups to the bottom */
}

.msc-filter-form-new .msc-form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 12px;
    /* Increased gap between label and box to match image */
}

.msc-filter-form-new label {
    font-size: 0.8rem;
    color: #444;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.msc-filter-form-new select {
    border: 1px solid #e0e0e0;
    padding: 0 15px;
    /* removed vertical padding to rely on height/line-height */
    height: 42px !important;
    /* Force height so it's not overridden by 34px */
    line-height: 40px !important;
    border-radius: 6px;
    font-size: 0.95rem;
    color: #555;
    /* darker text for better visibility */
    background: #fff;
    width: 100%;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23999%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.4-12.8z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 15px top 50%;
    background-size: 10px auto;
}

.msc-filter-form-new select:focus {
    border-color: #9D7D2E;
}

/* Stats Bar */
.msc-stats-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 80px;
    background: #fff;
    padding: 20px 30px;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
    margin-bottom: 30px;
    border: 1px solid #eee;
}

.msc-stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    color: #222;
    font-weight: 600;
    white-space: nowrap;
    /* Forces text to stay on the same line as the icon */
}

.msc-stat-text {
    line-height: 1;
    /* Ensures text is perfectly vertically aligned with the center of the icon */
    display: inline-flex;
    align-items: center;
}

.msc-stat-icon {
    display: flex;
    align-items: center;
}

/* Action Bar */
.msc-action-bar {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    direction: ltr;
    /* Enforce LTR so icons are left, title is right */
}

.msc-action-bar::before,
.msc-action-bar::after {
    display: none !important;
}

.msc-action-left {
    display: flex;
    align-items: center;
    margin-right: auto;
    /* Pushes the right section perfectly to the far right edge */
}

.msc-icon-btn-container {
    display: flex;
    gap: 10px;
}

.msc-icon-btn {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.msc-icon-btn:hover {
    border-color: #999;
}

.msc-icon-btn.active {
    background-color: #f4f4f4;
    color: #222;
    border-color: #d0d0d0;
}

.msc-action-right {
    display: flex;
    align-items: center;
    gap: 15px;
    direction: ltr;
    /* Ensure inner elements render Count -> Title -> Gold Bar */
}

.msc-program-count {
    background: #fff;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #555;
    font-weight: 500;
    border: 1px solid #e0e0e0;
}

.msc-available-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111;
    margin: 0;
}

.msc-gold-bar {
    width: 5px;
    height: 28px;
    background-color: #9D7D2E;
    border-radius: 3px;
    margin-left: 5px;
}

/* Utility Class for JS Hiding */
.msc-course-container .msc-course-grid .msc-course-card.msc-hidden,
.msc-course-container .msc-course-grid.list-view .msc-course-card.msc-hidden {
    display: none !important;
}

/* Grid Layout */
.msc-course-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 25px !important;
}

/* Card Styling */
.msc-course-grid:not(.list-view) .msc-course-card {
    border: none !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06) !important;
    background: #fff !important;
    display: flex !important;
    flex-direction: column !important;
}

.msc-course-grid:not(.list-view) .card-image {
    height: 180px !important;
    border-radius: 12px 12px 0 0 !important;
    border-bottom: none !important;
}

.card-content {
    padding: 15px 14px 12px !important;
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    flex-grow: 1 !important;
}

.card-title {
    font-size: 1.05rem !important;
    margin-bottom: 10px !important;
    color: #222 !important;
    font-weight: 700 !important;
    line-height: 1.5 !important;
    min-height: 45px !important;
}

.card-buttons {
    gap: 4px !important;
    margin-top: 8px !important;
}

.msc-explore-btn {
    background-color: #9D7D2E !important;
    color: #fff !important;
    border: 1px solid #9D7D2E !important;
}

.msc-explore-btn:hover {
    background-color: #8A6D28 !important;
}

.msc-schedule-btn {
    background-color: #fff !important;
    color: #666 !important;
    border: 1px solid #e0e0e0 !important;
}

.msc-schedule-btn:hover {
    background-color: #f9f9f9 !important;
    color: #333 !important;
}

/* Bottom Actions */
.msc-bottom-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 50px;
    margin-bottom: 30px;
}

.msc-showing-text-container {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    max-width: 400px;
    margin-bottom: 25px;
}

.msc-showing-line {
    flex-grow: 1;
    height: 1px;
    background-color: #e0e0e0;
}

.msc-showing-text {
    color: #888;
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0;
}

.msc-explore-more-btn-bottom {
    background-color: transparent;
    color: #9D7D2E;
    border: 1px solid #9D7D2E;
    border-radius: 30px;
    padding: 12px 35px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.msc-explore-more-btn-bottom:hover {
    background-color: #9D7D2E;
    color: #fff;
}

/* Responsive Overrides */
@media (max-width: 1200px) {
    .msc-stats-bar {
        gap: 30px;
    }
}

@media (max-width: 992px) {
    .msc-course-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .msc-filter-row-new {
        flex-direction: column;
        align-items: stretch;
        gap: 20px;
    }

    .msc-reset-col {
        border-right: none;
        border-bottom: 1px solid #eee;
        padding-right: 0;
        padding-bottom: 15px;
    }

    .msc-filter-form-new {
        flex-wrap: wrap;
    }

    .msc-stats-bar {
        flex-wrap: wrap;
        gap: 20px;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .msc-course-grid {
        grid-template-columns: 1fr !important;
    }

    .msc-top-right {
        align-items: flex-start;
        width: 100%;
    }

    .msc-search-container {
        width: 100%;
    }

    .msc-action-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .msc-action-right {
        flex-wrap: wrap;
    }
}