/* ═══════════════════════════════════════════════════
   Affiliate product cards — /css/affiliate/products.css
   Extracted verbatim from the inline <style> in
   storefront/affiliate/eligible-products.blade.php so the
   homepage banner rail and the eligible-products page render
   identical cards. Mobile-first: base rules, then min-width.
   ═══════════════════════════════════════════════════ */

:root {
    --ep-primary: #0046be;
    --ep-dark: #002d7a;
    --ep-purple: #7c3aed;
    --ep-purple-dark: #6d28d9;
    --ep-success: #059669;
    --ep-text: #374151;
    --ep-text-light: #6b7280;
    --ep-bg: #f9fafb;
    --ep-radius: 0.75rem;
}

.ep-hero {
    background: linear-gradient(135deg, #0046be 0%, #002d7a 100%);
    color: #fff;
    padding: 2rem 0;
    text-align: center;
}
.ep-hero h1 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}
.ep-hero p {
    opacity: 0.9;
    font-size: 0.875rem;
    margin: 0 auto;
    max-width: 480px;
}
.ep-hero .ep-back-link {
    color: rgba(255,255,255,0.8);
    font-size: 0.8125rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}
.ep-hero .ep-back-link:hover { color: #fff; }

.ep-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    padding: 1rem 0;
}

.ep-card {
    background: #fff;
    border-radius: var(--ep-radius);
    border: 1px solid #e5e7eb;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    display: flex;
    flex-direction: column;
}
.ep-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.ep-card-img {
    aspect-ratio: 1;
    background: var(--ep-bg);
    overflow: hidden;
    position: relative;
}
.ep-card-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 0.75rem;
    mix-blend-mode: multiply;
    transition: transform 0.3s ease;
}
.ep-card:hover .ep-card-img img {
    transform: scale(1.05);
}
.ep-card-img .ep-commission-badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: var(--ep-success);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    line-height: 1.2;
}

.ep-card-body {
    padding: 0.75rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.ep-card-category {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ep-primary);
    opacity: 0.8;
}

.ep-card-name {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--ep-text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}
.ep-card-name a {
    color: inherit;
    text-decoration: none;
}
.ep-card-name a:hover {
    color: var(--ep-primary);
}

.ep-card-price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--ep-primary);
}
.ep-card-price .ep-from {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--ep-text-light);
}

.ep-card-commission {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: auto;
}
.ep-commission-tag {
    font-size: 0.625rem;
    font-weight: 600;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    line-height: 1.2;
}
.ep-commission-tag.ecom {
    background: #eff6ff;
    color: #1e40af;
}
.ep-commission-tag.loan {
    background: #ecfdf5;
    color: #065f46;
}

