/* Universal Search Styles */

.search-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 20px auto;
}

.search-input {
    width: 100%;
    padding: 15px 20px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 25px;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.search-input:focus {
    border-color: #007bff;
    box-shadow: 0 4px 20px rgba(0,123,255,0.3);
}

/* Search Suggestions */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 15px 15px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.suggestion-item {
    padding: 10px 20px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 14px;
}

.suggestion-item:hover,
.suggestion-item.selected {
    background-color: #f8f9fa;
}

/* Search Results */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 15px;
    max-height: 600px;
    overflow-y: auto;
    z-index: 999;
    display: none;
    box-shadow: 0 6px 25px rgba(0,0,0,0.15);
    margin-top: 5px;
}

.search-results-header {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    font-weight: bold;
    border-radius: 15px 15px 0 0;
}

.search-category {
    margin-bottom: 15px;
}

.search-category-title {
    padding: 10px 20px;
    background: #e9ecef;
    font-weight: bold;
    font-size: 14px;
    text-transform: uppercase;
    color: #495057;
    margin: 0;
    border-bottom: 1px solid #ddd;
}

.search-result-item {
    padding: 12px 20px;
    border-bottom: 1px solid #f1f1f1;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-result-item:hover {
    background-color: #f8f9fa;
    transform: translateX(3px);
}

.search-result-item:last-child {
    border-bottom: none;
    border-radius: 0 0 15px 15px;
}

.result-title {
    font-weight: bold;
    color: #007bff;
    font-size: 16px;
    margin-bottom: 4px;
}

.result-meta {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 4px;
}

.result-preview {
    font-size: 13px;
    color: #495057;
    line-height: 1.4;
}

.result-type-badge {
    display: inline-block;
    background: #007bff;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    margin-right: 8px;
}

.result-type-badge.author { background: #28a745; }
.result-type-badge.title { background: #17a2b8; }
.result-type-badge.movie { background: #ffc107; color: #212529; }
.result-type-badge.director { background: #6f42c1; }
.result-type-badge.writing { background: #fd7e14; }
.result-type-badge.guitar { background: #e83e8c; }

/* Loading State */
.search-loading {
    padding: 20px;
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

.search-loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* No Results */
.search-no-results {
    padding: 30px 20px;
    text-align: center;
    color: #6c757d;
}

.search-no-results h3 {
    margin-bottom: 10px;
    color: #495057;
}

/* Clear Button */
.search-clear {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    color: #6c757d;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.search-clear:hover {
    background: #f8f9fa;
    color: #495057;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .search-container {
        max-width: 100%;
        margin: 15px 0;
    }
    
    .search-input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 12px 15px;
    }
    
    .search-results {
        max-height: 400px;
        margin-top: 2px;
    }
    
    .result-title {
        font-size: 15px;
    }
}