/* ============================================
   Premium Search Modal — Resha Rugs
   Matches: custom-auth.css design language
   Colors: #0d0625 (dark navy), #e1bc92 (gold)
   ============================================ */

/* ── Overlay ── */
.resha-search-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(13, 6, 37, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow-y: auto;
}
.resha-search-overlay.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    opacity: 1;
    padding-top: 6vh;
}

/* ── Modal Container ── */
.resha-search-modal {
    background: #fff;
    border-radius: 16px;
    width: 720px;
    max-width: 94vw;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(13, 6, 37, 0.35);
    position: relative;
    transform: translateY(30px) scale(0.95);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
}
.resha-search-overlay.active .resha-search-modal {
    transform: translateY(0) scale(1);
}

/* ── Close Button (matches auth close) ── */
.resha-search-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(13, 6, 37, 0.06);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 20;
}
.resha-search-close:hover {
    background: rgba(13, 6, 37, 0.12);
    transform: rotate(90deg);
}
.resha-search-close svg {
    width: 16px;
    height: 16px;
    stroke: #0d0625;
    stroke-width: 2.5;
}

/* ── Header / Search Icon ── */
.resha-search-header {
    padding: 28px 32px 0;
    text-align: center;
}
.resha-search-header .search-hero-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #0d0625, #1a103d);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    box-shadow: 0 8px 20px rgba(13, 6, 37, 0.2);
    animation: reshSearchPulse 2s ease-in-out infinite;
}
.resha-search-header .search-hero-icon svg {
    width: 26px;
    height: 26px;
    stroke: #e1bc92;
    fill: none;
    stroke-width: 1.8;
}
@keyframes reshSearchPulse {
    0%, 100% { box-shadow: 0 8px 20px rgba(13, 6, 37, 0.2); }
    50% { box-shadow: 0 8px 28px rgba(225, 188, 146, 0.25); }
}
.resha-search-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: #0d0625;
    margin: 0 0 4px;
    letter-spacing: -0.3px;
}
.resha-search-header p {
    font-size: 13px;
    color: #999;
    margin: 0 0 18px;
    line-height: 1.4;
}

/* ── Search Input (matches auth input style) ── */
.resha-search-input-wrap {
    position: relative;
    margin: 0 32px 0;
}
.resha-search-input-wrap .search-input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #b5b0c3;
    pointer-events: none;
    transition: color 0.25s;
}
.resha-search-input-wrap:focus-within .search-input-icon {
    color: #e1bc92;
}
.resha-search-modal .resha-search-input,
.resha-search-input {
    width: 100% !important;
    padding: 14px 80px 14px 52px !important;
    border: 2px solid #e8e5ef !important;
    border-radius: 10px !important;
    font-size: 15px !important;
    color: #0d0625 !important;
    background: #fafafe !important;
    transition: all 0.25s ease;
    outline: none !important;
    box-sizing: border-box !important;
    font-family: inherit;
    height: auto !important;
    min-height: 0 !important;
    max-width: 100% !important;
    text-indent: 0 !important;
    margin: 0 !important;
}
.resha-search-modal .resha-search-input:focus,
.resha-search-input:focus {
    border-color: #e1bc92 !important;
    background: #fff !important;
    box-shadow: 0 0 0 4px rgba(225, 188, 146, 0.12) !important;
}
.resha-search-input::placeholder {
    color: #b5b0c3;
}

/* Clear & Submit inline buttons */
.resha-search-input-actions {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 4px;
}
.resha-search-clear {
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    cursor: pointer;
    color: #b5b0c3;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
    padding: 0;
}
.resha-search-clear.visible {
    display: flex;
}
.resha-search-clear:hover {
    color: #0d0625;
    background: rgba(13, 6, 37, 0.06);
}
.resha-search-clear svg {
    width: 15px;
    height: 15px;
}
.resha-search-submit {
    width: 32px;
    height: 32px;
    border: none;
    background: linear-gradient(135deg, #0d0625, #1a103d);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s;
    padding: 0;
}
.resha-search-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 6, 37, 0.25);
}
.resha-search-submit svg {
    width: 14px;
    height: 14px;
    stroke: #e1bc92;
    fill: none;
    stroke-width: 2;
}

/* ── Divider (matches auth divider) ── */
.resha-search-divider {
    display: flex;
    align-items: center;
    margin: 18px 32px;
    gap: 12px;
}
.resha-search-divider::before,
.resha-search-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e8e5ef;
}
.resha-search-divider span {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* ── Body (scrollable) ── */
.resha-search-body {
    padding: 0 32px 28px;
    flex: 1;
    overflow-y: auto;
    min-height: 180px;
}
.resha-search-body::-webkit-scrollbar {
    width: 4px;
}
.resha-search-body::-webkit-scrollbar-thumb {
    background: rgba(225, 188, 146, 0.3);
    border-radius: 4px;
}

/* ── Section Titles (matches auth label) ── */
.resha-section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 600;
    color: #0d0625;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 12px;
}
.resha-section-label svg {
    width: 14px;
    height: 14px;
    stroke: #e1bc92;
    fill: none;
    stroke-width: 2;
}

