/* Search Modal Styles */
.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 10vh 20px 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    font-family: 'Open Sans', sans-serif;
}

.search-modal.active {
    opacity: 1;
    visibility: visible;
}

.search-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: opacity 0.3s ease;
}

.search-modal-content {
    position: relative;
    width: 100%;
    max-width: 700px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(-20px) scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.search-modal.active .search-modal-content {
    transform: translateY(0) scale(1);
}

/* Header */
.search-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 24px 0;
    border-bottom: 1px solid #e5e7eb;
}

.search-modal-title {
    font-size: 24px;
    font-weight: 600;
    color: #111827;
    margin: 0;
    font-family: 'Quicksand', sans-serif;
}

.search-modal-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #6b7280;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-modal-close:hover {
    background: #f3f4f6;
    color: #111827;
}

/* Body */
.search-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.search-form {
    width: 100%;
}

.search-input-wrapper {
    position: relative;
    margin-bottom: 24px;
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 16px 50px 16px 56px;
    font-size: 18px;
    font-family: 'Open Sans', sans-serif;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #f9fafb;
    transition: all 0.2s ease;
    outline: none;
}

.search-input:focus {
    border-color: #4299e1;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.search-input-loader {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.search-input-wrapper.searching .search-input-loader {
    opacity: 1;
    visibility: visible;
}

.search-spinner {
    animation: rotate 2s linear infinite;
    width: 24px;
    height: 24px;
}

.search-spinner .path {
    stroke: #4299e1;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* Suggestions */
.search-suggestions {
    margin-bottom: 24px;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.search-suggestions.hidden {
    opacity: 0;
    display: none;
}

.search-suggestion-group {
    margin-bottom: 20px;
}

.search-suggestion-title {
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 12px 0;
    font-family: 'Quicksand', sans-serif;
}

.search-suggestion-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.search-suggestion-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Open Sans', sans-serif;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-suggestion-item:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
    transform: translateY(-1px);
}

.suggestion-icon {
    width: 16px;
    height: 16px;
    color: #6b7280;
}

/* Results */
.search-results {
    display: none;
}

.search-results.active {
    display: block;
}

.search-result-item {
    display: block;
    width: 100%;
    padding: 16px;
    text-align: left;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    font-family: 'Open Sans', sans-serif;
}

.search-result-item:hover,
.search-result-item:focus {
    background: #f9fafb;
    border-color: #4299e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transform: translateX(4px);
}

.search-result-item.selected {
    background: #eff6ff;
    border-color: #4299e1;
}

.search-result-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 4px 0;
    font-family: 'Quicksand', sans-serif;
}

.search-result-description {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.search-result-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    font-size: 12px;
    color: #9ca3af;
}

.search-no-results {
    text-align: center;
    padding: 48px 24px;
    color: #6b7280;
}

.search-no-results-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    color: #d1d5db;
}

.search-no-results-text {
    font-size: 18px;
    font-weight: 500;
    margin: 0 0 8px 0;
}

.search-no-results-hint {
    font-size: 14px;
    color: #9ca3af;
}

/* Footer */
.search-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.search-shortcuts {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.search-shortcut {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #6b7280;
}

.search-shortcut kbd {
    display: inline-block;
    padding: 2px 6px;
    font-size: 11px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Responsive */
@media (max-width: 640px) {
    .search-modal {
        padding: 0;
    }
    
    .search-modal-content {
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .search-modal-header {
        position: -webkit-sticky;
        position: sticky;
        top: 0;
        background: #ffffff;
        z-index: 10;
    }
    
    .search-shortcuts {
        font-size: 11px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .search-modal-content {
        background: #1f2937;
    }
    
    .search-modal-header {
        border-bottom-color: #374151;
        padding-bottom: 10px;
    }
    
    .search-modal-title {
        color: #f9fafb;
    }
    
    .search-modal-close {
        color: #9ca3af;
    }
    
    .search-modal-close:hover {
        background: #374151;
        color: #f9fafb;
    }
    
    .search-input {
        background: #111827;
        border-color: #374151;
        color: #f9fafb;
    }
    
    .search-input:focus {
        background: #1f2937;
        border-color: #4299e1;
    }
    
    .search-suggestion-item {
        background: #374151;
        border-color: #4b5563;
        color: #e5e7eb;
    }
    
    .search-suggestion-item:hover {
        background: #4b5563;
        border-color: #6b7280;
    }
    
    .search-result-item {
        background: #1f2937;
        border-color: #374151;
    }
    
    .search-result-item:hover {
        background: #374151;
    }
    
    .search-result-title {
        color: #f9fafb;
    }
    
    .search-modal-footer {
        background: #111827;
        border-top-color: #374151;
    }
    
    .search-shortcut kbd {
        background: #374151;
        border-color: #4b5563;
    }
}