/* Unique CSS module for Custom Search component */

/* Full-width overlay container */
.at-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 15, 15, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 100000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s;
    overflow: hidden;
}

/* Open state for the overlay */
.at-search-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Sliding search panel */
.at-search-container {
    width: 100%;
    max-height: 100%;
    background: #ffffff;
    border-bottom: 1px solid #eaeaea;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    transform: translateY(-100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.at-search-overlay.active .at-search-container {
    transform: translateY(0);
}

/* Header containing the input, search icon, close icon, and spinner */
.at-search-header {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-sizing: border-box;
}

/* Wrapper for the input field and inside controls */
.at-search-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    background: #f5f5f7;
    border-radius: 12px;
    padding: 0 16px;
    border: 1px solid transparent;
    transition: border-color 0.3s, background-color 0.3s;
}

.at-search-input-wrapper:focus-within {
    border-color: #e41f27;
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(228, 31, 39, 0.1);
}

.at-search-icon {
    color: #86868b;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
}

.at-search-input {
    width: 100%;
    height: 52px;
    border: none;
    background: transparent;
    font-size: 17px;
    font-weight: 500;
    color: #1d1d1f;
    outline: none;
    padding: 0;
    box-sizing: border-box;
}

.at-search-input::placeholder {
    color: #86868b;
}

/* Clear input text button */
.at-search-clear {
    border: none;
    background: none;
    color: #86868b;
    cursor: pointer;
    padding: 6px;
    margin-left: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
}

.at-search-clear:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #1d1d1f;
}

/* Loading spinner */
.at-search-loader {
    margin-left: 8px;
    display: flex;
    align-items: center;
}

.at-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(228, 31, 39, 0.15);
    border-top-color: #e41f27;
    border-radius: 50%;
    animation: at-spin 0.6s linear infinite;
}

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

/* Close search button */
.at-search-close {
    border: none;
    background: none;
    color: #86868b;
    cursor: pointer;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
}

.at-search-close:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #1d1d1f;
}

/* Main body scrollable container */
.at-search-body {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px 40px;
    max-height: 70vh;
    overflow-y: auto;
    box-sizing: border-box;
}

/* Popular search terms styling */
.at-search-suggestions {
    animation: at-fadeInUp 0.4s ease;
}

.at-search-section-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #86868b;
    font-weight: 600;
    margin-bottom: 16px;
    margin-top: 10px;
}

.at-search-popular-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.at-popular-item {
    display: inline-block;
    padding: 10px 18px;
    background: #f5f5f7;
    border-radius: 20px;
    color: #1d1d1f;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
}

.at-popular-item:hover {
    background: #e41f27;
    color: #ffffff;
}

/* Search results listing container */
.at-search-results {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
    animation: at-fadeInUp 0.3s ease;
}

/* Single search item row */
.at-search-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #eaeaea;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    box-sizing: border-box;
}

.at-search-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.04);
    border-color: rgba(228, 31, 39, 0.2);
}

.at-search-item:focus {
    outline: 2px solid #e41f27;
    outline-offset: 2px;
}

.at-search-image {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    object-fit: cover;
    background: #f5f5f7;
    margin-right: 16px;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.at-search-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.at-search-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.at-search-name {
    font-size: 16px;
    font-weight: 600;
    color: #1d1d1f;
    margin: 0;
    line-height: 1.3;
}

.at-search-model-cat {
    font-size: 13px;
    color: #86868b;
    font-weight: 500;
}

.at-search-pricing {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.at-search-price {
    font-size: 16px;
    font-weight: 700;
    color: #e41f27;
}

.at-search-mrp {
    font-size: 13px;
    text-decoration: line-through;
    color: #86868b;
}

/* Empty State styling */
.at-search-empty {
    text-align: center;
    padding: 60px 20px;
    animation: at-fadeIn 0.3s ease;
}

.at-search-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.at-search-empty-title {
    font-size: 18px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 6px;
}

.at-search-empty-text {
    font-size: 14px;
    color: #86868b;
}

/* Loading Skeleton Shimmer layout */
.at-search-skeletons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.at-search-skeleton-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid #eaeaea;
    background: #ffffff;
    box-sizing: border-box;
}

.at-skeleton-image {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    margin-right: 16px;
    background: #f5f5f7;
    flex-shrink: 0;
}

.at-skeleton-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.at-skeleton-title {
    width: 40%;
    height: 16px;
    background: #f5f5f7;
    border-radius: 4px;
}

.at-skeleton-subtitle {
    width: 25%;
    height: 12px;
    background: #f5f5f7;
    border-radius: 4px;
}

.at-skeleton-price {
    width: 15%;
    height: 14px;
    background: #f5f5f7;
    border-radius: 4px;
}

/* Shimmer animation keyframes and modifier */
.at-shimmer {
    background: linear-gradient(90deg, #f5f5f7 25%, #e8e8ed 50%, #f5f5f7 75%);
    background-size: 200% 100%;
    animation: at-shimmer-run 1.5s infinite linear;
}

@keyframes at-shimmer-run {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Helper animations */
@keyframes at-fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes at-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Scrolling lock utility class */
body.at-search-lock {
    overflow: hidden !important;
    touch-action: none;
}

/* Mobile responsive view adjustments */
@media (max-width: 768px) {
    .at-search-container {
        height: 100%;
    }
    
    .at-search-header {
        padding: 16px 12px;
        gap: 12px;
    }
    
    .at-search-input {
        height: 48px;
        font-size: 16px;
    }
    
    .at-search-body {
        padding: 0 12px 30px;
        max-height: calc(100vh - 82px);
    }
    
    .at-search-content {
        gap: 10px;
    }
    
    .at-search-name {
        font-size: 14px;
    }
    
    .at-search-price {
        font-size: 14px;
    }
    
    .at-search-image {
        width: 52px;
        height: 52px;
    }
}
