/* ==================== GROCESTA SEARCH OVERLAY ====================  */
/* Swiggy/Zomato Style Full-Screen Search */

/* ========== OVERLAY ========== */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: none;
    flex-direction: column;
}

.search-overlay.active {
    display: flex;
}

.search-overlay-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: searchFadeIn 0.2s ease;
}

.search-overlay-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    background: #fff;
    height: 100%;
    display: flex;
    flex-direction: column;
    animation: searchSlideDown 0.3s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.15);
}

/* ========== HEADER ========== */
.search-overlay-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #2e7d32 0%, #66bb6a 100%);
    border-bottom: 1px solid #e0e0e0;
}

.search-overlay-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 12px;
    padding: 0 14px;
    height: 46px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.search-overlay-icon {
    color: #999;
    font-size: 16px;
    margin-right: 10px;
}

.search-overlay-input {
    flex: 1;
    border: none;
    outline: none;
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    color: #333;
    background: transparent;
}

.search-overlay-input::placeholder {
    color: #bbb;
}

.search-overlay-clear {
    background: none;
    border: none;
    color: #999;
    font-size: 16px;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.search-overlay-clear:hover {
    background: #f5f5f5;
    color: #333;
}

.search-overlay-close {
    background: none;
    border: none;
    color: #fff;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 4px;
    white-space: nowrap;
}

.search-overlay-close:hover {
    text-decoration: underline;
}

/* ========== BODY ========== */
.search-overlay-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
    -webkit-overflow-scrolling: touch;
}

/* ========== SECTIONS ========== */
.search-section {
    margin-bottom: 24px;
}

.search-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 2px;
}

.search-section-header h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.search-section-header h3 i {
    color: #2e7d32;
    font-size: 16px;
}

.clear-recent-btn {
    background: none;
    border: none;
    color: #e53935;
    font-family: 'Poppins', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.clear-recent-btn:hover {
    background: #ffebee;
}

/* ========== RESULTS HEADER ========== */
.search-results-header {
    padding: 8px 4px 16px;
}

.results-count {
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    color: #666;
}

.results-count strong {
    color: #2e7d32;
}

/* ========== NO RESULTS ========== */
.search-no-results {
    text-align: center;
    padding: 30px 20px;
    margin-bottom: 20px;
}

.no-results-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.no-results-icon i {
    font-size: 28px;
    color: #66bb6a;
}

.search-no-results h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    color: #333;
    margin: 0 0 8px;
    font-weight: 600;
}

.search-no-results p {
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    color: #999;
    margin: 0;
}

/* ========== RECENT SEARCHES ========== */
.recent-searches-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.recent-search-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.82rem;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
}

.recent-search-chip i {
    color: #bbb;
    font-size: 12px;
}

.recent-search-chip:hover {
    border-color: #2e7d32;
    background: #e8f5e9;
    color: #2e7d32;
}

/* ========== DID YOU MEAN ========== */
.did-you-mean-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.did-you-mean-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border: 1px solid #90caf9;
    border-radius: 20px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    color: #1565c0;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.did-you-mean-chip:hover {
    background: linear-gradient(135deg, #bbdefb, #90caf9);
    transform: translateY(-1px);
}

.did-you-mean-chip i {
    font-size: 12px;
}

/* ========== CATEGORIES ========== */
.search-categories-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.search-category-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.82rem;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.search-category-chip i {
    color: #2e7d32;
    font-size: 14px;
}

.search-category-chip:hover {
    border-color: #2e7d32;
    background: #e8f5e9;
    color: #2e7d32;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(46, 125, 50, 0.1);
}

/* ========== PRODUCT GRID ========== */
.search-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.search-products-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.search-products-scroll::-webkit-scrollbar {
    height: 4px;
}

.search-products-scroll::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.search-products-scroll .search-product-card {
    min-width: 150px;
    max-width: 170px;
    flex-shrink: 0;
}

/* ========== PRODUCT CARD ========== */
.search-product-card {
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #f0f0f0;
    transition: all 0.25s ease;
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.search-product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    border-color: #c8e6c9;
}

.search-product-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: linear-gradient(135deg, #e53935, #ff7043);
    color: white;
    padding: 3px 8px;
    border-radius: 6px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    z-index: 2;
    letter-spacing: 0.3px;
}

