/* ============================================================
   Ventova Store — Fullscreen Mobile Search Modal
   Only visible on mobile (≤768px)
   ============================================================ */

/* ── Modal Container ── */
.vs-search-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: var(--vs-bg-white);
    display: flex;
    flex-direction: column;
    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}

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

/* ── Header (sticky input) ── */
.vs-search-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--vs-primary);
    flex-shrink: 0;
    padding-top: calc(12px + env(safe-area-inset-top, 0));
    box-sizing: border-box;
    width: 100%;
    max-width: 100vw;
}

.vs-search-modal-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: var(--vs-radius-full);
    padding: 0 14px;
    height: 42px;
    position: relative;
}

.vs-search-modal-icon {
    color: var(--vs-text-light);
    font-size: 0.9rem;
    margin-right: 10px;
    flex-shrink: 0;
}

.vs-search-modal-input {
    flex: 1;
    border: none;
    outline: none;
    font-family: var(--vs-font-body);
    font-size: 16px; /* Prevents iOS zoom */
    color: var(--vs-text);
    background: transparent;
    height: 100%;
    min-width: 0;
}

.vs-search-modal-input::placeholder {
    color: var(--vs-text-light);
    font-size: 0.9rem;
}

/* Hide native WebKit search cancel button */
.vs-search-modal-input::-webkit-search-decoration,
.vs-search-modal-input::-webkit-search-cancel-button,
.vs-search-modal-input::-webkit-search-results-button,
.vs-search-modal-input::-webkit-search-results-decoration {
    display: none;
}

.vs-search-modal-clear {
    display: none;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--vs-text-light);
    font-size: 0.85rem;
    padding: 4px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.vs-search-modal-clear.visible {
    display: flex;
}

.vs-search-modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.9);
    font-family: var(--vs-font-body);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 4px;
    white-space: nowrap;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.vs-search-modal-close:active {
    color: #fff;
}


/* ── Results Area ── */
.vs-search-modal-results {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0;
    background: var(--vs-bg);
}

/* Loading state */
.vs-search-modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--vs-text-muted);
    font-size: 0.85rem;
    gap: 12px;
}

.vs-search-modal-loading i {
    font-size: 1.5rem;
    color: var(--vs-primary);
}

/* Empty state */
.vs-search-modal-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
}

.vs-search-modal-empty i {
    font-size: 2.5rem;
    color: var(--vs-border);
    margin-bottom: 12px;
}

.vs-search-modal-empty span {
    color: var(--vs-text-muted);
    font-size: 0.9rem;
}

/* Initial hint state */
.vs-search-modal-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
    color: var(--vs-text-light);
}

.vs-search-modal-hint i {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.4;
}

.vs-search-modal-hint span {
    font-size: 0.88rem;
}


/* ── Product Result Grid ── */
.vs-search-modal-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 12px;
}

.vs-search-modal-product {
    display: flex;
    flex-direction: column;
    background: var(--vs-bg-white);
    border-radius: var(--vs-radius-md);
    border: 1px solid var(--vs-border);
    overflow: hidden;
    text-decoration: none;
    color: var(--vs-text);
    transition: box-shadow 0.15s ease;
}

.vs-search-modal-product:active {
    box-shadow: var(--vs-shadow-md);
}

.vs-search-modal-product-img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: contain;
    background: var(--vs-border-light);
    padding: 6px;
}

.vs-search-modal-product-info {
    padding: 8px 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.vs-search-modal-product-title {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--vs-text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.vs-search-modal-product-price {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--vs-primary);
    margin-top: auto;
}

.vs-search-modal-product-price ins {
    text-decoration: none;
    color: var(--vs-danger);
}

.vs-search-modal-product-price del {
    font-size: 0.75rem;
    color: var(--vs-text-light);
    font-weight: 400;
}

.vs-search-modal-product-stock {
    font-size: 0.65rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.vs-search-modal-product-stock.in-stock {
    color: var(--vs-success);
}

.vs-search-modal-product-stock.out-of-stock {
    color: var(--vs-danger);
}


/* ── View All Link ── */
.vs-search-modal-viewall {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px;
    margin: 0 12px 12px;
    background: var(--vs-primary);
    color: #fff;
    border-radius: var(--vs-radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
}

.vs-search-modal-viewall:active {
    background: var(--vs-primary-dark);
    color: #fff;
}


/* ── Body lock when modal is open ── */
body.vs-search-modal-open {
    overflow: hidden;
}

/* ── Only visible on mobile ── */
@media (min-width: 769px) {
    .vs-search-modal {
        display: none !important;
    }
}
