/* ================================================
   Apple Search Panel - Apple.com Style
   ================================================ */

/* ---------- Search Trigger Button ---------- */
.nav-search-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-primary);
    font-size: 20px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.nav-search-btn:hover {
    background: rgba(120, 120, 128, 0.1);
    color: var(--color-text-primary);
}

.nav-search-btn:active {
    transform: scale(0.92);
}

/* ---------- Search Panel Overlay ---------- */
.search-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.2);
    z-index: 1998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.search-panel-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* ---------- Search Panel ---------- */
.search-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(50px) saturate(200%);
    -webkit-backdrop-filter: blur(50px) saturate(200%);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.search-panel.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.search-panel.closing {
    transition-duration: 0.2s;
}

/* ---------- Search Panel Content ---------- */
.search-panel-content {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ---------- Search Input Row ---------- */
.search-input-row {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 56px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.search-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-icon {
    width: 20px;
    height: 20px;
    color: #86868b;
    flex-shrink: 0;
    margin-right: 12px;
}

#searchInput {
    width: 100%;
    height: 44px;
    padding: 0;
    border: none;
    background: transparent;
    font-size: 17px;
    color: var(--color-text-primary);
    outline: none;
    font-family: inherit;
}

#searchInput::placeholder {
    color: #86868b;
}

/* Clear button */
.search-clear-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(120, 120, 128, 0.15);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #86868b;
    font-size: 14px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, background 0.15s ease;
    flex-shrink: 0;
}

.search-clear-btn.visible {
    opacity: 1;
    visibility: visible;
}

.search-clear-btn:hover {
    background: rgba(120, 120, 128, 0.25);
}

/* Close button */
.search-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #86868b;
    font-size: 18px;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.search-close-btn:hover {
    background: rgba(120, 120, 128, 0.1);
    color: var(--color-text-primary);
}

/* ---------- Search Results Container ---------- */
.search-results-container {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    padding: 24px 0 40px;
}

/* ---------- Search Section ---------- */
.search-section {
    margin-bottom: 32px;
}

.search-section:last-child {
    margin-bottom: 0;
}

.search-section-title {
    font-size: 11px;
    font-weight: 500;
    color: #86868b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

/* ---------- Quick Links Grid ---------- */
.search-quick-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.search-quick-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(120, 120, 128, 0.06);
    border-radius: 10px;
    text-decoration: none;
    color: var(--color-text-primary);
    transition: background 0.15s ease;
}

.search-quick-link:hover {
    background: rgba(120, 120, 128, 0.12);
}

.search-quick-link-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--color-bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #86868b;
    flex-shrink: 0;
}

.search-quick-link-text {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
}

.search-quick-link-subtext {
    font-size: 11px;
    color: #86868b;
    font-weight: 400;
}

/* ---------- Search Suggestions List ---------- */
.search-suggestions {
    list-style: none;
    padding: 0;
    margin: 0;
}

.search-suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    cursor: pointer;
    transition: background 0.1s ease;
}

.search-suggestion-item:last-child {
    border-bottom: none;
}

.search-suggestion-item:hover,
.search-suggestion-item.highlighted {
    background: rgba(120, 120, 128, 0.04);
    margin: 0 -12px;
    padding: 12px;
    border-radius: 8px;
}

.search-suggestion-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--color-bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #86868b;
    flex-shrink: 0;
}

.search-suggestion-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.search-suggestion-content {
    flex: 1;
    min-width: 0;
}

.search-suggestion-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-suggestion-name mark {
    background: transparent;
    color: var(--color-accent);
    font-weight: 600;
}

.search-suggestion-meta {
    font-size: 12px;
    color: #86868b;
    margin-top: 2px;
}

.search-suggestion-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
    flex-shrink: 0;
}

.search-suggestion-arrow {
    width: 20px;
    height: 20px;
    color: #86868b;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.search-suggestion-item:hover .search-suggestion-arrow,
.search-suggestion-item.highlighted .search-suggestion-arrow {
    opacity: 1;
}

/* ---------- Search No Results ---------- */
.search-no-results {
    text-align: center;
    padding: 48px 24px;
}

.search-no-results-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    color: #86868b;
    opacity: 0.5;
}

.search-no-results h3 {
    font-size: 19px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 8px;
}

.search-no-results p {
    font-size: 14px;
    color: #86868b;
}

/* ---------- Search Loading ---------- */
.search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.search-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(120, 120, 128, 0.2);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: search-spin 0.8s linear infinite;
}

@keyframes search-spin {
    to { transform: rotate(360deg); }
}

/* ---------- Keyboard Hint ---------- */
.search-keyboard-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    margin-top: 16px;
}

.search-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    background: rgba(120, 120, 128, 0.08);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    color: #86868b;
}

.search-key-hint {
    font-size: 12px;
    color: #86868b;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .search-panel {
        border-radius: 0;
    }

    .search-panel-content {
        padding: 0 16px;
    }

    .search-quick-links {
        grid-template-columns: 1fr 1fr;
    }

    .search-keyboard-hint {
        display: none;
    }
}

@media (max-width: 480px) {
    .search-quick-links {
        grid-template-columns: 1fr;
    }
}
