/* Search Modal Styles */
.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 1rem;
    overflow-y: auto;
    animation: fadeIn 0.2s ease-in-out;
}

.search-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 1;
}

.search-modal-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 48rem;
    background-color: white;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    margin-top: 5vh;
    animation: slideDown 0.3s ease-out;
}

.search-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.search-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.search-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    border: none;
    background-color: #f3f4f6;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.search-modal-close:hover {
    background-color: #e5e7eb;
    color: #111827;
}

.search-modal-form {
    padding: 1.5rem;
}

.search-modal-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-modal-icon {
    position: absolute;
    left: 1rem;
    font-size: 1.5rem;
    color: #9ca3af;
    pointer-events: none;
}

.search-modal-input {
    width: 100%;
    padding: 1rem 3rem 1rem 3.5rem;
    font-size: 1.125rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    outline: none;
    transition: all 0.2s;
}

/* Hide browser's native clear button for search inputs */
.search-modal-input::-webkit-search-cancel-button {
    display: none;
    -webkit-appearance: none;
}

.search-modal-input::-ms-clear {
    display: none;
}

.search-modal-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-modal-clear {
    position: absolute;
    right: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: none;
    background-color: transparent;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.25rem;
}

.search-modal-clear:hover {
    color: #111827;
}

.search-modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    gap: 1rem;
}

.search-modal-spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.search-modal-loading p {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0;
}

.search-modal-suggestions {
    max-height: 28rem;
    overflow-y: auto;
    padding: 0.5rem;
}

.search-suggestion-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 0.75rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    cursor: pointer;
}

.search-suggestion-item:hover {
    background-color: #f9fafb;
}

.search-suggestion-content {
    flex: 1;
    min-width: 0;
}

.search-suggestion-title {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    margin: 0 0 0.5rem 0;
    line-height: 1.4;
}

.search-suggestion-description {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0 0 0.5rem 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-suggestion-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.search-suggestion-category,
.search-suggestion-date {
    font-size: 0.75rem;
    color: #9ca3af;
}

.search-suggestion-category {
    padding: 0.25rem 0.5rem;
    background-color: #f3f4f6;
    border-radius: 0.375rem;
    font-weight: 500;
}

.search-suggestion-icon {
    flex-shrink: 0;
    font-size: 1.25rem;
    color: #d1d5db;
    transition: all 0.2s;
}

.search-suggestion-item:hover .search-suggestion-icon {
    color: #3b82f6;
    transform: translateX(0.25rem);
}

.search-modal-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
}

.search-modal-no-results p {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0;
}

.search-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    background-color: #f9fafb;
    border-radius: 0 0 1rem 1rem;
}

.search-modal-footer p {
    margin: 0;
    text-align: center;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-2rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Responsive styles */
@media (max-width: 640px) {
    .search-modal {
        padding: 0;
    }
    
    .search-modal-content {
        margin-top: 0;
        border-radius: 0;
        min-height: 100vh;
    }
    
    .search-modal-header {
        padding: 1rem;
    }
    
    .search-modal-title {
        font-size: 1.125rem;
    }
    
    .search-modal-form {
        padding: 1rem;
    }
    
    .search-modal-input {
        font-size: 1rem;
        padding: 0.875rem 2.75rem 0.875rem 3rem;
    }
    
    .search-modal-suggestions {
        max-height: calc(100vh - 16rem);
    }
}
