/* Full-screen modal backdrop */
.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center; /* horizontal center */
    align-items: center;     /* vertical center */
    z-index: 1000;
    overflow-y: auto;
    transition: opacity 0.3s ease;
}


/* Hidden state */
.search-modal.hidden {
    display: none;
}

/* Modal content box */
.search-modal-content {
    background: #F8F8F8;
    min-height: 90%;
    width: 90%;
    border-radius: 8px;
    box-shadow: 0 5px 30px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 3rem;
    gap: 15px;
}

.search-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 5rem;
    background-color: #1E4B78;
    padding: 2rem;
    width: 100%;
}

/* Close button */
.search-modal-close {
    font-size: 4rem;
    font-weight: bold;
    cursor: pointer;
    color: white;
    margin-right: 1rem;
}

.modal-search-wrapper {
    border: none;
    background-color: transparent;
}

.advanced-search-toggle-wrapper {
    margin-top: 2rem;
}

#advanced-search-container {
    display: none; 
    margin-top: 0.5rem;
}

.modal-search-btn {
    display: flex;
    justify-content: center; 
    align-items: center; 
    font-size: 1rem;
    height: 2.2rem;
    border: 2px solid white;
    border-radius: 10px;
    background-color: #1E4B78;
    margin-left: 1rem;
}

.modal-search-btn:hover {
    color: #1E4B78;
    border: 2px solid #1E4B78;
    background-color: white;
}

.modal-advanced-search-button {
    background-color: white;
    color: #1E4B78;
    border-radius: 10px;
}

/* Search input at top */


.modal-input-styling {
    width: 14rem;
    padding: 0.4rem 1rem;
    font-size: 1rem;
    color: #2f5464;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
}

.search-box-text {
    display: flex;
    font-size: 2rem;
    gap: 0.3rem;
}

.modal-search-text {
    color: #3782B4;
}

/* Container for results */
#searchResults {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    align-items: center;
    justify-items: center;
    gap: 1rem;
    max-height: 50rem;
    width: 80%;
}

.result-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    border-radius: 12px;
    border: 2px solid #F2F2F2;
    background-color: white;
    padding: 0.5rem;
    width: 100%; /* Let grid handle width */
    max-width: 20rem; /* Don’t let it grow too large */
    box-sizing: border-box;
    transition: transform 0.2s ease; 
}

.result-item:hover {
    cursor: pointer;
    transform: scale(1.05); 
}


.result-item img {
    max-width: 100%;
    max-height: 11rem; 
    width: auto;
    display: block;
    margin: 0 auto;
    border-radius: 12px;
    object-fit: contain; 
}

.title-wrapper {
    display: flex;
    align-items: center;
    height: 3rem;
}

.result-item p {
    margin: 0.5rem 0 0 0;
    font-size: 1rem;
    text-align: center;
    word-break: break-word;
}


.modal-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px; /* space between buttons */
    margin-top: 10px;
}

.modal-pagination button {
    padding: 6px 12px;
    border: 1px solid #ccc;
    background-color: #fff;
    color: #333;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    min-width: 36px;
    transition: background-color 0.2s, color 0.2s;
}

.modal-pagination button:hover:not(:disabled) {
    background-color: #f0f0f0;
}

.modal-pagination button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.modal-pagination button.active {
    background-color: #1f2937; /* dark color for selected page */
    color: #fff;
    border-color: #1f2937;
}
