/* Pagefind Search Modal Styles - OneSignal/Klaviyo Style */

/* Make search inputs clickable */
#header-search-input,
#hero-search,
#search-input {
    cursor: pointer !important;
}

#header-search-input:hover,
#hero-search:hover,
#search-input:hover {
    cursor: pointer !important;
}

.pagefind-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: pagefind-modal-fade-in 0.2s ease-out;
}

.pagefind-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    cursor: pointer;
}

.pagefind-modal-content {
    position: relative;
    width: 100%;
    max-width: 800px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: pagefind-modal-slide-in 0.3s ease-out;
}

.pagefind-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
}

.pagefind-search-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

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

.pagefind-modal-input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 3rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    line-height: 1.5;
    background: #ffffff;
    transition: all 0.2s ease;
    outline: none;
}

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

.pagefind-modal-close {
    position: absolute;
    right: 1rem;
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.pagefind-modal-close:hover {
    color: #6b7280;
    background: #f3f4f6;
}

.pagefind-modal-body {
    max-height: 60vh;
    overflow-y: auto;
}

.pagefind-search-results {
    padding: 0;
}

.pagefind-result-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.pagefind-result-item:last-child {
    border-bottom: none;
}

.pagefind-result-item:hover,
.pagefind-result-item.pagefind-result-selected {
    background-color: #f8fafc;
    transform: translateX(4px);
}

.pagefind-result-title {
    font-weight: 600;
    font-size: 1rem;
    color: #1f2937;
    margin-bottom: 0.5rem;
    line-height: 1.3;
    display: flex;
    align-items: center;
}

.pagefind-result-title::before {
    content: "📄";
    margin-right: 0.5rem;
    font-size: 0.875rem;
    opacity: 0.6;
}

.pagefind-result-excerpt {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pagefind-result-url {
    font-size: 0.75rem;
    color: #9ca3af;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    display: flex;
    align-items: center;
}

.pagefind-result-url::before {
    content: "🔗";
    margin-right: 0.25rem;
    font-size: 0.625rem;
    opacity: 0.6;
}

.pagefind-no-results,
.pagefind-search-error {
    padding: 2rem;
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
}

.pagefind-search-error {
    color: #dc2626;
}

/* Animations */
@keyframes pagefind-modal-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes pagefind-modal-slide-in {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Dark mode support */
html[data-theme="dark"] .pagefind-search-modal,
body.dark-theme .pagefind-search-modal {
    background: rgba(0, 0, 0, 0.7);
}

html[data-theme="dark"] .pagefind-modal-content,
body.dark-theme .pagefind-modal-content {
    background: #1f2937;
    border-color: #374151;
}

html[data-theme="dark"] .pagefind-modal-header,
body.dark-theme .pagefind-modal-header {
    background: #1f2937;
    border-bottom-color: #374151;
}

html[data-theme="dark"] .pagefind-modal-input,
body.dark-theme .pagefind-modal-input {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

html[data-theme="dark"] .pagefind-modal-input:focus,
body.dark-theme .pagefind-modal-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

html[data-theme="dark"] .pagefind-search-icon,
html[data-theme="dark"] .pagefind-modal-close,
body.dark-theme .pagefind-search-icon,
body.dark-theme .pagefind-modal-close {
    color: #9ca3af;
}

html[data-theme="dark"] .pagefind-modal-close:hover,
body.dark-theme .pagefind-modal-close:hover {
    color: #d1d5db;
    background: #374151;
}

html[data-theme="dark"] .pagefind-result-item,
body.dark-theme .pagefind-result-item {
    border-bottom-color: #374151;
}

html[data-theme="dark"] .pagefind-result-item:hover,
html[data-theme="dark"] .pagefind-result-item.pagefind-result-selected,
body.dark-theme .pagefind-result-item:hover,
body.dark-theme .pagefind-result-item.pagefind-result-selected {
    background-color: #374151;
}

html[data-theme="dark"] .pagefind-result-title,
body.dark-theme .pagefind-result-title {
    color: #f9fafb;
}

html[data-theme="dark"] .pagefind-result-excerpt,
body.dark-theme .pagefind-result-excerpt {
    color: #d1d5db;
}

html[data-theme="dark"] .pagefind-result-url,
body.dark-theme .pagefind-result-url {
    color: #9ca3af;
}

html[data-theme="dark"] .pagefind-no-results,
html[data-theme="dark"] .pagefind-search-error,
body.dark-theme .pagefind-no-results,
body.dark-theme .pagefind-search-error {
    color: #9ca3af;
}

html[data-theme="dark"] .pagefind-search-error,
body.dark-theme .pagefind-search-error {
    color: #f87171;
}

/* Responsive design */
@media (max-width: 768px) {
    .pagefind-search-modal {
        padding: 1rem;
        align-items: flex-start;
    }
    
    .pagefind-modal-content {
        max-width: 100%;
        margin-top: 2rem;
    }
    
    .pagefind-modal-header {
        padding: 1rem;
    }
    
    .pagefind-result-item {
        padding: 0.875rem 1rem;
    }
    
    .pagefind-modal-body {
        max-height: 70vh;
    }
}

/* Scrollbar styling */
.pagefind-modal-body::-webkit-scrollbar {
    width: 6px;
}

.pagefind-modal-body::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.pagefind-modal-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.pagefind-modal-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Dark mode scrollbar */
html[data-theme="dark"] .pagefind-modal-body::-webkit-scrollbar-track,
body.dark-theme .pagefind-modal-body::-webkit-scrollbar-track {
    background: #374151;
}

html[data-theme="dark"] .pagefind-modal-body::-webkit-scrollbar-thumb,
body.dark-theme .pagefind-modal-body::-webkit-scrollbar-thumb {
    background: #6b7280;
}

html[data-theme="dark"] .pagefind-modal-body::-webkit-scrollbar-thumb:hover,
body.dark-theme .pagefind-modal-body::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Add a subtle highlight for search terms */
.pagefind-result-excerpt mark {
    background-color: rgba(59, 130, 246, 0.2);
    color: #1f2937;
    padding: 0.1em 0.2em;
    border-radius: 0.2em;
    font-weight: 500;
}

html[data-theme="dark"] .pagefind-result-excerpt mark,
body.dark-theme .pagefind-result-excerpt mark {
    background-color: rgba(59, 130, 246, 0.3);
    color: #f9fafb;
}

/* Sub-results (section/anchor links) styles */
.pagefind-sub-results {
    margin-top: 0.75rem;
    margin-left: 1.5rem;
    padding-left: 0.75rem;
    border-left: 2px solid #e5e7eb;
}

.pagefind-sub-result-item {
    padding: 0.5rem 0;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.pagefind-sub-result-item:hover {
    background-color: #f3f4f6;
    padding-left: 0.5rem;
}

.pagefind-sub-result-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
}

.pagefind-sub-result-title::before {
    content: "→";
    margin-right: 0.5rem;
    color: #9ca3af;
    font-size: 0.75rem;
}

.pagefind-sub-result-excerpt {
    font-size: 0.8125rem;
    color: #6b7280;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pagefind-sub-result-excerpt mark {
    background-color: rgba(59, 130, 246, 0.2);
    color: #1f2937;
    padding: 0.05em 0.15em;
    border-radius: 0.15em;
    font-weight: 500;
}

/* Dark mode for sub-results */
html[data-theme="dark"] .pagefind-sub-results,
body.dark-theme .pagefind-sub-results {
    border-left-color: #4b5563;
}

html[data-theme="dark"] .pagefind-sub-result-item:hover,
body.dark-theme .pagefind-sub-result-item:hover {
    background-color: #4b5563;
}

html[data-theme="dark"] .pagefind-sub-result-title,
body.dark-theme .pagefind-sub-result-title {
    color: #d1d5db;
}

html[data-theme="dark"] .pagefind-sub-result-excerpt,
body.dark-theme .pagefind-sub-result-excerpt {
    color: #9ca3af;
}

html[data-theme="dark"] .pagefind-sub-result-excerpt mark,
body.dark-theme .pagefind-sub-result-excerpt mark {
    background-color: rgba(59, 130, 246, 0.3);
    color: #f9fafb;
}