/* ===== HEADER STYLES ===== */
.search-header {
    text-align: center;
    padding: 25px 20px;
    background: #0056b3;
    color: white;
    margin-bottom: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.search-header h3 {
    font-size: 28px;
    margin: 0 0 12px 0;
    font-weight: 600;
    color: white;
}

.search-header p {
    font-size: 16px;
    margin: 0;
    opacity: 0.95;
    line-height: 1.6;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== MAIN CONTAINER ===== */
.school-search-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== UNIFIED FILTER STYLES ===== */
.search-filters {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto auto;
    gap: 15px;
    margin-bottom: 25px;
    background: #ffffff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid #e1e5e9;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.filter-group select {
    width: 100%;
    padding: 14px;
    border: 2px solid #d1d9e6;
    border-radius: 6px;
    font-size: 15px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #2c3e50;
    font-weight: 500;
}

.filter-group select:focus {
    outline: none;
    border-color: #0056b3;
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.1);
}

.filter-group select:disabled {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
    border-color: #e9ecef;
}

/* ===== BUTTON STYLES ===== */
.search-button {
    padding: 14px 28px;
    background: #0056b3;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    min-width: 140px;
    height: 50px;
}

.search-button:hover {
    background: #004494;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 86, 179, 0.3);
}

.search-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.reset-button {
    padding: 14px 24px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    min-width: 120px;
    height: 50px;
}

.reset-button:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

/* ===== CLASSIC SEARCH SPECIFIC ===== */
.school-search-classic .school-results {
    margin-top: 20px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.school-search-classic .school-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.school-search-classic .school-meta p {
    margin: 0;
    color: #495057;
    font-weight: 500;
}

.school-search-classic .class-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.school-search-classic .class-box {
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 0;
    background: white;
    transition: all 0.3s ease;
}

.school-search-classic .class-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.school-search-classic .class-header {
    background: #0056b3;
    color: white;
    padding: 15px;
    text-align: center;
    border-radius: 8px 8px 0 0;
}

.school-search-classic .class-header h5 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.school-search-classic .records-grid {
    display: grid;
    gap: 12px;
    padding: 15px;
}

.school-search-classic .record-item {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    align-items: start;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
}

.school-search-classic .field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: center;
}

.school-search-classic .field-label {
    font-size: 12px;
    color: #6c757d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.school-search-classic .field-value {
    font-size: 14px;
    color: #2c3e50;
    font-weight: 600;
}

.school-search-classic .available-seats {
    grid-column: 1 / -1;
    text-align: center;
    padding: 15px;
    margin-top: 8px;
    background: #e7f3ff;
    border: 1px solid #0056b3;
    border-radius: 8px;
}

.school-search-classic .available-value {
    font-size: 32px;
    color: #0056b3;
    font-weight: 700;
    line-height: 1;
}

.school-search-classic .available-label {
    font-size: 14px;
    color: #495057;
    margin-top: 6px;
    font-weight: 600;
}

/* ===== ADVANCED & SUMMARY SEARCH ===== */
.school-search-advanced .search-box-container,
.school-search-summary .search-form-wrapper {
    background: #ffffff;
    padding: 25px;
    margin-bottom: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid #e1e5e9;
}

.filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto auto;
    gap: 15px;
    margin-bottom: 0;
    align-items: end;
}

.search-button-group {
    display: flex;
    gap: 12px;
    align-items: end;
}

/* ===== RESULTS STYLES ===== */
.search-results {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    margin-top: 25px;
    overflow: hidden;
}

.results-header {
    background: #0056b3;
    color: white;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.results-header h4 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: white;
}

.results-count {
    font-size: 15px;
    background: rgba(255,255,255,0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
}

.results-table-container {
    overflow-x: auto;
}

.schools-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
    min-width: 800px;
}

.schools-table th {
    background: #f8f9fa;
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    border-bottom: 3px solid #0056b3;
    color: #2c3e50;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.schools-table td {
    padding: 16px 20px;
    border-bottom: 1px solid #e9ecef;
    color: #495057;
    font-weight: 500;
}

.schools-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.schools-table tbody tr:hover {
    background: #e7f3ff;
}

.details-button {
    padding: 10px 18px;
    background: #0056b3;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.details-button:hover {
    background: #004494;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 86, 179, 0.3);
}

/* ===== GRID SEARCH STYLES ===== */
.school-search-grid .search-controls-panel {
    background: white;
    padding: 25px;
    margin-bottom: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid #e1e5e9;
}

.school-search-grid .filter-section {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto auto;
    gap: 15px;
    margin-bottom: 20px;
    align-items: end;
}