.search-product-img-wrapper {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.search-product-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.search-product-card:hover .search-product-img {
    transform: scale(1.05);
}

.search-product-info {
    padding: 10px 10px 12px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.search-product-name {
    font-family: 'Poppins', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-product-weight {
    font-family: 'Poppins', sans-serif;
    font-size: 0.72rem;
    color: #999;
    margin-bottom: 8px;
}

.search-product-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.search-product-prices {
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-current-price {
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: #2e7d32;
}

.search-original-price {
    font-family: 'Poppins', sans-serif;
    font-size: 0.75rem;
    color: #bbb;
    text-decoration: line-through;
}

/* ========== ADD BUTTON ========== */
.search-add-btn {
    padding: 6px 16px;
    background: #fff;
    color: #2e7d32;
    border: 1.5px solid #2e7d32;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-add-btn:hover {
    background: #2e7d32;
    color: #fff;
    transform: scale(1.05);
}

.search-add-btn:active {
    transform: scale(0.95);
}

/* ========== QUANTITY CONTROLS ========== */
.search-qty-controls {
    display: flex;
    align-items: center;
    border: 1.5px solid #2e7d32;
    border-radius: 8px;
    overflow: hidden;
}

.search-qty-btn {
    width: 28px;
    height: 28px;
    background: #2e7d32;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.search-qty-btn:hover {
    background: #1b5e20;
}

.search-qty-value {
    padding: 0 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    color: #2e7d32;
    min-width: 20px;
    text-align: center;
}

/* ========== HIGHLIGHT ========== */
.search-highlight {
    background: #fff9c4;
    color: #f57f17;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 700;
}

/* ========== ANIMATIONS ========== */
@keyframes searchFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes searchSlideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .search-overlay-content {
        max-width: 100%;
        border-radius: 0;
    }

    .search-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 8px;
    }

    .search-overlay-header {
        padding: 10px 12px;
    }

    .search-overlay-body {
        padding: 12px;
    }

    .search-product-name {
        font-size: 0.75rem;
    }

    .search-current-price {
        font-size: 0.82rem;
    }

    .search-add-btn {
        padding: 5px 12px;
        font-size: 0.72rem;
    }
}

@media (max-width: 480px) {
    .search-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .search-overlay-input-wrapper {
        height: 42px;
    }

    .search-overlay-input {
        font-size: 0.88rem;
    }

    .search-category-chip {
        font-size: 0.75rem;
        padding: 8px 12px;
    }
}

@media (max-width: 360px) {
    .search-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .search-product-info {
        padding: 8px;
    }
}

/* ========== BACK ARROW BUTTON ========== */
.search-overlay-back {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.search-overlay-back:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.1);
}

.search-overlay-back:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.25);
}

/* ========== HIDE CANCEL ON MOBILE, SHOW BACK ARROW ========== */
@media (max-width: 768px) {
    .search-overlay-close {
        display: none;
    }

    .search-overlay-back {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }

    .search-overlay-header {
        gap: 8px;
    }
}

/* ========== ON DESKTOP: SHOW BOTH ========== */
@media (min-width: 769px) {
    .search-overlay-back {
        width: 42px;
        height: 42px;
    }
}

/* ========== HIDDEN UTILITY ========== */
.hidden {
    display: none !important;
}

/* ========== SEARCH VARIANT PILLS ========== */
.search-variant-pills {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    width: 100%;
}

.search-variant-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 8px;
    border: 1.5px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Poppins', sans-serif;
    flex: 0 0 auto;
    position: relative;
}

.search-variant-pill:hover {
    border-color: #4caf50;
    background: #f0f9f0;
}

.search-variant-pill.active {
    border-color: #2e7d32;
    background: linear-gradient(135deg, #e8f5e9, #f1f8e9);
    box-shadow: 0 1px 4px rgba(46, 125, 50, 0.15);
}

.search-variant-pill.out-of-stock {
    opacity: 0.4;
    cursor: not-allowed;
}

.search-variant-pill.out-of-stock::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 10%;
    width: 80%;
    height: 1.5px;
    background: #e53935;
    transform: rotate(-12deg);
}

.search-variant-pill .pill-weight {
    font-size: 0.62rem;
    font-weight: 700;
    color: #424242;
    line-height: 1.2;
    white-space: nowrap;
}

.search-variant-pill.active .pill-weight {
    color: #1b5e20;
}

.search-variant-pill .pill-price {
    font-size: 0.58rem;
    font-weight: 600;
    color: #2e7d32;
    line-height: 1.2;
    white-space: nowrap;
}

.search-variant-pill .pill-mrp {
    font-size: 0.5rem;
    color: #9e9e9e;
    text-decoration: line-through;
    line-height: 1;
}

.search-variant-pill.active .pill-price {
    color: #1b5e20;
}

@media (max-width: 480px) {
    .search-variant-pills {
        gap: 3px;
        margin-bottom: 6px;
    }

    .search-variant-pill {
        padding: 3px 6px;
        border-radius: 5px;
    }

    .search-variant-pill .pill-weight {
        font-size: 0.58rem;
    }

    .search-variant-pill .pill-price {
        font-size: 0.54rem;
    }
}