/**
 * Clean & Professional Floating Product Search
 * Sri Vinayaga Crackers - Price List Page
 */

/* Gentle, Minimal Breathing Glow */
@keyframes vSubtlePulse {
    0%, 100% {
        box-shadow: 0 4px 14px rgba(30, 64, 175, 0.35), 0 2px 4px rgba(0, 0, 0, 0.08);
    }
    50% {
        box-shadow: 0 4px 18px rgba(59, 130, 246, 0.45), 0 2px 6px rgba(0, 0, 0, 0.1);
    }
}

/* Subtle, Soft Light Sheen Sweep */
@keyframes vSubtleShine {
    0%, 30% {
        left: -100%;
    }
    60%, 100% {
        left: 160%;
    }
}

/* Fixed Floating Search Button on Left */
#v-search-trigger {
    position: fixed;
    left: 24px;
    bottom: 24px; /* Left side bottom for desktop */
    height: 44px;
    padding: 0 18px 0 14px;
    border-radius: 22px;
    background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 100%);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 14px rgba(30, 64, 175, 0.35), 0 2px 4px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    z-index: 50005;
    outline: none;
    user-select: none;
    overflow: hidden; /* Clips the subtle shine */
    animation: vSubtlePulse 4s infinite ease-in-out;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    -webkit-tap-highlight-color: transparent;
}

/* Very subtle glass shine reflection */
#v-search-trigger::after {
    content: '';
    position: absolute;
    top: -60%;
    left: -100%;
    width: 45%;
    height: 220%;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.25) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(25deg);
    animation: vSubtleShine 4.5s infinite cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

#v-search-trigger:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45), 0 3px 6px rgba(0, 0, 0, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

#v-search-trigger:active {
    transform: scale(0.97);
}

.v-search-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.v-search-btn-icon svg {
    width: 18px;
    height: 18px;
    fill: #ffffff;
    transition: transform 0.2s ease;
}

#v-search-trigger:hover .v-search-btn-icon svg {
    transform: scale(1.08);
}

.v-search-btn-text {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: #ffffff;
    white-space: nowrap;
    line-height: 1;
}

.v-text-desktop {
    display: inline;
}

.v-text-mobile {
    display: none;
}

/* Transparent backdrop overlay (click outside dismisser) */
#v-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: transparent;
    z-index: 50008;
    display: none;
}

#v-search-overlay.v-search-active {
    display: block;
}

/* Compact Floating Search Dropdown */
#v-search-drawer {
    position: fixed;
    left: 24px;
    bottom: 80px; /* Positioned directly above the desktop bottom button */
    width: 350px;
    max-width: calc(100vw - 32px);
    max-height: 410px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 50010;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.97);
    transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

#v-search-drawer.v-search-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Compact Header */
.v-search-header-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

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

.v-search-input-wrapper .v-search-icon-left {
    position: absolute;
    left: 10px;
    width: 16px;
    height: 16px;
    fill: #64748b;
    pointer-events: none;
}

#v-search-input {
    width: 100% !important;
    height: 36px !important;
    padding: 0 32px 0 34px !important;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 18px !important;
    font-size: 13.5px !important;
    color: #1e293b !important;
    box-sizing: border-box !important;
    text-align: left !important;
    outline: none !important;
    transition: border-color 0.2s, box-shadow 0.2s !important;
}

#v-search-input:focus {
    border-color: #1d4ed8 !important;
    box-shadow: 0 0 0 2.5px rgba(29, 78, 216, 0.2) !important;
}

#v-search-clear {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 15px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
}

#v-search-clear:hover {
    color: #1e293b;
    background: #e2e8f0;
}

.v-search-close-btn {
    background: #e2e8f0;
    border: none;
    color: #475569;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
    outline: none;
    padding: 0;
    flex-shrink: 0;
}

.v-search-close-btn:hover {
    background: #cbd5e1;
    color: #0f172a;
}

/* Status / Count bar */
.v-search-status {
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    background: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
}

/* Compact Results List */
.v-search-results-list {
    flex: 1;
    max-height: 270px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 6px;
    margin: 0;
    list-style: none;
    -webkit-overflow-scrolling: touch;
}

.v-search-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    margin-bottom: 3px;
    border-radius: 6px;
    cursor: pointer;
    background: #ffffff;
    border: 1px solid transparent;
    transition: background 0.12s, border-color 0.12s;
}