.school-search-grid .search-actions {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.results-summary {
    background: white;
    padding: 20px 25px;
    margin-bottom: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.summary-stats {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.summary-stats span {
    padding: 10px 20px;
    background: #f8f9fa;
    border-radius: 25px;
    font-size: 14px;
    border: 2px solid #e9ecef;
    font-weight: 600;
    color: #495057;
}

.summary-stats {
    color: #0056b3;
    font-size: 18px;
}

/* Grid View */
.search-results-grid {
    display: block;
    margin-top: 25px;
}

.schools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 25px;
    width: 100%;
}

.school-card {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    width: 100%;
    height: fit-content;
}

.school-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
    border-color: #0056b3;
}

.card-header {
    background: #0056b3;
    color: white;
    padding: 20px;
    position: relative;
}

.school-name {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 8px 0;
    line-height: 1.3;
    color: white;
}

.school-code {
    font-size: 15px;
    opacity: 0.95;
    margin: 0;
    font-weight: 500;
    color: white;
}

.card-body {
    padding: 20px;
}

/* OPTIMIZED MOBILE GRID LAYOUT */
.school-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.meta-label {
    font-size: 12px;
    text-transform: uppercase;
    color: #6c757d;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.meta-value {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
}

.classes-preview {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.classes-preview .meta-label {
    margin-bottom: 8px;
    color: #495057;
}

.class-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.class-tag {
    background: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #dee2e6;
    color: #495057;
    transition: all 0.2s ease;
}

.class-tag:hover {
    border-color: #0056b3;
    color: #0056b3;
}

.seats-highlight {
    text-align: center;
    padding: 20px;
    background: #e7f3ff;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #0056b3;
}

.seats-count {
    font-size: 36px;
    font-weight: 700;
    color: #0056b3;
    line-height: 1;
    margin-bottom: 6px;
}

.seats-label {
    font-size: 14px;
    color: #495057;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-actions {
    display: flex;
    gap: 12px;
}

.card-button {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.details-btn {
    background: #0056b3;
    color: white;
}

.details-btn:hover {
    background: #004494;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 86, 179, 0.3);
}

/* ===== MODAL STYLES ===== */
.school-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    width: 95%;
    max-width: 900px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.modal-header {
    background: #0056b3;
    color: white;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: white;
}

.close-modal {
    font-size: 28px;
    cursor: pointer;
    padding: 4px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-modal:hover {
    background: rgba(255,255,255,0.2);
}

.modal-body {
    padding: 25px;
}

.school-info h4 {
    margin: 0 0 20px 0;
    color: #0056b3;
    font-size: 22px;
    font-weight: 600;
    border-bottom: 3px solid #0056b3;
    padding-bottom: 10px;
}

.school-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.school-meta p {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    color: #495057;
}

.school-meta {
    color: #2c3e50;
}

.seat-details h5 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 20px;
    font-weight: 600;
    padding-bottom: 12px;
    border-bottom: 2px solid #0056b3;
}

.class-section {
    margin-bottom: 25px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    overflow: hidden;
}

.class-section h6 {
    margin: 0;
    color: white;
    font-size: 18px;
    background: #0056b3;
    padding: 15px 20px;
    font-weight: 600;
}

.table-responsive {
    overflow-x: auto;
}

.details-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
    min-width: 500px;
}

.details-table th {
    background: #f8f9fa;
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    border: 1px solid #dee2e6;
    color: #2c3e50;
}

.details-table td {
    padding: 14px 16px;
    border: 1px solid #dee2e6;
    color: #495057;
    font-weight: 500;
}

.class-total {
    background: #e7f3ff !important;
    font-weight: 600;
}

.overall-total {
    text-align: center;
    padding: 20px;
    background: #0056b3;
    color: white;
    margin-top: 25px;
    border-radius: 8px;
}

.overall-total p {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

/* ===== LOADING STATES ===== */
.loading-state {
    text-align: center;
    padding: 50px 30px;
    color: #6c757d;
}

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

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

/* ===== UTILITY STYLES ===== */
.loading, .no-results {
    text-align: center;
    padding: 50px 30px;
    color: #6c757d;
    font-size: 16px;
}

.error {
    color: #dc3545;
    text-align: center;
    padding: 20px;
    background: #f8d7da;
    border: 2px solid #f5c6cb;
    margin: 20px 0;
    border-radius: 8px;
    font-weight: 600;
}

.pagination-container {
    padding: 20px;
    text-align: center;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 0 0 10px 10px;
}

.pagination {
    display: inline-flex;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination a,
.pagination span {
    padding: 10px 16px;
    border: 2px solid #dee2e6;
    text-decoration: none;
    color: #0056b3;
    font-size: 15px;
    display: inline-block;
    min-width: 45px;
    text-align: center;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.pagination a:hover {
    background: #0056b3;
    color: white;
    border-color: #0056b3;
}

.pagination .current {
    background: #0056b3;
    color: white;
    border-color: #0056b3;
}

/* ===== MOBILE OPTIMIZATIONS ===== */
@media (max-width: 1024px) {
    .search-filters,
    .filter-row,
    .school-search-grid .filter-section {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .search-button-group {
        grid-column: 1 / -1;
        display: flex;
        gap: 12px;
        margin-top: 10px;
    }
}

@media (max-width: 768px) {
    .school-search-container {
        padding: 15px;
    }
    
    .search-header {
        padding: 20px 15px;
        margin-bottom: 20px;
    }
    
    .search-header h3 {
        font-size: 24px;
    }
    
    .search-filters,
    .filter-row,
    .school-search-grid .filter-section {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 15px;
    }
    
    .search-button-group {
        grid-column: 1;
        flex-direction: column;
        gap: 10px;
    }
    
    .search-button, .reset-button {
        width: 100%;
        min-width: auto;
    }
    
    .school-search-classic .class-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .school-search-classic .school-results {
        padding: 15px;
    }
    
    .school-search-classic .school-meta {
        flex-direction: column;
        gap: 10px;
        padding: 12px;
    }
    
    .school-search-classic .records-grid {
        padding: 12px;
        gap: 10px;
    }
    
    .results-header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        padding: 15px 20px;
    }
    
    .schools-table th,
    .schools-table td {
        padding: 12px 15px;
    }
    
    /* Enhanced Mobile Modal Styles */
    .school-modal {
        padding: 10px;
        align-items: flex-start;
    }
    
    .modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 90vh;
        margin: 0;
        border-radius: 0;
    }
    
    .modal-header {
        padding: 15px 20px;
        position: relative;
    }
    
    .modal-header h3 {
        font-size: 20px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .school-info h4 {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    .school-meta {
        grid-template-columns: 1fr;
        padding: 15px;
        gap: 10px;
    }
    
    .details-table th,
    .details-table td {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .class-section h6 {
        padding: 12px 15px;
        font-size: 16px;
    }
    
    .overall-total {
        padding: 15px;
        margin-top: 20px;
    }
    
    .pagination a,
    .pagination span {
        padding: 8px 12px;
        font-size: 14px;
        min-width: 40px;
    }
    
    /* Grid Search Mobile */
    .schools-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .results-summary {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        padding: 15px 20px;
    }
    
    .summary-stats {
        justify-content: center;
        gap: 15px;
    }
    
    /* Optimized mobile grid layout */
    .school-meta-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        margin-bottom: 15px;
    }
    
    .card-actions {
        flex-direction: column;
    }
    
    /* Mobile card layout */
    .school-card .card-body {
        padding: 15px;
    }
    
    .classes-preview {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .seats-highlight {
        padding: 15px;
        margin-bottom: 12px;
    }
    
    .seats-count {
        font-size: 32px;
    }
}

@media (max-width: 480px) {
    .search-header h3 {
        font-size: 22px;
    }
    
    .search-button {
        padding: 12px 20px;
        font-size: 15px;
    }
    
    .school-search-classic .available-value {
        font-size: 28px;
    }
    
    /* Enhanced Mobile Modal for Small Devices */
    .modal-content {
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 12px 15px;
    }
    
    .modal-header h3 {
        font-size: 18px;
    }
    
    .close-modal {
        font-size: 24px;
        width: 32px;
        height: 32px;
    }
    
    .modal-body {
        padding: 12px;
    }
    
    .details-table {
        font-size: 12px;
        min-width: 400px;
    }
    
    .details-table th,
    .details-table td {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    /* Grid Search Small Mobile */
    .school-search-grid .search-controls-panel {
        padding: 15px;
    }
    
    /* Enhanced mobile grid layout */
    .school-meta-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .meta-label {
        font-size: 11px;
    }
    
    .meta-value {
        font-size: 12px;
    }
    
    .class-tags {
        gap: 6px;
    }
    
    .class-tag {
        padding: 4px 8px;
        font-size: 11px;
    }
}

/* Additional mobile optimization for very small screens */
@media (max-width: 360px) {
    .school-search-container {
        padding: 10px;
    }
    
    .search-filters,
    .filter-row,
    .school-search-grid .filter-section {
        padding: 12px;
    }
    
    .schools-grid {
        gap: 15px;
    }
    
    .school-card {
        margin-bottom: 10px;
    }
    
    .card-body {
        padding: 12px;
    }
    
    .seats-count {
        font-size: 28px;
    }
    
    /* Compact mobile grid */
    .school-meta-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .meta-label {
        font-size: 10px;
    }
    
    .meta-value {
        font-size: 11px;
    }
    
    /* Ultra-small mobile modal */
    .modal-body {
        padding: 10px;
    }
    
    .school-info h4 {
        font-size: 16px;
    }
    
    .seat-details h5 {
        font-size: 16px;
    }
    
    .class-section h6 {
        font-size: 14px;
        padding: 10px 12px;
    }
}