/* ===============================
   SaaS COMPACT CONTAINER
================================ */
#md-filter {
    max-width: 1200px;
    margin: 20px auto;
    background: #fff;
    border: 1px solid #eef2f6;
    border-radius: 10px;
    font-family: 'Inter', system-ui, sans-serif;
    overflow: hidden;
}

/* Full width on Mobile */
@media (max-width: 768px) {
    #md-filter {
        padding: 0; /* Removes internal padding of the whole section */
    }
    .md-top {
        padding: 5px 0; /* Keep top/bottom spacing, but set side padding to 0 */
    }
}

/* ===============================
   TOP BAR & CHIPS
================================ */
.md-top {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
}

.md-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

#md-course-chips {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none; /* Hide scrollbar Firefox */
    flex-grow: 1;
	-webkit-overflow-scrolling: touch; /* Adds smooth momentum scroll on iPhone */
    scroll-behavior: smooth;
}
#md-course-chips::-webkit-scrollbar { display: none; }

@media (max-width: 768px) {
    #md-course-chips {
        margin-left: -15px;  /* Pulls the scroll area to the left edge */
        margin-right: -15px; /* Pulls the scroll area to the right edge */
        padding-left: 15px;  /* Restores the inner spacing so the first chip isn't cut off */
        padding-right: 15px;
		-webkit-overflow-scrolling: touch; /* Adds smooth momentum scroll on iPhone */
    	scroll-behavior: smooth;
    }
}

.md-chip {
    padding: 6px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: 0.2s;
}
.md-chip:hover { border-color: #ff6409; color: #ff6409; }

/* Desktop City Box - Professional Size */
#md-city-select {
    width: 150px;
    padding: 6px 10px;
    font-size: 13px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    outline: none;
}

@media (max-width: 768px) {
    .md-controls { flex-direction: column; align-items: stretch; }
    #md-city-select { width: 100%; }
}

/* ===============================
   RESPONSIVE TABLE (THE FIX)
================================ */
.md-table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.md-head, .md-row {
    display: grid;
    /* Widened City and Placement columns to stop text cutting */
    grid-template-columns: 40px minmax(250px, 1fr) 140px 100px 120px 140px 70px;
    min-width: 950px; 
    align-items: center;
}

.md-head {
    background: #f8fafc;
    border-bottom: 2px solid #f1f5f9;
    position: sticky;
    top: 0;
    z-index: 5;
}

.md-head div {
    padding: 12px 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    white-space: nowrap; /* Prevents "Placement" from breaking */
}

.md-row { border-bottom: 1px solid #f1f5f9; transition: 0.1s; }
.md-row:hover { background: #fffaf7; }

.md-row div { padding: 10px; font-size: 13px; color: #334155; }

/* ===============================
   COLLEGE TITLE TRUNCATE
================================ */
.md-row .col {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden; /* Stops title from pushing columns */
}

.md-row .col img {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: 4px;
}

.md-row .col a {
    font-weight: 600;
    color: #1e293b;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Smartly cuts long names with "..." */
}

/* Value Highlights */
.fees-val { color: #059669; font-weight: 600; }
.rank-val { color: #ff6409; font-weight: 800; }

#md-load-more {
    display: block;
    margin: 20px auto;
    padding: 8px 24px;
    background: #ff6409;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

/* The Active Chip Style */
.md-chip.active {
    background: #ff6409 !important; /* Your brand orange */
    color: #ffffff !important;
    border-color: #ff6409 !important;
    box-shadow: 0 2px 4px rgba(255, 100, 9, 0.2);
}

/* Optional: Subtle indicator that it's the current selection */
.md-chip.active::after {
    content: ' ✓';
    font-size: 10px;
    vertical-align: middle;
}

@media (max-width: 768px) {
    .md-top {
        padding-left: 0;
        padding-right: 0;
    }
    #md-course-chips {
        padding-left: 15px; /* Keeps the first chip from touching the very edge */
        padding-right: 15px;
    }
}