/* ── Trending Tags ── */
.resha-search-trending {
    margin-bottom: 22px;
}
.resha-search-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.resha-search-tag {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #0d0625;
    background: #fafafe;
    border: 1.5px solid #e8e5ef;
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    white-space: nowrap;
}
.resha-search-tag:hover {
    border-color: #e1bc92;
    background: rgba(225, 188, 146, 0.08);
    color: #0d0625;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(225, 188, 146, 0.15);
}
.resha-search-tag:active {
    transform: translateY(0);
}

/* ── Recent Searches ── */
.resha-search-recent {
    margin-bottom: 22px;
}
.resha-recent-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.resha-recent-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
    color: #555;
    font-size: 14px;
}
.resha-recent-item:hover {
    background: rgba(13, 6, 37, 0.04);
    color: #0d0625;
}
.resha-recent-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: #b5b0c3;
    fill: none;
    stroke-width: 2;
}
.resha-recent-item .resha-recent-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.resha-recent-item .resha-recent-remove {
    opacity: 0;
    transition: opacity 0.2s;
    cursor: pointer;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background: none;
    padding: 0;
}
.resha-recent-item .resha-recent-remove svg {
    width: 13px;
    height: 13px;
    stroke: #b5b0c3;
}
.resha-recent-item:hover .resha-recent-remove {
    opacity: 1;
}
.resha-recent-item .resha-recent-remove:hover svg {
    stroke: #e1bc92;
}
.resha-recent-clear {
    margin-top: 6px;
    font-size: 12px;
    color: #e1bc92;
    cursor: pointer;
    transition: color 0.2s;
    text-align: right;
    font-weight: 600;
    border: none;
    background: none;
    padding: 0;
}
.resha-recent-clear:hover {
    color: #c9a06e;
}

/* ── Categories Grid ── */
.resha-search-categories {
    margin-bottom: 20px;
}
.resha-cat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.resha-cat-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 14px;
    background: #fafafe;
    border: 1.5px solid #e8e5ef;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    color: #0d0625;
    font-size: 13px;
    font-weight: 500;
}
.resha-cat-card:hover {
    border-color: #e1bc92;
    background: rgba(225, 188, 146, 0.06);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(225, 188, 146, 0.12);
    color: #0d0625;
}
.resha-cat-card .resha-cat-count {
    margin-left: auto;
    font-size: 11px;
    color: #b5b0c3;
    font-weight: 400;
}

/* ── Popular Products Section ── */
.resha-popular-products {
    margin-bottom: 20px;
}
.resha-popular-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.resha-popular-card {
    text-decoration: none;
    border-radius: 10px;
    overflow: hidden;
    border: 1.5px solid #e8e5ef;
    background: #fafafe;
    transition: all 0.25s ease;
    display: block;
}
.resha-popular-card:hover {
    border-color: #e1bc92;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(13, 6, 37, 0.1);
}
.resha-popular-card .pop-thumb {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: #f5f3fa;
}
.resha-popular-card .pop-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.resha-popular-card:hover .pop-thumb img {
    transform: scale(1.08);
}
.resha-popular-card .pop-info {
    padding: 8px 10px 10px;
}
.resha-popular-card .pop-title {
    font-size: 12px;
    font-weight: 500;
    color: #0d0625;
    margin: 0 0 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.resha-popular-card .pop-price {
    font-size: 12px;
    font-weight: 700;
    color: #e1bc92;
}

/* ── AJAX Results ── */
.resha-search-results {
    display: none;
}
.resha-search-results.visible {
    display: block;
}

.resha-result-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Staggered fade-in */
.resha-result-item {
    opacity: 0;
    transform: translateY(12px);
    animation: reshFadeIn 0.35s ease forwards;
}
.resha-result-item:nth-child(1) { animation-delay: 0s; }
.resha-result-item:nth-child(2) { animation-delay: 0.04s; }
.resha-result-item:nth-child(3) { animation-delay: 0.06s; }
.resha-result-item:nth-child(4) { animation-delay: 0.08s; }
.resha-result-item:nth-child(5) { animation-delay: 0.1s; }
.resha-result-item:nth-child(6) { animation-delay: 0.12s; }
.resha-result-item:nth-child(7) { animation-delay: 0.14s; }
.resha-result-item:nth-child(8) { animation-delay: 0.16s; }

@keyframes reshFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.resha-result-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: #0d0625;
    transition: background 0.2s;
}
.resha-result-link:hover {
    background: rgba(13, 6, 37, 0.04);
}
.resha-result-thumb {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f5f3fa;
    border: 1px solid #e8e5ef;
}
.resha-result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.resha-result-info {
    flex: 1;
    min-width: 0;
}
.resha-result-title {
    font-size: 14px;
    font-weight: 500;
    color: #0d0625;
    margin: 0 0 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.resha-result-title mark {
    background: rgba(225, 188, 146, 0.25);
    color: #0d0625;
    padding: 0 2px;
    border-radius: 2px;
}
.resha-result-price {
    font-size: 13px;
    font-weight: 600;
    color: #e1bc92;
}
.resha-result-price del {
    font-weight: 400;
    color: #ccc;
    font-size: 12px;
}
.resha-result-sku {
    font-size: 11px;
    color: #b5b0c3;
    margin-top: 1px;
}
.resha-result-arrow {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    stroke: #e8e5ef;
    fill: none;
    stroke-width: 2;
    transition: all 0.2s;
}
.resha-result-link:hover .resha-result-arrow {
    stroke: #e1bc92;
    transform: translateX(3px);
}

/* Result divider */
.resha-result-divider {
    padding: 12px 12px 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #b5b0c3;
    border-top: 1px solid #e8e5ef;
    margin-top: 6px;
}
.resha-result-divider:first-child {
    border-top: none;
    margin-top: 0;
}

/* ── View All Results (matches auth primary btn) ── */
.resha-view-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 14px;
    padding: 12px;
    background: linear-gradient(135deg, #0d0625, #1a103d);
    border: none;
    border-radius: 10px;
    color: #e1bc92;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
}
.resha-view-all:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(13, 6, 37, 0.3);
    color: #e1bc92;
}
.resha-view-all svg {
    width: 16px;
    height: 16px;
    stroke: #e1bc92;
    fill: none;
    stroke-width: 2;
}

