/* =========================================
   ARTISHELP SEARCH
========================================= */

:root {
    --search-primary: #16a34a;
    --search-primary-dark: #15803d;
    --search-primary-light: #f0fdf4;
    --search-primary-ring: rgba(22, 163, 74, 0.14);
    --search-text: #111827;
    --search-muted: #6b7280;
    --search-border: #e5e7eb;
    --search-border-strong: #d1d5db;
    --search-bg: #f8fafc;
    --search-white: #ffffff;
    --search-amber: #ca8a04;
    --search-danger: #dc2626;
}


/* =========================================
   PAGE
========================================= */

.search-page {
    min-height: calc(100vh - 76px);
    padding: 60px 20px;
    background:
        radial-gradient(
            circle at top right,
            rgba(22, 163, 74, 0.07),
            transparent 35%
        ),
        var(--search-bg);
}

.search-container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

.search-intro {
    margin-bottom: 28px;
    text-align: center;
}

.search-eyebrow {
    display: inline-block;
    color: var(--search-primary);
    font-size: 0.73rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    margin-bottom: 10px;
}

.search-intro h1 {
    margin: 0;
    color: var(--search-text);
    font-size: clamp(1.9rem, 4.5vw, 2.5rem);
    line-height: 1.15;
    letter-spacing: -1px;
}

.search-intro p {
    max-width: 560px;
    margin: 12px auto 0;
    color: var(--search-muted);
    font-size: 0.92rem;
    line-height: 1.7;
}


/* =========================================
   FILTER BAR
========================================= */

.search-filter-bar {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr auto;
    gap: 10px;
    padding: 10px;
    background: #ffffff;
    border: 1px solid var(--search-border);
    border-radius: 14px;
    box-shadow: 0 15px 40px rgba(15, 23, 42, 0.05);
    margin-bottom: 20px;
}

.search-filter-input {
    position: relative;
    display: flex;
    align-items: center;
}

.search-filter-input > svg {
    position: absolute;
    left: 13px;
    width: 18px;
    height: 18px;
    color: #9ca3af;
    pointer-events: none;
}

.search-filter-input > input {
    width: 100%;
    height: 48px;
    padding: 0 14px 0 40px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: #f8fafc;
    color: var(--search-text);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: 0.2s ease;
}

.search-filter-input > input:focus {
    border-color: var(--search-primary);
    background: #ffffff;
    box-shadow: 0 0 0 4px var(--search-primary-ring);
}

.search-filter-select > select {
    width: 100%;
    height: 48px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: #f8fafc;
    color: var(--search-text);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    transition: 0.2s ease;
}

.search-filter-select > select:focus {
    border-color: var(--search-primary);
    background: #ffffff;
    box-shadow: 0 0 0 4px var(--search-primary-ring);
}

.search-filter-submit {
    height: 48px;
    padding: 0 22px;
    border: none;
    border-radius: 9px;
    background: var(--search-primary);
    color: #ffffff;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
}

.search-filter-submit:hover {
    background: var(--search-primary-dark);
}

.search-filter-submit:disabled {
    opacity: 0.7;
    cursor: wait;
}


/* =========================================
   STATUS
========================================= */

.search-status {
    min-height: 22px;
    color: var(--search-muted);
    font-size: 0.83rem;
    margin-bottom: 16px;
}

.search-status strong {
    color: var(--search-text);
}


/* =========================================
   RESULTS GRID
========================================= */

.search-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 18px;
    align-items: stretch;
}

.search-empty {
    grid-column: 1 / -1;
    padding: 60px 20px;
    text-align: center;
    color: var(--search-muted);
    font-size: 0.9rem;
    background: #ffffff;
    border: 1px dashed var(--search-border);
    border-radius: 16px;
}

.search-empty strong {
    display: block;
    color: var(--search-text);
    font-size: 1rem;
    margin-bottom: 6px;
}


/* =========================================
   ARTISAN CARD
========================================= */

