/**
 * School Preference System Styles
 */

/* Dropdown Style Selector */
.sa-school-dropdown-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.sa-school-label {
    font-weight: 600;
    color: #495057;
    margin: 0;
    white-space: nowrap;
}

.sa-school-label i {
    margin-right: 0.5rem;
    color: #0d6efd;
}

.sa-school-select {
    max-width: 300px;
    font-weight: 500;
}

/* Button Style Selector */
.sa-school-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.sa-school-btn {
    font-weight: 500;
    transition: all 0.2s ease;
}

.sa-school-btn.active {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #ffffff;
}

.sa-school-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Content Filtering - Hide content by default when a school is selected */

/* When "All Schools" is selected, only show items tagged for all schools */
html.sa-school-all [data-school]:not([data-school*="all-schools"]) {
    display: none !important;
}

html.sa-school-all [data-school*="all-schools"] {
    display: block !important;
}

/* When Early Education is selected */
html.sa-school-early-education [data-school]:not([data-school*="early-education"]) {
    display: none !important;
}

/* When Lower School is selected */
html.sa-school-lower-school [data-school]:not([data-school*="lower-school"]) {
    display: none !important;
}

/* When Middle School is selected */
html.sa-school-middle-school [data-school]:not([data-school*="middle-school"]) {
    display: none !important;
}

/* When Upper School is selected */
html.sa-school-upper-school [data-school]:not([data-school*="upper-school"]) {
    display: none !important;
}

/* Support for Beaver Builder modules */
html.sa-school-all .fl-module[data-school]:not([data-school*="all-schools"]) {
    display: none !important;
}

html.sa-school-early-education .fl-module[data-school]:not([data-school*="early-education"]) {
    display: none !important;
}

html.sa-school-lower-school .fl-module[data-school]:not([data-school*="lower-school"]) {
    display: none !important;
}

html.sa-school-middle-school .fl-module[data-school]:not([data-school*="middle-school"]) {
    display: none !important;
}

html.sa-school-upper-school .fl-module[data-school]:not([data-school*="upper-school"]) {
    display: none !important;
}

/* Rows and columns support */
html.sa-school-all .fl-row[data-school]:not([data-school*="all-schools"]),
html.sa-school-all .fl-col[data-school]:not([data-school*="all-schools"]) {
    display: none !important;
}

html.sa-school-early-education .fl-row[data-school]:not([data-school*="early-education"]),
html.sa-school-early-education .fl-col[data-school]:not([data-school*="early-education"]) {
    display: none !important;
}

html.sa-school-lower-school .fl-row[data-school]:not([data-school*="lower-school"]),
html.sa-school-lower-school .fl-col[data-school]:not([data-school*="lower-school"]) {
    display: none !important;
}

html.sa-school-middle-school .fl-row[data-school]:not([data-school*="middle-school"]),
html.sa-school-middle-school .fl-col[data-school]:not([data-school*="middle-school"]) {
    display: none !important;
}

html.sa-school-upper-school .fl-row[data-school]:not([data-school*="upper-school"]),
html.sa-school-upper-school .fl-col[data-school]:not([data-school*="upper-school"]) {
    display: none !important;
}

/* Prevent flash of content */
.sa-school-filter-loading [data-school] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Fade in content after filtering applied */
html.sa-school-all [data-school],
html.sa-school-early-education [data-school],
html.sa-school-lower-school [data-school],
html.sa-school-middle-school [data-school],
html.sa-school-upper-school [data-school] {
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .sa-school-dropdown-wrapper {
        flex-direction: column;
        align-items: flex-start;
    }

    .sa-school-select {
        max-width: 100%;
        width: 100%;
    }

    .sa-school-buttons {
        flex-direction: column;
    }

    .sa-school-btn {
        width: 100%;
    }
}