/* ── No Results ── */
.resha-no-results {
    text-align: center;
    padding: 30px 20px;
}
.resha-no-results .no-results-icon {
    width: 56px;
    height: 56px;
    background: rgba(13, 6, 37, 0.04);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}
.resha-no-results .no-results-icon svg {
    width: 28px;
    height: 28px;
    stroke: #b5b0c3;
    fill: none;
    stroke-width: 1.5;
}
.resha-no-results h4 {
    font-size: 16px;
    font-weight: 700;
    color: #0d0625;
    margin: 0 0 4px;
}
.resha-no-results p {
    font-size: 13px;
    color: #999;
    margin: 0;
}

/* ── Loading Spinner (matches auth btn spin) ── */
.resha-search-loading {
    display: none;
    text-align: center;
    padding: 40px 0;
}
.resha-search-loading.visible {
    display: block;
}
.resha-spinner {
    width: 28px;
    height: 28px;
    border: 2.5px solid rgba(225, 188, 146, 0.2);
    border-top-color: #e1bc92;
    border-radius: 50%;
    animation: reshSpin 0.6s linear infinite;
    margin: 0 auto;
}
@keyframes reshSpin {
    to { transform: rotate(360deg); }
}
.resha-search-loading p {
    font-size: 13px;
    color: #999;
    margin: 12px 0 0;
}

/* ── Footer / Keyboard Hints ── */
.resha-search-footer {
    padding: 12px 32px;
    border-top: 1px solid #e8e5ef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fafafe;
}
.resha-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 5px;
    font-size: 10px;
    font-weight: 600;
    border: 1px solid #e8e5ef;
    border-radius: 4px;
    color: #b5b0c3;
    margin: 0 3px;
    background: #fff;
}
.resha-search-footer-left,
.resha-search-footer-right {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #b5b0c3;
}

/* ── Body Lock ── */
body.resha-search-open {
    overflow: hidden !important;
}

/* ── Mobile Responsive (matches auth bottom-sheet) ── */
/* ── Specificity overrides — prevent Woodmart theme from interfering ── */
.resha-search-overlay .resha-search-modal .resha-search-input-wrap input[type="text"].resha-search-input {
    padding-left: 52px !important;
    padding-right: 80px !important;
    border: 2px solid #e8e5ef !important;
    border-radius: 10px !important;
    background: #fafafe !important;
    font-size: 15px !important;
    height: auto !important;
    line-height: normal !important;
    box-shadow: none !important;
    text-indent: 0 !important;
}
.resha-search-overlay .resha-search-modal .resha-search-input-wrap input[type="text"].resha-search-input:focus {
    border-color: #e1bc92 !important;
    background: #fff !important;
    box-shadow: 0 0 0 4px rgba(225, 188, 146, 0.12) !important;
}

@media (max-width: 640px) {
    .resha-search-overlay.active {
        align-items: flex-end;
        padding-top: 0;
    }
    .resha-search-modal {
        border-radius: 16px 16px 0 0;
        max-height: 95vh;
        width: 100%;
        max-width: 100%;
    }
    .resha-search-header {
        padding: 24px 24px 0;
    }
    .resha-search-header .search-hero-icon {
        width: 48px;
        height: 48px;
        border-radius: 12px;
        margin-bottom: 10px;
    }
    .resha-search-header .search-hero-icon svg {
        width: 22px;
        height: 22px;
    }
    .resha-search-header h3 {
        font-size: 18px;
    }
    .resha-search-input-wrap {
        margin: 0 24px 0;
    }
    .resha-search-divider {
        margin: 14px 24px;
    }
    .resha-search-input {
        font-size: 16px; /* prevent iOS zoom */
    }
    .resha-search-body {
        padding: 0 24px 24px;
        max-height: calc(95vh - 240px);
    }
    .resha-cat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .resha-popular-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .resha-search-footer {
        display: none;
    }
}
