/**
 * أنماط البحث المتقدم
 * Advanced Search Styles
 */

/* ========================================
   Search Modal
   ======================================== */

.search-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.search-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.search-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.search-modal-content {
    position: relative;
    width: 100%;
    max-width: 640px;
    max-height: 70vh;
    margin: 0 16px;
    background: linear-gradient(135deg, #1e1b4b, #0f172a);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.95) translateY(-10px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.search-modal.active .search-modal-content {
    transform: scale(1) translateY(0);
}

/* ========================================
   Search Input
   ======================================== */

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.search-icon {
    font-size: 20px;
    color: #8b5cf6;
    margin-left: 12px;
}

.search-input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    font-size: 18px;
    color: white;
    outline: none;
}

.search-input-wrapper input::placeholder {
    color: #64748b;
}

.search-voice-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(139, 92, 246, 0.2);
    border: none;
    color: #8b5cf6;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-voice-btn:hover {
    background: rgba(139, 92, 246, 0.3);
}

.search-voice-btn.listening {
    background: #ef4444;
    color: white;
    animation: pulse-voice 1s ease-in-out infinite;
}

@keyframes pulse-voice {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.search-shortcut {
    margin-right: 10px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 12px;
    color: #94a3b8;
}

/* ========================================
   Search Filters
   ======================================== */

.search-filters {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
}

.search-filter {
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.search-filter:hover {
    background: rgba(255, 255, 255, 0.1);
}

.search-filter.active {
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    border-color: transparent;
    color: white;
}

/* ========================================
   Search Results
   ======================================== */

.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.search-section {
    margin-bottom: 16px;
}

.search-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    font-size: 12px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-section-header i {
    margin-left: 6px;
}

.search-clear-btn {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 12px;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    text-decoration: none;
    color: white;
    transition: all 0.2s ease;
}

.search-result-item:hover,
.search-result-item.selected {
    background: rgba(139, 92, 246, 0.2);
}

.search-result-item img {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
}

.search-result-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-info h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-info h4 mark {
    background: rgba(139, 92, 246, 0.4);
    color: white;
    padding: 0 2px;
    border-radius: 2px;
}

.search-result-info p {
    font-size: 13px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-price {
    font-weight: 700;
    color: #06b6d4;
}

.search-history-item i {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
}

/* ========================================
   Search States
   ======================================== */

.search-empty,
.search-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    color: #64748b;
}

.search-empty i,
.search-loading i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.search-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(139, 92, 246, 0.2);
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   Search Footer
   ======================================== */

.search-footer {
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.search-hint {
    font-size: 12px;
    color: #64748b;
}

.search-hint kbd {
    display: inline-block;
    padding: 2px 6px;
    margin: 0 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-size: 11px;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 640px) {
    .search-modal-content {
        max-height: 80vh;
        border-radius: 20px 20px 0 0;
        margin: 0;
        margin-top: auto;
    }
    
    .hide-mobile {
        display: none;
    }
    
    .search-footer {
        display: none;
    }
}
