/* Shopify-style Search Panel CSS */

/* Search Overlay */
.shopify-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

/* Search Panel */
.shopify-search-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    z-index: 10000;
}

.shopify-search-overlay.active .shopify-search-panel {
    transform: translateX(0);
}

/* Panel Header */
.search-panel-header {
    display: flex;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eaeaea;
    background: #ffffff;
    position: relative;
    z-index: 10;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
    margin-right: 15px;
}

.search-input {
    width: 100%;
    font-size: 18px;
    font-weight: 400;
    color: #111111;
    background: transparent;
    border: none;
    border-bottom: 2px solid #eaeaea;
    padding: 8px 0;
    outline: none;
    transition: border-color 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.search-input:focus {
    border-bottom-color: #111111;
}

.search-input::placeholder {
    color: #999999;
    font-weight: 300;
}

.search-spinner {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    color: #666666;
}

.search-close-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #666666;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.search-close-btn:hover {
    background: #f5f5f5;
    color: #111111;
}

/* Results Container */
.search-results-container {
    flex: 1;
    overflow-y: auto;
    background: #ffffff;
}

.search-results {
    padding: 0;
}

/* Search Result Items */
.search-result-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eaeaea;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.search-result-item:hover {
    background-color: #f8f8f8;
}

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

.search-result-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    margin-right: 16px;
    background: #f5f5f5;
}

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

.search-result-title {
    font-size: 14px;
    font-weight: 500;
    color: #111111;
    margin: 0 0 4px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-result-price {
    font-size: 14px;
    color: #666666;
    margin: 0;
}

.search-result-price .amount {
    color: #111111;
    font-weight: 500;
}

/* Empty State */
.search-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999999;
}

.search-empty-state svg {
    margin-bottom: 16px;
}

.search-empty-state p {
    font-size: 14px;
    margin: 0;
    font-weight: 400;
}

/* Loading State */
.search-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666666;
}

.search-loading p {
    font-size: 14px;
    margin: 16px 0 0 0;
}

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

.search-no-results svg {
    margin-bottom: 16px;
}

.search-no-results p {
    font-size: 14px;
    margin: 0;
    font-weight: 400;
}

/* Search Trigger Button */
.shopify-search-trigger {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: #111111;
    border: none;
    border-radius: 50%;
    color: #ffffff;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 9999 !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
}

.shopify-search-trigger:hover {
    background: #333333;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.shopify-search-trigger:active {
    transform: translateY(0);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .shopify-search-panel {
        width: 100%;
        right: 0;
    }
    
    .search-panel-header {
        padding: 16px;
    }
    
    .search-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .search-result-item {
        padding: 12px 16px;
    }
    
    .search-result-image {
        width: 50px;
        height: 50px;
        margin-right: 12px;
    }
    
    .search-result-title {
        font-size: 13px;
    }
    
    .search-result-price {
        font-size: 13px;
    }
    
    .shopify-search-trigger {
        bottom: 16px;
        right: 16px;
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    .search-panel-header {
        padding: 12px;
    }
    
    .search-input-wrapper {
        margin-right: 12px;
    }
    
    .search-result-item {
        padding: 10px 12px;
    }
    
    .search-result-image {
        width: 45px;
        height: 45px;
        margin-right: 10px;
    }
    
    .search-empty-state,
    .search-no-results {
        padding: 40px 16px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .shopify-search-panel {
        border-left: 2px solid #000000;
    }
    
    .search-result-item {
        border-bottom-color: #000000;
    }
    
    .search-input {
        border-bottom-color: #000000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .shopify-search-overlay,
    .shopify-search-panel,
    .search-close-btn,
    .shopify-search-trigger {
        transition: none;
    }
}

/* Focus styles for accessibility */
.search-input:focus,
.search-close-btn:focus,
.shopify-search-trigger:focus {
    outline: 2px solid #111111;
    outline-offset: 2px;
}

/* Hide focus outline when mouse is used */
.search-close-btn:focus:not(:focus-visible),
.shopify-search-trigger:focus:not(:focus-visible) {
    outline: none;
}
