/**
 * Search Modal Styles
 */

/* Prevent body scroll when modal is open */
body.modal-open {
    /* overflow: hidden; */
}

/* Modal Overlay */
.search-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                backdrop-filter 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Modal Content Container */
.search-modal-content {
    position: relative;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.95) 0%, rgba(20, 20, 20, 0.98) 100%);
    display: flex;
    flex-direction: column;
    transform: scale(0.95) translateY(20px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-modal.active .search-modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.95) translateY(20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Close Button */
.search-modal-close {
    position: absolute;
    top: 50px;
    right: 30px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: rotate(0deg);
}

body.admin-bar .search-modal-close {
    top: 80px;
}

.search-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg) scale(1.1);
}

/* Search Header */
.search-modal-header {
    padding: 120px 50px 50px 50px;
    flex-shrink: 0;
}

body.admin-bar .search-modal-header {
    padding-top: 120px;
}

/* Search Input */
.search-modal-input {
    width: 100% !important;
    max-width: 900px;
    margin: auto;
    display: flex;
    background: #D9D9D9;
    border: none !important;
    border-radius: 16px !important;
    padding: 18px 28px !important;
    font-size: 18px;
    color: #fff;
    outline: none;
    height: 48px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    text-align: center;
    font-style: italic;
    text-transform: uppercase;
    font-weight: 500;
    font-family: "Josefin Sans", Sans-serif;
}

.search-modal-input:focus {
    /* border: 2px solid rgba(255, 255, 255, 0.25) !important; */
    background: rgba(255, 255, 255, 0.15) !important;
    /* box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3), 
                0 0 0 4px rgba(255, 255, 255, 0.05) !important; */
    transform: translateY(-2px);
}

.search-modal-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
}

/* Modal Body */
.search-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0px 10px 50px 10px;
    position: relative;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* Custom Scrollbar */
.search-modal-body::-webkit-scrollbar {
    width: 8px;
}

.search-modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.search-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.search-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Search Results Grid */
.search-results-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 40px;
}

/* Result Item */
.search-result-item {
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    animation: resultFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    flex: 0 1 calc((100% - 80px) / 3); /* 3 columns with 40px gap */
}

/* Stagger animation for results */
.search-result-item:nth-child(1) { animation-delay: 0.05s; }
.search-result-item:nth-child(2) { animation-delay: 0.1s; }
.search-result-item:nth-child(3) { animation-delay: 0.15s; }
.search-result-item:nth-child(4) { animation-delay: 0.2s; }
.search-result-item:nth-child(5) { animation-delay: 0.25s; }
.search-result-item:nth-child(6) { animation-delay: 0.3s; }
.search-result-item:nth-child(7) { animation-delay: 0.35s; }
.search-result-item:nth-child(8) { animation-delay: 0.4s; }
.search-result-item:nth-child(9) { animation-delay: 0.45s; }

@keyframes resultFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-result-article {
    position: relative;
    height: 100%;
    display: block;
}

.search-result-article a {
    display: block;
    position: relative;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

/* Result Image */
.search-result-image {
    position: relative;
    width: 100%;
    padding-top: 75%; /* 4:3 aspect ratio */
    overflow: hidden;
    background: #222;
    border-radius: 8px;
}

.search-result-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Result Content */
.search-result-content {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    padding: 20px;
    color: #fff;
    z-index: 2;
    text-align: center;
}

.search-result-type {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 12px;
    font-weight: 400;
}

.search-result-title {
    font-size: 18px!important;
    margin: 0 0 12px 0;
    line-height: 1.2;
    color: #fff!important;
    text-transform: uppercase;
}

.search-result-meta {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 300;
}

/* Hover Effects */
.search-result-article .overlay-nb {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 51.89%, rgba(0, 0, 0, 0.8) 100%);
    opacity: 1;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
    pointer-events: none;
    outline: none !important;
    border-radius: 8px;
}

.search-result-article:hover .search-result-image img {
    transform: scale(1.08);
}

.search-result-article:hover .overlay-nb {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.41) 71.15%, rgba(0, 0, 0, 0.85) 100%);
}

.search-result-article {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-result-article:hover {
    transform: translateY(-4px);
}

/* Loading Spinner */
.search-loading {
    text-align: center;
    padding: 40px 20px;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.loading-spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* No Results */
.search-no-results {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.6);
    opacity: 0;
    animation: fadeIn 0.4s ease 0.2s forwards;
}

.search-no-results p {
    font-size: 18px;
    margin: 0;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .search-results-grid {
        gap: 24px;
    }

    .search-result-item {
        flex: 0 1 calc((100% - 24px) / 2); /* 2 columns with 24px gap */
    }

}

@media (max-width: 768px) {
    .search-results-grid {
        gap: 20px;
    }

    .search-result-item {
        flex: 0 1 100%; /* Single column */
    }
    
    .search-modal-close {
        top: 50px;
        right: 50px;
        width: 36px;
        height: 36px;
        font-size: 28px;
    }
    
    .search-modal-input {
        padding: 14px 20px;
    }
    
    .search-result-title {
        font-size: 18px!important;
    }
    
    .search-result-type {
        font-size: 9px;
        letter-spacing: 1.5px;
    }
    
    .search-result-meta {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .search-modal-header,
    .search-modal-body {
        padding: 60px 20px 50px 20px;
    }
    
    .search-modal-close {
        top: 20px!important;
        right: 20px!important;
    }
    
    .search-result-title {
        font-size: 16px!important;
    }
    
    .search-result-type {
        font-size: 8px;
        letter-spacing: 1px;
    }
    
    .search-result-meta {
        font-size: 10px;
    }
}



/* Print Styles */
@media print {
    .search-modal {
        display: none !important;
    }
}