/* Share button */
.ep-share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    background: linear-gradient(135deg, var(--ep-purple), var(--ep-purple-dark));
    color: #fff;
    font-weight: 700;
    font-size: 0.6875rem;
    padding: 0.4rem 0.5rem;
    border-radius: 0.375rem;
    border: none;
    cursor: pointer;
    width: 100%;
    transition: all 0.15s ease;
    position: relative;
    margin-top: 0.375rem;
}
.ep-share-btn:hover {
    background: linear-gradient(135deg, var(--ep-purple-dark), #5b21b6);
    color: #fff;
}
.ep-share-btn.copied {
    background: linear-gradient(135deg, var(--ep-success), #047857) !important;
}
.ep-share-btn i { font-size: 0.75rem; }

.ep-share-menu {
    position: absolute;
    bottom: calc(100% + 0.375rem);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: var(--ep-radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    padding: 0.375rem;
    z-index: 50;
    display: none;
}
.ep-share-menu.show {
    display: block;
    animation: epFadeIn 0.15s ease-out;
}
@keyframes epFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
.ep-share-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.625rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ep-text);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    text-decoration: none;
    transition: background 0.1s;
}
.ep-share-menu-item:hover {
    background: #f3f4f6;
    color: var(--ep-text);
}
.ep-share-menu-item i { width: 16px; text-align: center; }
.ep-share-menu-item .fa-copy { color: #6b7280; }
.ep-share-menu-item .fa-facebook { color: #1877f2; }
.ep-share-menu-item .fa-facebook-messenger { color: #0084ff; }
.ep-share-menu-item .fa-whatsapp { color: #25d366; }

/* Not-affiliate CTA */
.ep-join-cta {
    background: linear-gradient(135deg, var(--ep-purple), var(--ep-purple-dark));
    color: #fff;
    font-weight: 700;
    font-size: 0.6875rem;
    padding: 0.4rem 0.5rem;
    border-radius: 0.375rem;
    border: none;
    display: block;
    width: 100%;
    text-align: center;
    text-decoration: none;
    margin-top: 0.375rem;
    transition: all 0.15s ease;
}
.ep-join-cta:hover {
    background: linear-gradient(135deg, var(--ep-purple-dark), #5b21b6);
    color: #fff;
}

/* Empty state */
.ep-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--ep-text-light);
}
.ep-empty i { font-size: 2.5rem; opacity: 0.3; margin-bottom: 1rem; }

/* Tablet */
@media (min-width: 576px) {
    .ep-grid { grid-template-columns: repeat(3, 1fr); gap: 1rem; }
    .ep-hero h1 { font-size: 1.75rem; }
    .ep-card-name { font-size: 0.875rem; }
}

/* Desktop */
@media (min-width: 992px) {
    .ep-hero { padding: 3rem 0; }
    .ep-hero h1 { font-size: 2rem; }
    .ep-hero p { font-size: 1rem; }
    .ep-grid { grid-template-columns: repeat(4, 1fr); gap: 1.25rem; padding: 1.5rem 0; }
    .ep-card-body { padding: 1rem; gap: 0.5rem; }
    .ep-card-name { font-size: 0.9375rem; }
    .ep-card-price { font-size: 1.125rem; }
    .ep-share-btn { font-size: 0.75rem; padding: 0.5rem 0.625rem; }
    .ep-commission-tag { font-size: 0.6875rem; }
}

/* Large desktop */
@media (min-width: 1200px) {
    .ep-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ── Search & Filter bar ─────────────────────────────── */
.ep-filter-sticky {
    position: sticky;
    top: 0;
    z-index: 30;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
}
.ep-filter-bar {
    padding: 0.625rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    /* overflow must NOT be hidden/auto on the sticky ancestor —
       the panels need to escape; we keep overflow only on this
       inner row and ensure panels use fixed positioning. */
}
.ep-filter-bar::-webkit-scrollbar { display: none; }
.ep-search-wrap {
    position: relative;
    flex: 1 1 0;
    min-width: 120px;
}
.ep-search-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 0.875rem;
    pointer-events: none;
}
.ep-search-input {
    width: 100%;
    padding: 0.625rem 2.5rem 0.625rem 2.375rem;
    border: 1.5px solid #d1d5db;
    border-radius: 9999px;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.15s;
    background: #f9fafb;
}
.ep-search-input:focus {
    border-color: var(--ep-primary);
    background: #fff;
}
.ep-search-clear {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 0.75rem;
    display: none;
    padding: 0.25rem;
    line-height: 1;
}
.ep-search-clear.visible { display: block; }

/* ── Dropdown row ─────────────────────────────────────── */
.ep-dd {
    position: relative;
    flex-shrink: 0;
    min-width: 130px;
    max-width: 200px;
}
.ep-dd-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.375rem;
    padding: 0.4375rem 0.75rem;
    border: 1.5px solid #d1d5db;
    border-radius: 0.5rem;
    background: #f9fafb;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--ep-text);
    cursor: pointer;
    user-select: none;
    transition: border-color 0.15s, background 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ep-dd-trigger:hover,
.ep-dd.open .ep-dd-trigger {
    border-color: var(--ep-primary);
    background: #fff;
}
.ep-dd-trigger.has-value {
    border-color: var(--ep-primary);
    background: #eff6ff;
    color: var(--ep-primary);
    font-weight: 600;
}
.ep-dd-trigger-label {
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}
.ep-dd-chevron {
    font-size: 0.65rem;
    color: #9ca3af;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.ep-dd.open .ep-dd-chevron { transform: rotate(180deg); }
.ep-dd-clear {
    font-size: 0.65rem;
    color: var(--ep-primary);
    padding: 0.1rem 0.15rem;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
}

.ep-dd-panel {
    display: none;
    position: fixed;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.625rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    z-index: 9999;
    overflow: hidden;
    min-width: 160px;
    max-width: 260px;
}
.ep-dd.open .ep-dd-panel { display: block; animation: epFadeIn 0.12s ease-out; }

.ep-dd-search-wrap {
    padding: 0.5rem 0.5rem 0.25rem;
    border-bottom: 1px solid #f3f4f6;
}
.ep-dd-search {
    width: 100%;
    padding: 0.375rem 0.625rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    outline: none;
    background: #f9fafb;
}
.ep-dd-search:focus { border-color: var(--ep-primary); background: #fff; }

.ep-dd-list {
    max-height: 220px;
    overflow-y: auto;
    padding: 0.25rem 0;
}
.ep-dd-option {
    display: flex;
    align-items: center;
    padding: 0.4375rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--ep-text);
    cursor: pointer;
    transition: background 0.1s;
    gap: 0.5rem;
}
.ep-dd-option:hover { background: #f3f4f6; }
.ep-dd-option.selected {
    background: #eff6ff;
    color: var(--ep-primary);
    font-weight: 600;
}
.ep-dd-option.selected::after {
    content: "\f00c";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    font-size: 0.65rem;
    margin-left: auto;
}
.ep-dd-empty {
    padding: 0.625rem 0.75rem;
    font-size: 0.75rem;
    color: #9ca3af;
    text-align: center;
}

.ep-clear-all {
    font-size: 0.75rem;
    font-weight: 600;
    color: #ef4444;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    padding: 0.3125rem 0.5rem;
    border-radius: 0.375rem;
    transition: background 0.1s;
    align-self: center;
}
.ep-clear-all:hover { background: #fef2f2; color: #dc2626; }

.ep-results-count {
    font-size: 0.8125rem;
    color: var(--ep-text-light);
    padding: 0.625rem 0 0;
}
.ep-results-count strong { color: var(--ep-text); }
