/**
 * Arama Sistemi Stilleri
 * Search box, suggestions dropdown, results grid
 */

/* === Search Container === */
.search-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    flex-shrink: 1;
}

/* === Search Input === */
.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

#search-input {
    width: 100%;
    padding: 0.75rem 3rem 0.75rem 3rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: white;
}

#search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Dark Mode - Search Input */
body.dark-mode #search-input {
    background: #2d3238;
    border-color: #3a3f47;
    color: #e9ecef;
}

body.dark-mode #search-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

body.dark-mode .search-icon {
    color: #adb5bd;
}

body.dark-mode .search-clear-btn {
    color: #718096;
}

body.dark-mode .search-clear-btn:hover {
    color: #e53e3e;
}

.search-icon {
    position: absolute;
    left: 1rem;
    color: #718096;
    pointer-events: none;
}

.search-clear-btn {
    position: absolute;
    right: 1rem;
    background: none;
    border: none;
    color: #a0aec0;
    cursor: pointer;
    padding: 0.25rem;
    display: none;
}

#search-input:not(:placeholder-shown) + .search-icon + .search-clear-btn {
    display: block;
}

.search-clear-btn:hover {
    color: #e53e3e;
}

/* === Suggestions Dropdown === */
#search-suggestions {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

#search-suggestions.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Dark Mode - Suggestions */
body.dark-mode #search-suggestions {
    background: #2d3238;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f7fafc;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: #f7fafc;
}

.suggestion-item svg {
    flex-shrink: 0;
    color: #a0aec0;
}

.suggestion-item span {
    flex: 1;
    color: #2d3748;
    font-size: 0.95rem;
}

.suggestion-item strong {
    color: #667eea;
    font-weight: 600;
}

/* === Search Filters === */
.search-filters {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    padding: 1rem 0;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.filter-group label {
    font-size: 0.9rem;
    color: #4a5568;
    font-weight: 500;
}

.filter-radio-group {
    display: flex;
    gap: 1rem;
}

.filter-radio {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.filter-radio input[type="radio"] {
    cursor: pointer;
}

.filter-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    width: 100px;
}

.filter-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
}

/* === Search Results === */
#search-results {
    margin-top: 2rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

#search-results.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.search-results-header {
    margin-bottom: 2rem;
    text-align: center;
}

.search-results-header h2 {
    color: #2d3748;
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.search-query {
    color: #718096;
    font-size: 1rem;
}

.search-query strong {
    color: #667eea;
}

.search-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* === Result Card === */
.search-result-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-result-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.product-image {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #f7fafc;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.search-result-card:hover .product-image img {
    transform: scale(1.05);
}

.product-type {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.type-video {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.type-ebook {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.product-info {
    padding: 1.25rem;
}

.product-title {
    color: #2d3748;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-description {
    color: #718096;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.product-price {
    color: #2d3748;
    font-size: 1.25rem;
    font-weight: 700;
}

.btn-view-product {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-view-product:hover {
    transform: translateX(3px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* === Empty States === */
.no-results,
.search-error {
    text-align: center;
    padding: 4rem 2rem;
}

.no-results svg,
.search-error svg {
    color: #cbd5e0;
    margin-bottom: 1.5rem;
}

.no-results h3 {
    color: #2d3748;
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.no-results p,
.search-error p {
    color: #718096;
    font-size: 1rem;
}

/* === Loading State === */
.search-loading {
    text-align: center;
    padding: 4rem 2rem;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.search-loading p {
    color: #718096;
    font-size: 1rem;
}

/* === Popular Searches === */
#popular-searches {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f7fafc;
    border-radius: 12px;
}

#popular-searches h3 {
    color: #2d3748;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.popular-searches-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.popular-search-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.3s ease;
}

.popular-search-tag:hover {
    border-color: #667eea;
    background: #f0f4ff;
    color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.popular-search-tag .rank {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
}

.popular-search-tag .count {
    color: #a0aec0;
    font-size: 0.8rem;
}

/* === Responsive Design === */
@media (max-width: 768px) {
    .search-results-grid {
        grid-template-columns: 1fr;
    }
    
    .search-filters {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .filter-radio-group {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .product-footer {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
    
    .btn-view-product {
        width: 100%;
        justify-content: center;
    }
}

/* === Dark Mode Support === */
@media (prefers-color-scheme: dark) {
    #search-input {
        background: #2d3748;
        border-color: #4a5568;
        color: #f7fafc;
    }
    
    #search-input:focus {
        border-color: #667eea;
    }
    
    #search-suggestions {
        background: #2d3748;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    }
    
    .suggestion-item {
        border-bottom-color: #4a5568;
    }
    
    .suggestion-item:hover {
        background: #1a202c;
    }
    
    .suggestion-item span {
        color: #e2e8f0;
    }
    
    .search-result-card {
        background: #2d3748;
    }
    
    .product-image {
        background: #1a202c;
    }
    
    .product-title {
        color: #f7fafc;
    }
    
    .product-description {
        color: #a0aec0;
    }
    
    .product-footer {
        border-top-color: #4a5568;
    }
    
    .product-price {
        color: #f7fafc;
    }
    
    .no-results h3,
    .search-results-header h2 {
        color: #f7fafc;
    }
    
    #popular-searches {
        background: #2d3748;
    }
    
    #popular-searches h3 {
        color: #f7fafc;
    }
    
    .popular-search-tag {
        background: #1a202c;
        border-color: #4a5568;
        color: #cbd5e0;
    }
    
    .popular-search-tag:hover {
        background: #374151;
    }
}
