/* ============================================================
   Sanatan Ajax Search – Stylesheet
   ============================================================ */

/* ── Wrapper ── */
.sas-wrapper {
    position: relative;
    width: 100%;
    max-width: 700px;
    font-family: inherit;
    z-index: 9999;
}

/* ── Form & input wrap ── */
.sas-form {
    position: relative;
    margin: 0;
    padding: 0;
}

.sas-input-wrap {
    display: flex;
    align-items: center;
    border: 1px solid #773c1c;
    border-radius: 8px;
    background: #f4f2ef;
    transition: border-color 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.sas-input-wrap:focus-within {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

/* ── Search icon (left) ── */
.sas-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px 0 14px;
    color: #9ca3af;
    pointer-events: none;
    flex-shrink: 0;
}

.sas-icon svg {
    width: 18px;
    height: 18px;
}

/* ── Input field ── */
.sas-field {
    flex: 1;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 15px 6px !important;
    font-size: 15px !important;
    color: #373737 !important;
    min-width: 0;
    -webkit-appearance: none;
    appearance: none;
}

.sas-field::placeholder {
    color: transparent; /* controlled by JS animation */
}

/* Animated placeholder layer */
.sas-placeholder-anim {
    position: absolute;
    left: 44px; /* align with input text start */
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #9ca3af;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    user-select: none;
}

/* blinking cursor */
.sas-placeholder-anim::after {
    content: '|';
    animation: sas-blink 0.75s step-end infinite;
    color: #7c3aed;
    margin-left: 1px;
}

@keyframes sas-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

/* hide cursor when field is focused or has content */
.sas-field:focus ~ .sas-placeholder-anim,
.sas-has-value .sas-placeholder-anim {
    display: none;
}

/* ── Submit button (right) ── */
.sas-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px 18px;
    background: #773c1c;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
    height: 100%;
}

.sas-submit:hover {
    background: #21b0d7;
}

.sas-submit svg {
    width: 18px;
    height: 18px;
    stroke: #fff;
}

/* ── Dropdown ── */
.sas-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
    max-height: 520px;
    overflow-y: auto;
    z-index: 99999;
    display: none;
    padding: 0;
}

.sas-dropdown.sas-open {
    display: block;
    animation: sas-fadeIn 0.15s ease;
}

@keyframes sas-fadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0);    }
}

/* ── Section headings ── */
.sas-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7280;
    padding: 14px 16px 8px;
    margin: 0;
    border-bottom: 1px solid #f3f4f6;
}

/* ── Trending chips ── */
.sas-trending-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    list-style: none;
    margin: 0;
}

.sas-trending-list li {
    margin: 0;
    padding: 0;
}

.sas-trending-chip {
    display: inline-block;
    padding: 5px 13px;
    background: #f3f4f6;
    border-radius: 20px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    border: none;
    transition: background 0.18s, color 0.18s;
    text-decoration: none;
}

.sas-trending-chip:hover {
    background: #7c3aed;
    color: #fff;
    text-decoration: none;
}

/* ── Product grid (top products) ── */
.sas-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0;
    padding: 10px 16px 16px;
}

@media (max-width: 480px) {
    .sas-products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.sas-product-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    padding: 10px;
    border-radius: 8px;
    transition: background 0.15s;
    position: relative;
}

.sas-product-card:hover {
    background: #f9fafb;
    text-decoration: none;
}

.sas-product-img-wrap {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 ratio */
    border-radius: 8px;
    overflow: hidden;
    background: #f3f4f6;
    margin-bottom: 8px;
}

.sas-product-img-wrap img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
}

/* Badge */
.sas-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: #7c3aed;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    z-index: 1;
    line-height: 1.4;
}

.sas-badge.sas-badge-sale {
    background: #ef4444;
}

.sas-product-name {
    font-size: 12px;
    font-weight: 500;
    color: #374151;
    line-height: 1.4;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sas-product-price {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
}

.sas-product-price del {
    color: #9ca3af;
    font-weight: 400;
    font-size: 11px;
    margin-right: 3px;
}

/* Stars */
.sas-stars {
    display: flex;
    align-items: center;
    gap: 1px;
    margin-top: 3px;
}

.sas-stars span {
    font-size: 11px;
}

.sas-star-filled { color: #f59e0b; }
.sas-star-empty  { color: #d1d5db; }

/* ── Live search results ── */
.sas-live-results {
    padding: 0 0 10px;
}

/* Category results */
.sas-cat-list {
    list-style: none;
    margin: 0;
    padding: 0 16px;
}

.sas-cat-item a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    font-size: 13px;
    color: #374151;
    text-decoration: none;
    border-bottom: 1px solid #f3f4f6;
}

.sas-cat-item a:hover { color: #7c3aed; }

.sas-cat-icon {
    width: 28px; height: 28px;
    background: #f3f4f6;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

/* Product list in live search */
.sas-live-product-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sas-live-product-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}

.sas-live-product-item a:hover {
    background: #f9fafb;
}

.sas-live-product-item img {
    width: 44px; height: 44px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    border: 1px solid #f3f4f6;
}

.sas-live-product-info {
    flex: 1;
    min-width: 0;
}

.sas-live-product-name {
    font-size: 13px;
    font-weight: 500;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sas-live-product-price {
    font-size: 12px;
    color: #7c3aed;
    font-weight: 600;
    margin-top: 2px;
}

/* ── View all link ── */
.sas-view-all {
    display: block;
    text-align: center;
    padding: 10px 16px;
    font-size: 13px;
    color: #7c3aed;
    font-weight: 600;
    text-decoration: none;
    border-top: 1px solid #f3f4f6;
    margin-top: 6px;
}

.sas-view-all:hover { color: #6d28d9; text-decoration: underline; }

/* ── Loading / no results ── */
.sas-loading,
.sas-no-results {
    padding: 24px 16px;
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
}

.sas-spinner {
    display: inline-block;
    width: 20px; height: 20px;
    border: 2px solid #e5e7eb;
    border-top-color: #7c3aed;
    border-radius: 50%;
    animation: sas-spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

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

/* ── Scrollbar styling ── */
.sas-dropdown::-webkit-scrollbar { width: 4px; }
.sas-dropdown::-webkit-scrollbar-track { background: transparent; }
.sas-dropdown::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
