/* assets/css/public-merchants-list.css */

/* ============================================
   SECTION LAYOUT
   ============================================ */
.sg-merchlist-section {
    padding: var(--sg-space-xl) 0 var(--sg-space-2xl);
    background: var(--sg-surface-alt);
}

.sg-merchlist-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ============================================
   FILTERS BAR
   ============================================ */
.sg-merchlist-filters {
    display: flex;
    align-items: center;
    gap: var(--sg-space-md);
    margin-bottom: var(--sg-space-lg);
    flex-wrap: wrap;
}

.sg-merchlist-search {
    position: relative;
    flex: 1;
    min-width: 240px;
    max-width: 320px;
}

.sg-merchlist-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--sg-gray-400);
    font-size: 0.9rem;
    pointer-events: none;
    transition: color 0.2s ease;
}

.sg-merchlist-search input {
    width: 100%;
    padding: 0.65rem 1rem 0.65rem 2.5rem;
    border: 1.5px solid var(--sg-border);
    border-radius: var(--sg-radius-pill);
    font-size: 0.9rem;
    font-family: var(--sg-font-body);
    background: var(--sg-surface);
    color: var(--sg-text);
    transition: all 0.25s ease;
    outline: none;
}

.sg-merchlist-search input:focus {
    border-color: var(--sg-orange);
    box-shadow: 0 0 0 3px var(--sg-orange-tint-strong);
}

.sg-merchlist-search:focus-within i {
    color: var(--sg-orange);
}

.sg-merchlist-select {
    padding: 0.65rem 2.2rem 0.65rem 1rem;
    border: 1.5px solid var(--sg-border);
    border-radius: var(--sg-radius-pill);
    font-size: 0.9rem;
    font-family: var(--sg-font-body);
    background: var(--sg-surface);
    color: var(--sg-text);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%236b6b66' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: all 0.25s ease;
    outline: none;
    min-width: 160px;
}

.sg-merchlist-select:focus {
    border-color: var(--sg-orange);
    box-shadow: 0 0 0 3px var(--sg-orange-tint-strong);
}

.sg-merchlist-reset {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1.5px solid var(--sg-border);
    background: var(--sg-surface);
    color: var(--sg-gray-600);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sg-merchlist-reset:hover {
    border-color: var(--sg-orange);
    color: var(--sg-orange);
    background: var(--sg-orange-tint);
}

/* ============================================
   RESULTS INFO
   ============================================ */
.sg-merchlist-info {
    font-size: 0.875rem;
    color: var(--sg-text-muted);
    margin-bottom: var(--sg-space-md);
}

.sg-merchlist-info span {
    font-weight: 700;
    color: var(--sg-orange-dark);
}

/* ============================================
   CARDS GRID — 3 per row
   ============================================ */
.sg-merchlist-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sg-space-lg);
}

/* ============================================
   MERCHANT CARD
   Uniform size, elegant hover
   ============================================ */
.sg-merchlist-card {
    background: var(--sg-surface);
    border: 1.5px solid var(--sg-border);
    border-radius: var(--sg-radius-lg);
    overflow: hidden;
    text-decoration: none;
    color: var(--sg-black);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 320px;
    /* Entrance animation */
    opacity: 0;
    transform: translateY(20px);
    animation: sgMerchCardEnter 0.5s ease forwards;
}

.sg-merchlist-card:hover {
    border-color: var(--sg-orange);
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(247, 148, 30, 0.15);
}

@keyframes sgMerchCardEnter {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Logo area — top half */
.sg-merchlist-logo-wrap {
    width: 100%;
    height: 160px;
    overflow: hidden;
    background: var(--sg-gray-100);
    position: relative;
    flex-shrink: 0;
}

.sg-merchlist-logo-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.sg-merchlist-card:hover .sg-merchlist-logo-wrap img {
    transform: scale(1.06);
}

/* Fallback icon */
.sg-merchlist-logo-fallback {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    color: var(--sg-orange);
}

/* Coupon count badge */
.sg-merchlist-coupon-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--sg-orange);
    color: var(--sg-black);
    font-family: var(--sg-font-display);
    font-weight: 700;
    font-size: 0.75rem;
    padding: 0.3rem 0.75rem;
    border-radius: var(--sg-radius-pill);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.sg-merchlist-coupon-badge i {
    font-size: 0.85rem;
}

/* Content area — bottom half */
.sg-merchlist-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--sg-space-md) var(--sg-space-lg);
}

.sg-merchlist-name {
    font-family: var(--sg-font-display);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--sg-black);
    margin: 0 0 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sg-merchlist-card:hover .sg-merchlist-name {
    color: var(--sg-orange-dark);
}

/* Description — clamped to 3 lines */
.sg-merchlist-desc {
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--sg-text-muted);
    margin: 0;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Footer with city tag */
.sg-merchlist-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: var(--sg-space-sm);
    padding-top: var(--sg-space-sm);
    border-top: 1px solid var(--sg-gray-100);
}

.sg-merchlist-city-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: var(--sg-text-muted);
}

.sg-merchlist-city-tag i {
    color: var(--sg-orange);
    font-size: 0.85rem;
}

/* ============================================
   EMPTY & LOADING STATES
   ============================================ */
.sg-merchlist-empty {
    text-align: center;
    padding: var(--sg-space-2xl) 0;
    color: var(--sg-text-muted);
}

.sg-merchlist-empty i {
    font-size: 4rem;
    color: var(--sg-gray-300);
    display: block;
    margin-bottom: var(--sg-space-md);
}

.sg-merchlist-empty h4 {
    font-family: var(--sg-font-display);
    font-weight: 700;
    color: var(--sg-black);
    margin-bottom: 0.5rem;
}

.sg-merchlist-loading {
    text-align: center;
    padding: var(--sg-space-2xl) 0;
    color: var(--sg-text-muted);
}

/* ============================================
   PAGINATION
   ============================================ */
.sg-merchlist-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: var(--sg-space-xl);
    flex-wrap: wrap;
}

.sg-merchlist-page-btn {
    min-width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--sg-border);
    border-radius: var(--sg-radius-sm);
    background: var(--sg-surface);
    color: var(--sg-gray-800);
    font-family: var(--sg-font-display);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0 0.6rem;
}

.sg-merchlist-page-btn:hover:not(:disabled):not(.active) {
    border-color: var(--sg-orange);
    color: var(--sg-orange-dark);
    background: var(--sg-orange-tint);
}

.sg-merchlist-page-btn.active {
    background: var(--sg-orange);
    border-color: var(--sg-orange);
    color: var(--sg-black);
    font-weight: 700;
}

.sg-merchlist-page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 991px) {
    .sg-merchlist-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .sg-merchlist-container { padding: 0 1rem; }

    .sg-merchlist-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .sg-merchlist-search {
        max-width: 100%;
    }

    .sg-merchlist-select {
        width: 100%;
    }

    .sg-merchlist-reset {
        align-self: flex-end;
    }

    .sg-merchlist-card {
        height: 280px;
    }

    .sg-merchlist-logo-wrap {
        height: 140px;
    }
}

@media (max-width: 575px) {
    .sg-merchlist-grid {
        grid-template-columns: 1fr;
    }

    .sg-merchlist-card {
        height: auto;
        min-height: 260px;
    }

    .sg-merchlist-logo-wrap {
        height: 160px;
    }
}