.artisan-card {
    --avatar-size: 64px;
    --tier-accent: var(--search-primary);
    --tier-accent-soft: rgba(22, 163, 74, 0.08);

    position: relative;
    display: flex;
    flex-direction: column;
    padding: 22px 22px 18px;
    background: var(--search-white);
    border: 1px solid var(--search-border);
    border-radius: 16px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    min-width: 0;
    min-height: 100%;
    overflow: hidden;
    isolation: isolate;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.artisan-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--tier-accent) 40%,
        var(--tier-accent) 60%,
        transparent 100%
    );
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: 1;
}

.artisan-card:hover {
    border-color: rgba(22, 163, 74, 0.35);
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.08);
    transform: translateY(-2px);
}

.artisan-card:hover::before {
    opacity: 1;
}

.artisan-card:focus-visible {
    outline: 3px solid rgba(22, 163, 74, 0.35);
    outline-offset: 3px;
}

.artisan-card-cover {
    position: absolute;
    z-index: -1;
    inset: 0;
    overflow: hidden;
    background: linear-gradient(135deg, #166534, #86efac);
}

.artisan-card-cover::after {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        145deg,
        rgba(15, 23, 42, 0.82) 0%,
        rgba(15, 23, 42, 0.62) 58%,
        rgba(15, 23, 42, 0.76) 100%
    );
    content: "";
}

.artisan-card-cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.artisan-card.has-cover {
    background: #1f2937;
    border-color: rgba(255, 255, 255, 0.22);
}

.artisan-card.has-cover > :not(.artisan-card-cover) {
    position: relative;
    z-index: 2;
}

.artisan-card.has-cover .artisan-info h3,
.artisan-card.has-cover .artisan-category,
.artisan-card.has-cover .artisan-location,
.artisan-card.has-cover .artisan-description,
.artisan-card.has-cover .artisan-view-profile {
    color: #ffffff;
}

.artisan-card.has-cover .artisan-category,
.artisan-card.has-cover .artisan-location {
    color: rgba(255, 255, 255, 0.82);
}

.artisan-card.has-cover .artisan-avatar {
    border-color: rgba(255, 255, 255, 0.85);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.42);
}

.artisan-card.has-cover .artisan-meta-tag {
    color: #ffffff;
    background: rgba(15, 23, 42, 0.48);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.artisan-card.has-cover .artisan-meta-tag.available {
    color: #dcfce7;
    background: rgba(20, 83, 45, 0.78);
}

.artisan-card.has-cover .artisan-meta-tag.unavailable {
    color: #fee2e2;
    background: rgba(127, 29, 29, 0.78);
}

.artisan-card.has-cover .artisan-meta-tag > span {
    color: rgba(255, 255, 255, 0.78) !important;
}

.artisan-card.has-cover .artisan-view-profile {
    border-top-color: rgba(255, 255, 255, 0.28);
}

/* Featured tier accent */
.artisan-card[data-tier="featured"] {
    --tier-accent: #d97706;
    --tier-accent-soft: rgba(217, 119, 6, 0.10);
    border-color: rgba(217, 119, 6, 0.30);
}

.artisan-card[data-tier="featured"]::before {
    opacity: 0.55;
}

/* Pro tier accent */
.artisan-card[data-tier="pro"] {
    --tier-accent: #2563eb;
    --tier-accent-soft: rgba(37, 99, 235, 0.08);
}

/* Promoted / sponsored */
.artisan-card[data-sponsored="true"] {
    --tier-accent: #7c3aed;
    --tier-accent-soft: rgba(124, 58, 237, 0.10);
    border-color: rgba(124, 58, 237, 0.28);
}

.artisan-card[data-sponsored="true"]::before {
    opacity: 0.6;
}


/* ---- Card header ---- */

.artisan-card-top {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 14px;
    min-width: 0;
}

.artisan-avatar {
    width: var(--avatar-size);
    height: var(--avatar-size);
    flex: 0 0 var(--avatar-size);
    border-radius: 50%;
    overflow: hidden;
    background: #f3f4f6;
    display: grid;
    place-items: center;
    color: #9ca3af;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1px var(--search-border);
    position: relative;
}

.artisan-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.artisan-avatar svg {
    width: 28px;
    height: 28px;
}

.artisan-info {
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.artisan-info h3 {
    margin: 0 0 4px;
    font-size: 1.02rem;
    color: var(--search-text);
    line-height: 1.3;
    font-weight: 700;
    letter-spacing: -0.2px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    word-break: break-word;
}

.artisan-verified-badge {
    display: inline-grid;
    place-items: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--search-primary);
    color: #ffffff;
    flex-shrink: 0;
}

.artisan-verified-badge svg {
    width: 10px;
    height: 10px;
}

.artisan-category {
    margin: 0 0 4px;
    color: var(--search-primary-dark);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.artisan-location {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    color: var(--search-muted);
    font-size: 0.76rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.artisan-location svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}


/* ---- Tier / sponsored badge ---- */

.artisan-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    min-height: 20px;
}

.artisan-tier-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    white-space: nowrap;
}

