/*
 * University Admissions Management - Public Stylesheet
 * Version: 5.5.1
 */

/* Main Container */
#uam-search-container {
    display: flex;
    flex-direction: column; /* Stack filters on top of results */
    gap: 2rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Filter Panel */
#uam-filter-panel {
    width: 100%;
    background: #fdfdfd;
    padding: 1.5rem 2rem;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-sizing: border-box;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.07);
}

#uam-filter-panel h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: #333;
    font-size: 1.4em;
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
}

#uam-filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem 2rem; /* row-gap column-gap */
    align-items: flex-start;
}

.filter-group {
    flex: 1 1 220px; /* Grow, shrink, with a basis of 220px */
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Hide the h4 titles inside the groups as they take up space and might not be needed in a horizontal layout */
#uam-filter-panel h4 {
    display: none;
}

.filter-control label,
#uam-filter-panel > .filter-group > label {
    display: block;
    margin-bottom: 0; /* Handled by gap on filter-group */
    font-weight: 600;
    color: #555;
    font-size: 0.95em;
}

.filter-control input[type="checkbox"],
.filter-control input[type="radio"] {
    margin-right: 8px;
}

.filter-control input[type="text"],
.filter-control input[type="number"],
.filter-control select {
    width: 100%;
    padding: 10px;
    border-radius: 6px; /* Slightly more rounded */
    border: 1px solid #ccc;
    box-sizing: border-box;
    transition: border-color 0.2s;
    background-color: #fff;
}

.filter-control input[type="text"]:focus,
.filter-control input[type="number"]:focus,
.filter-control select:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

.filter-control-inline {
    display: flex;
    gap: 10px;
}
.filter-control-inline input {
    text-align: center;
}

/* Style for hierarchical program list */
.uam-checklist {
    list-style: none;
    padding-left: 0;
    margin: 0;
}
.uam-checklist ul {
    padding-left: 20px;
    list-style: none;
    margin-top: 5px;
}
.uam-checklist label {
    font-weight: normal !important;
    display: flex;
    align-items: center;
}

.uam-scrollable-checkboxes {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 6px;
    background-color: #fff;
}
.uam-scrollable-checkboxes-short {
    max-height: 120px;
}

.uam-scrollable-checkboxes p {
    color: #777;
    font-style: italic;
    margin: 0;
    padding: 5px;
}
.uam-scrollable-checkboxes label {
    display: block;
    margin-bottom: 5px;
    font-weight: normal;
}

/* Button Group Styling */
.filter-group-buttons {
    flex-basis: 100%; /* Take full width to force a new line */
    display: flex;
    justify-content: flex-end; /* Align buttons to the right */
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

#uam-filter-form button {
    width: auto; /* Buttons are no longer full-width */
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: background-color 0.2s, transform 0.1s;
}
#uam-filter-form button:active {
    transform: translateY(1px);
}

#uam-filter-submit {
    background-color: #0073aa;
    color: white;
}
#uam-filter-submit:hover {
    background-color: #005177;
}

#uam-filter-reset {
    background-color: #f3f4f6; /* Lighter gray */
    color: #374151; /* Darker text */
    border: 1px solid #d1d5db;
}
#uam-filter-reset:hover {
    background-color: #e5e7eb;
}


/* Results Area */
#uam-results-area {
    flex-grow: 1;
    position: relative;
    min-width: 0; /* Prevents flexbox overflow */
}

#uam-results-summary {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem; /* Adjusted padding */
    font-weight: 600;
    color: #444;
    background-color: #eef7ff;
    border-radius: 6px;
    border: 1px solid #cce5ff;
}

/* Loading Spinner */
#uam-loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}
#uam-loading-spinner div {
  box-sizing: border-box;
  display: block;
  width: 64px;
  height: 64px;
  border: 8px solid #0073aa;
  border-radius: 50%;
  animation: uam-loading-spinner-anim 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
  border-color: #0073aa transparent transparent transparent;
}
@keyframes uam-loading-spinner-anim {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}


#uam-results-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

#uam-results-table th,
#uam-results-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: middle;
}

#uam-results-table thead th {
    background-color: #f5f5f5;
    font-weight: 600;
    color: #333;
}

#uam-results-table tbody tr {
    transition: background-color 0.2s;
}

#uam-results-table tbody tr:last-child td {
    border-bottom: none;
}

#uam-results-table tbody tr:hover {
    background-color: #f0f8ff;
}

.uam-view-details-btn {
    background-color: #2271b1;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}
.uam-view-details-btn:hover {
    background-color: #1e639a;
}

/* Modal Styles */
#uam-details-modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.uam-modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 25px 30px;
    border: 1px solid #888;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    animation: uam-modal-anim 0.4s;
}

@keyframes uam-modal-anim {
    from {transform: translateY(-30px); opacity: 0;}
    to {transform: translateY(0); opacity: 1;}
}

.uam-modal-close {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}
.uam-modal-close:hover,
.uam-modal-close:focus {
    color: black;
}

.uam-modal-header {
    display: flex;
    gap: 20px;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 15px;
}
.uam-modal-logo {
    width: 100px;
    height: 100px;
    object-fit: contain;
    border-radius: 5px;
    flex-shrink: 0;
    border: 1px solid #eee;
}
.uam-modal-header div { flex-grow: 1; }
.uam-modal-header h2, .uam-modal-header h3, .uam-modal-header p {
    margin: 0;
}
.uam-modal-header h2 { font-size: 1.8em; color: #222; }
.uam-modal-header p { color: #666; margin-bottom: 5px; }
.uam-modal-header h3 { font-size: 1.2em; color: #005a87; font-weight: 600; margin-bottom: 8px;}

#uam-modal-body h4 {
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.1em;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.uam-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px 20px;
    margin-bottom: 15px;
}
.uam-modal-grid > div {
    background: #f9f9f9;
    padding: 10px;
    border-radius: 4px;
    border-left: 3px solid #0073aa;
}
.uam-modal-grid strong {
    color: #444;
    display: block;
    margin-bottom: 4px;
}
.uam-modal-grid ul {
    margin: 0;
    padding-left: 20px;
}
.uam-expired {
    color: #dc3232;
    font-weight: bold;
}

.uam-modal-section {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #eee;
}
.uam-modal-section p:first-child { margin-top: 0; }
.uam-modal-section p:last-child { margin-bottom: 0; }
.uam-modal-section ul { margin: 0; padding-left: 20px; }

.uam-edit-link {
    display: inline-block;
    margin-top: 20px;
    background: #f0f0f0;
    padding: 8px 15px;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-weight: 600;
}
.uam-edit-link:hover {
    background: #e0e0e0;
}

.uam-program-link-btn {
    display: inline-block;
    margin-top: 5px;
    background-color: #2271b1;
    color: #fff;
    padding: 8px 16px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 600;
    transition: background-color 0.2s ease-in-out;
}

.uam-program-link-btn:hover {
    background-color: #1e639a;
    color: #fff;
}


/* Responsive adjustments */
/* The main responsive change is now the default. We only need smaller screen adjustments. */
@media (max-width: 782px) {
    .filter-group {
        flex-basis: 200px; /* Allow more filters per row on tablet */
    }
}

@media (max-width: 600px) {
    #uam-filter-panel {
        padding: 1rem;
    }
    #uam-filter-form {
        gap: 1.5rem 1rem; /* reduce column gap */
    }
    .filter-group {
        flex-basis: 100%; /* Make each filter take full width on small screens */
    }
    .uam-modal-header {
        flex-direction: column;
        text-align: center;
    }
    .uam-modal-grid {
        grid-template-columns: 1fr;
    }
}