.v-search-item:hover,
.v-search-item.v-search-item-selected {
    background: #f0f7ff;
    border-color: #bfdbfe;
}

.v-search-item-thumb {
    width: 34px;
    height: 34px;
    border-radius: 4px;
    object-fit: cover;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
    margin-right: 9px;
}

.v-search-item-thumb-placeholder {
    width: 34px;
    height: 34px;
    border-radius: 4px;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 15px;
    flex-shrink: 0;
    margin-right: 9px;
}

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

.v-search-item-name {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
}

.v-search-match {
    background: #fef08a;
    color: #854d0e;
    font-weight: 700;
    padding: 0 1px;
    border-radius: 2px;
}

.v-search-item-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    line-height: 1.2;
}

.v-search-item-category {
    background: #e0f2fe;
    color: #0369a1;
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 1px 4px;
    border-radius: 3px;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.v-search-item-price {
    font-weight: 700;
    color: #16a34a;
    font-size: 11.5px;
}

.v-search-item-arrow {
    margin-left: 6px;
    color: #94a3b8;
    font-size: 13px;
    flex-shrink: 0;
}

.v-search-item:hover .v-search-item-arrow {
    color: #1d4ed8;
}

/* Empty / Initial State */
.v-search-empty-state {
    padding: 20px 12px;
    text-align: center;
    color: #64748b;
}

.v-search-empty-icon {
    font-size: 22px;
    margin-bottom: 4px;
}

.v-search-empty-title {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 3px;
}

.v-search-empty-desc {
    font-size: 11.5px;
    margin: 0;
    line-height: 1.35;
}

/* Quick Category Tags */
.v-search-quick-tags {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
}

.v-search-quick-tag {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-size: 10.5px;
    font-weight: 600;
    padding: 3px 7px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.v-search-quick-tag:hover {
    background: #1d4ed8;
    color: #ffffff;
    border-color: #1d4ed8;
}

/* Product Row Highlight with 3-Second Color Fade */
.v-product-scrolled-highlight {
    background-color: #fff176 !important; /* Vivid bright yellow/gold */
    outline: 3px solid #ff9800 !important;
    box-shadow: 0 4px 20px rgba(255, 152, 0, 0.45) !important;
    position: relative !important;
    z-index: 50 !important;
    border-radius: 6px !important;
    transition: none !important;
}

.v-product-scrolled-highlight.v-fade-out {
    background-color: transparent !important;
    outline: 3px solid transparent !important;
    box-shadow: none !important;
    transition: background-color 3s ease-out, outline-color 3s ease-out, box-shadow 3s ease-out !important;
}

/* Responsive: Mobile Optimization */
@media (max-width: 640px) {
    #v-search-trigger {
        left: 14px;
        bottom: 120px; /* Above the sticky View Cart bar on mobile */
        height: 38px;
        padding: 0 13px 0 10px;
        border-radius: 20px;
    }
    
    .v-search-btn-icon svg {
        width: 16px;
        height: 16px;
    }
    
    .v-search-btn-text {
        font-size: 12.5px;
    }

    .v-text-desktop {
        display: none;
    }

    .v-text-mobile {
        display: inline;
    }
    
    #v-search-drawer {
        left: 12px;
        bottom: 170px;
        width: calc(100vw - 24px);
        max-width: 350px;
        max-height: 360px;
    }

    .v-search-results-list {
        max-height: 220px;
    }
}

/* Touch-action and Performance Optimization for Quantity +/- Buttons */
.uk-button-danger,
.uk-button-secondary,
.qtyinput,
a[onclick*="qty"] {
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    cursor: pointer !important;
}

/* Instant tactile feedback on press */
.uk-button-danger:active,
.uk-button-secondary:active,
a[onclick*="qty"]:active {
    transform: scale(0.88) !important;
    opacity: 0.8 !important;
    transition: transform 0.04s ease !important;
}

@media (max-width: 640px) {
    /* Enhanced tap target for mobile fingers */
    .uk-button-danger.uk-button-small,
    .uk-button-secondary.uk-button-small,
    a[onclick*="qty"] {
        min-width: 34px !important;
        height: 34px !important;
        line-height: 32px !important;
        padding: 0 !important;
        font-size: 20px !important;
        font-weight: 700 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 50% !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
    }

    .qtyinput.uk-input {
        width: 36px !important;
        height: 34px !important;
        font-size: 15px !important;
        font-weight: 700 !important;
        margin: 0 3px !important;
        border-radius: 4px !important;
    }
}