.artisan-tier-badge.featured {
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fde68a;
}

.artisan-tier-badge.pro {
    color: #1d4ed8;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}

.artisan-tier-badge.sponsored {
    color: #6d28d9;
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
}

.artisan-tier-badge svg {
    width: 10px;
    height: 10px;
}


/* ---- Description ---- */

.artisan-description {
    flex: 1;
    margin: 0 0 14px;
    color: var(--search-muted);
    font-size: 0.83rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    min-height: calc(1.6em * 3);
}


/* ---- Meta row ---- */

.artisan-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    row-gap: 6px;
    margin-bottom: 14px;
    font-size: 0.75rem;
}

.artisan-meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    border-radius: 6px;
    background: #f8fafc;
    color: var(--search-muted);
    font-weight: 500;
    white-space: nowrap;
}

.artisan-meta-tag.available {
    background: var(--search-primary-light);
    color: var(--search-primary-dark);
}

.artisan-meta-tag.available::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--search-primary);
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.18);
}

.artisan-meta-tag.unavailable {
    background: #fef2f2;
    color: var(--search-danger);
}

.artisan-meta-tag svg {
    width: 12px;
    height: 12px;
}


/* ---- View profile footer ---- */

.artisan-view-profile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 14px;
    margin-top: auto;
    border-top: 1px solid #f3f4f6;
    font-size: 0.83rem;
    font-weight: 700;
    color: var(--search-primary);
    letter-spacing: 0.1px;
    transition: color 0.2s ease;
}

.artisan-view-profile svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.artisan-card:hover .artisan-view-profile {
    color: var(--search-primary-dark);
}

.artisan-card:hover .artisan-view-profile svg {
    transform: translateX(4px);
}


/* =========================================
   FOOTER
========================================= */

.search-footer {
    padding: 25px;
    text-align: center;
    background: #ffffff;
    border-top: 1px solid var(--search-border);
}

.search-footer p {
    margin: 0;
    color: #9ca3af;
    font-size: 0.74rem;
}


/* =========================================
   MOBILE
========================================= */

@media (max-width: 760px) {

    .search-page {
        padding: 40px 14px;
    }

    .search-filter-bar {
        grid-template-columns: 1fr;
        padding: 12px;
        gap: 8px;
    }

    .search-filter-submit {
        width: 100%;
    }

    .search-results {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .artisan-card {
        --avatar-size: 54px;
        padding: 18px;
    }

    .artisan-card:hover {
        transform: none;
    }

    .artisan-info h3 {
        font-size: 0.96rem;
    }

    .artisan-description {
        -webkit-line-clamp: 2;
        min-height: calc(1.6em * 2);
    }
}


/* =========================================
   VERY SMALL SCREENS
========================================= */

@media (max-width: 360px) {

    .artisan-card {
        --avatar-size: 46px;
        padding: 16px;
    }

    .artisan-card-top {
        gap: 10px;
    }

    .artisan-avatar svg {
        width: 20px;
        height: 20px;
    }
}