/**
 * Program Search CSS
 * Styles for the program search and selection interface
 */

.sams-program-search-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.search-header {
    text-align: center;
    margin-bottom: 30px;
}

.search-header h2 {
    color: #333;
    margin-bottom: 10px;
    font-size: 28px;
}

.search-header p {
    color: #666;
    font-size: 16px;
}

/* Search Form */
.search-form-container {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.search-row {
    display: grid;
    grid-template-columns: 2fr 2fr 1.5fr 1fr;
    gap: 20px;
    align-items: end;
}

@media (max-width: 768px) {
    .search-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

.search-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
}

.search-field input,
.search-field select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.search-field input:focus,
.search-field select:focus {
    outline: none;
    border-color: #0073aa;
}

.search-btn {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #0073aa, #005a87);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,115,170,0.3);
}

/* Results Header */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 0;
    border-bottom: 1px solid #e0e0e0;
}

.results-header h3 {
    margin: 0;
    color: #333;
}

.results-sort {
    display: flex;
    align-items: center;
    gap: 10px;
}

.results-sort label {
    font-weight: 500;
    color: #666;
}

.results-sort select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Programs Grid */
.programs-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .programs-list {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

.program-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.program-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: #0073aa;
}

.program-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.program-title {
    margin: 0;
    font-size: 18px;
    color: #333;
    line-height: 1.3;
    flex: 1;
    margin-right: 10px;
}

.program-level {
    background: #0073aa;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.program-details {
    margin-bottom: 20px;
}

.program-details p {
    margin: 8px 0;
    color: #666;
    font-size: 14px;
    display: flex;
    align-items: center;
}

.program-institute {
    font-weight: 500;
    color: #333;
}

.program-description {
    margin-top: 12px;
    font-size: 13px;
    line-height: 1.4;
    color: #777;
}

.program-actions {
    display: flex;
    gap: 10px;
}

.btn-outline {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #0073aa;
    background: transparent;
    color: #0073aa;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-outline:hover {
    background: #0073aa;
    color: white;
}

.btn-primary {
    flex: 1;
    padding: 10px 15px;
    background: #0073aa;
    color: white;
    border: 2px solid #0073aa;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: #005a87;
    border-color: #005a87;
}

/* Loading States */
.search-loading {
    text-align: center;
    padding: 60px 20px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner + p {
    color: #666;
    margin: 0;
}

/* Initial/No Results States */
.initial-message,
.no-results,
.search-error {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;
}

.initial-message h3,
.no-results h3,
.search-error h3 {
    margin: 0 0 10px 0;
    color: #333;
}

.initial-message p,
.no-results p,
.search-error p {
    margin: 0;
    color: #666;
}

.search-error button {
    margin-top: 15px;
    padding: 10px 20px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

/* Pagination */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin: 30px 0;
}

.page-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.page-btn:hover {
    background: #f0f0f0;
    border-color: #0073aa;
}

.page-btn.active {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

.page-dots {
    padding: 8px 4px;
    color: #999;
}

/* Program Modal */
.program-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 600px;
    margin: 50px auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 25px;
}

.program-detail-item {
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.program-detail-item:last-child {
    border-bottom: none;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px 25px;
    border-top: 1px solid #eee;
}

.btn-secondary {
    padding: 10px 20px;
    border: 2px solid #ddd;
    background: white;
    color: #666;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    border-color: #999;
    color: #333;
}

/* Responsive Design */
@media (max-width: 480px) {
    .sams-program-search-container {
        padding: 15px;
    }
    
    .search-form-container {
        padding: 20px;
    }
    
    .program-card {
        padding: 15px;
    }
    
    .program-actions {
        flex-direction: column;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px auto;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 15px;
    }
}
