* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: white;
    padding: 10px 0;
    margin-bottom: 10px;
}

.header h1 {
    font-size: 3em;
    /* Align with the main container for a cleaner look */
    max-width: 1200px;
    margin: 0 auto 10px;
    padding: 0 20px;
    text-align: left;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.filters {
    background: white;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.filter-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.filter-section:last-child {
    border-bottom: none;
}

.filter-section h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #333;
    font-weight: 600;
}

.rank-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.rank-inputs input {
    flex: 1;
    min-width: 120px;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
}

.rank-inputs span {
    font-weight: 600;
    color: #666;
}

.toggle-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.toggle:hover {
    background: #e9ecef;
}

.toggle input[type="checkbox"] {
    display: none;
}

.slider {
    width: 34px;
    height: 20px;
    background: #ccc;
    border-radius: 20px;
    position: relative;
    transition: 0.3s;
}

.slider:before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: 0.3s;
}

.toggle input:checked + .slider {
    background: #007bff;
}

.toggle input:checked + .slider:before {
    transform: translateX(14px);
}

.toggle-container {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 10px;
    background: #f8f9fa;
}

.toggle-container .toggle {
    width: 100%;
    justify-content: flex-start;
    margin-bottom: 5px;
    background: white;
    border-radius: 6px;
}

.filter-actions {
    margin-top: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    margin-right: 10px;
    transition: transform 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s;
}

.btn-secondary:hover {
    background: #545b62;
    transform: translateY(-2px);
}

button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s;
}

button:hover {
    transform: translateY(-2px);
}



.data-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.data-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
}

.data-content {
    padding: 20px;
    max-height: 600px;
    overflow-y: auto;
}

.results-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-controls label {
    font-size: 14px;
    font-weight: 500;
}

.sort-controls select {
    padding: 6px 10px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 14px;
}

.sort-controls select option {
    background: white;
    color: #333;
}

#resultCount {
    font-weight: bold;
    color: white;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

.error {
    color: #e74c3c;
    text-align: center;
    padding: 20px;
}

.search-input {
    width: 100%;
    margin-bottom: 10px;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
}

.select-all-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    margin-bottom: 5px;
    margin-right: 5px;
}

.clear-all-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    margin-bottom: 5px;
}
.disclaimer {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    margin-top: 30px;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
    color: #666;
    border-top: 3px solid #007cba;
}

.disclaimer p {
    margin: 8px 0;
}

.disclaimer a {
    color: #007cba;
    text-decoration: none;
}

.disclaimer a:hover {
    text-decoration: underline;
}

#loadingSpinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner-overlay {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.data-source-toggle {
    display: flex;
    align-items: center;
    gap: 15px;
    justify-content: center;
}

.toggle-label {
    font-weight: 600;
    font-size: 14px;
    color: #666;
    transition: color 0.3s ease;
}

.toggle-label.active {
    color: #007cba;
}

.toggle-switch {
    width: 60px;
    height: 30px;
    background: #007cba;
    border-radius: 15px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-slider {
    width: 26px;
    height: 26px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch.active .toggle-slider {
    transform: translateX(30px);
}

@media (max-width: 768px) {
    .filter-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .checkbox-group {
        justify-content: center;
    }
    
    .checkbox-container {
        max-height: 150px;
    }
}

/* --- Results Card Styling --- */
.college-group {
    margin-bottom: 1.5rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.college-header {
    background-color: #f8f9fa;
    color: #343a40;
    padding: 12px 16px;
    font-size: 1.1rem;
    font-weight: 600;
    border-bottom: 1px solid #e9ecef;
}

.candidate-item {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    border-bottom: 1px solid #f1f3f5;
    transition: background-color 0.2s ease-in-out;
}

.candidate-item:last-child {
    border-bottom: none;
}

.candidate-item:hover {
    background-color: #f8f9fa;
}

.candidate-rank {
    flex-shrink: 0;
    width: 90px;
    text-align: center;
    margin-right: 16px;
    padding-top: 4px;
}

.candidate-rank a {
    font-size: 1.2rem;
    font-weight: 700;
    color: #007cba;
    text-decoration: none;
    display: block;
    padding: 8px;
    border-radius: 6px;
    background-color: #eef7ff;
    transition: background-color 0.2s, color 0.2s;
}

.candidate-rank a:hover {
    background-color: #007cba;
    color: #fff;
}

.candidate-info { flex-grow: 1; }
.candidate-course { font-weight: 600; color: #2c3e50; margin-bottom: 6px; font-size: 1rem; }
.candidate-details { font-size: 0.85rem; color: #7f8c8d; margin-bottom: 8px; line-height: 1.4; }

.candidate-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-min, .tag-ph, .tag-stray, .tag-service, .tag-mrc {
    display: inline-block;
    padding: 3px 8px;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 12px;
    color: #fff;
}
.tag-min { background-color: #9b59b6; } /* Purple */
.tag-ph { background-color: #e74c3c; } /* Red */
.tag-stray { background-color: #f39c12; } /* Orange */
.tag-service { background-color: #27ae60; } /* Green */
.tag-mrc { background-color: #3498db; } /* Blue */

.detail-fem {
    color: #e91e63; /* Pink */
    font-weight: 600;
}
