/* ===== wrap ===== */
.wrap {
    background-color: var(--color-white);
    padding-bottom: 80px;
}

/* ===== 검색바 ===== */
.search-wrap {
    padding: 10px 16px 4px;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--color-bg);
    border-radius: 24px;
    padding: 11px 16px;
}

.search-bar input {
    border: none;
    background: none;
    outline: none;
    font-size: 14px;
    color: var(--color-text);
    width: 100%;
}

.search-bar input::placeholder {
    color: var(--color-text-muted);
}

.search-clear {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    line-height: 20px;
    text-align: center;
    border-radius: 50%;
    background-color: #BBBBBB;
    color: #FFFFFF;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

/* ===== 배너 ===== */
.banner-section {
    padding: 12px 16px 0;
    margin-bottom: 20px;
}

/* 배너 높이는 고정하지 않는다. 가로만 100% 로 맞추고 세로는 이미지 비율대로 따라간다.
   트랙 높이는 main.js 가 현재 보이는 슬라이드 높이에 맞춰 조정한다. */
.banner-track {
    display: flex;
    align-items: flex-start;   /* 슬라이드끼리 서로 높이를 끌어당기지 않게 */
    overflow-x: scroll;
    overflow-y: hidden;        /* 트랙 높이를 지정하므로 세로 스크롤바가 생기지 않게 */
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
    border-radius: 14px;
    min-height: 120px;         /* 아주 납작한 이미지여도 이 아래로는 안 내려간다 */
    transition: height 0.25s ease;
}

.banner-track::-webkit-scrollbar { display: none; }

/* 창 크기를 드래그로 바꾸는 동안에는 높이 애니메이션을 끈다 (main.js 가 붙였다 뗀다) */
.banner-track-no-anim { transition: none !important; }

.banner-card {
    flex: 0 0 100%;
    scroll-snap-align: start;
    padding: 0;
    box-sizing: border-box;
    text-decoration: none;
    color: inherit;
}
a.banner-card { cursor: pointer; }
div.banner-card { cursor: default; }

.banner-image {
    display: block;
    width: 100%;
    height: auto;              /* 잘리지 않고 비율대로 */
    background-color: #f1f5f9; /* 로딩 전 자리 */
}

.banner-empty {
    height: 160px;
    border-radius: 14px;
    background-color: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    font-size: 13px;
}

.banner-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #DDDDDD;
    transition: all 0.3s ease;
    cursor: pointer;
}

.dot.active {
    width: 18px;
    border-radius: 3px;
    background-color: var(--color-text);
}

/* ===== 카테고리 ===== */
.category-section {
    margin-bottom: 24px;
}

.category-bar {
    display: flex;
    overflow-x: scroll;
    -ms-overflow-style: none;
    scrollbar-width: none;
    padding: 4px 16px;
    gap: 8px;
}

.category-bar::-webkit-scrollbar { display: none; }

.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    flex: 0 0 auto;
    padding: 10px 14px;
    border-radius: 12px;
    background-color: var(--color-bg);
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s;
}

.category-item.active {
    background-color: var(--color-primary);
}

.cat-icon  { font-size: 22px; line-height: 1; }

.cat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-sub);
    white-space: nowrap;
}

.category-item.active .cat-label {
    color: var(--color-text);
}

/* ===== 섹션 공통 ===== */
.main-section {
    padding: 0 16px;
    margin-bottom: 28px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.section-region {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    background-color: var(--color-bg);
    border-radius: 10px;
    padding: 2px 8px;
}

.section-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-primary-dark, #B8860B);
    color: #E8A500;
}

.section-empty {
    padding: 28px 0;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 13px;
    background-color: var(--color-bg);
    border-radius: 10px;
}

/* ===== 인기 가맹점 (가로 스크롤) ===== */
.popular-scroll {
    display: flex;
    overflow-x: scroll;
    -ms-overflow-style: none;
    scrollbar-width: none;
    gap: 12px;
    padding-bottom: 4px;
}

.popular-scroll::-webkit-scrollbar { display: none; }

.popular-card {
    flex: 0 0 156px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    background-color: var(--color-white);
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s;
}

.popular-card:active { transform: scale(0.97); }

.popular-image {
    position: relative;
    height: 110px;
    background-color: var(--color-bg);
    overflow: hidden;
}

.popular-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.popular-emoji {
    position: absolute;
    left: 8px;
    bottom: 8px;
    font-size: 22px;
    background-color: rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popular-info {
    padding: 10px 12px 12px;
}

.popular-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    margin: 6px 0 5px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.popular-meta {
    display: flex;
    gap: 8px;
    font-size: 11px;
    color: var(--color-text-sub);
}

/* ===== 가맹점 그리드 ===== */
.shop-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.shop-card {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    background-color: var(--color-white);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: transform 0.15s;
}

.shop-card:active { transform: scale(0.97); }

.shop-image {
    position: relative;
    height: 100px;
    background-color: var(--color-bg);
    overflow: hidden;
    display: block;
}

.shop-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.shop-emoji {
    position: absolute;
    left: 6px;
    bottom: 6px;
    font-size: 18px;
    background-color: rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shop-coupon-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    font-size: 10px;
    font-weight: 700;
    color: var(--color-text);
    background-color: var(--color-primary);
    border-radius: 4px;
    padding: 2px 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.shop-info {
    padding: 10px 12px 12px;
}

.shop-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    color: var(--color-text);
    background-color: var(--color-primary);
    border-radius: 4px;
    padding: 2px 6px;
    margin-bottom: 5px;
}

.shop-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 5px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shop-meta {
    display: flex;
    gap: 8px;
    font-size: 11px;
    color: var(--color-text-sub);
}

.shop-rating { color: #F5A623; font-weight: 600; }

/* 리뷰 0개 제휴 가맹점 — ★ 0.0 대신 */
.shop-new {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.3px;
    color: #E8590C;
    border: 1px solid #E8590C;
    border-radius: 4px;
    padding: 0 4px;
    line-height: 16px;
}

/* ===== 쿠폰 카드 ===== */
.coupon-scroll {
    display: flex;
    overflow-x: scroll;
    -ms-overflow-style: none;
    scrollbar-width: none;
    gap: 12px;
    padding-bottom: 4px;
}

.coupon-scroll::-webkit-scrollbar { display: none; }

.coupon-card {
    flex: 0 0 168px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    background-color: var(--color-white);
    text-decoration: none;
    color: inherit;
}

.coupon-upper {
    padding: 14px 14px 14px;
    background-color: var(--color-primary);
    min-height: 80px;
}

.coupon-shop-name {
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: var(--color-text);
    opacity: 0.75;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.coupon-benefit {
    font-size: 15px;
    font-weight: 800;
    color: var(--color-text);
    line-height: 1.35;
    word-break: keep-all;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.coupon-divider {
    height: 1px;
    margin: 0 12px;
    border-top: 1.5px dashed #D0D0D0;
    position: relative;
}

.coupon-divider::before,
.coupon-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    background-color: var(--color-bg);
    border-radius: 50%;
}

.coupon-divider::before { left: -19px; }
.coupon-divider::after  { right: -19px; }

.coupon-lower {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.coupon-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.coupon-expire {
    font-size: 10px;
    color: var(--color-text-muted);
}

.coupon-remain {
    font-size: 11px;
    color: #E8A500;
    font-weight: 700;
}

/* ===== 페이지네이션 ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 20px;
}

.page-link {
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-sub);
    background-color: var(--color-bg);
    text-decoration: none;
}

.page-link.active {
    background-color: var(--color-primary);
    color: var(--color-text);
}

.page-link.disabled {
    opacity: 0.4;
    cursor: default;
}

/* 데스크톱(≥768px)에서만 노출 — 모바일은 .load-more-btn 사용 */
.pagination-desktop {
    display: none;
}

.load-more-btn {
    display: block;
    width: 100%;
    margin-top: 20px;
    padding: 13px;
    border: none;
    border-radius: 10px;
    background-color: var(--color-bg);
    color: var(--color-text-sub);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.load-more-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

/* ===== 인기 used 카운트 ===== */
.popular-used {
    color: var(--color-text-muted);
    font-weight: 600;
}

/* ===== AJAX 로딩 인디케이터 ===== */
.main-loader {
    position: fixed;
    left: 50%;
    bottom: 80px;
    transform: translateX(-50%);
    z-index: 100;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    padding: 10px;
    pointer-events: none;
}

.loader-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: loader-spin 0.7s linear infinite;
}

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

/* ============================================================
   반응형 (모바일 기본 유지 + 태블릿/데스크톱 확장)
   - 콘텐츠 최대폭 1200px, 나머지는 여백
   - 브레이크포인트: 768(태블릿) / 1024(데스크톱)
   ============================================================ */
@media (min-width: 768px) {
    .wrap {
        max-width: 1200px;
        padding-bottom: 110px;   /* 플로팅 독 여유 */
    }

    .search-wrap  { padding: 16px 24px 8px; }
    .main-section { padding: 0 24px; margin-bottom: 36px; }

    /* 배너 높이는 이미지 비율을 따르므로 고정하지 않는다 (빈 상태만 높이를 준다) */
    .banner-section { padding: 16px 24px 0; margin-bottom: 28px; }
    .banner-track   { min-height: 200px; }
    .banner-empty   { height: 260px; }

    /* 카테고리: 항목이 적으니 가운데 정렬 (넘치면 스크롤 유지) */
    .category-bar { justify-content: center; padding: 4px 24px; }

    /* 가맹점 그리드: 화면폭에 맞춰 자동 다열 (2열 → 3~5열) */
    .shop-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 18px;
    }
    .shop-image { height: 150px; }
    .shop-name  { font-size: 14px; }

    /* 인기/HOT 캐러셀 카드도 살짝 키움 */
    .popular-card  { flex: 0 0 200px; }
    .popular-image { height: 140px; }
    .coupon-card   { flex: 0 0 200px; }

    /* 페이지네이션: 데스크톱은 숫자 링크, 더보기 버튼은 모바일 전용이라 숨김 */
    .pagination-desktop { display: flex; }
    .load-more-btn       { display: none; }
}

@media (min-width: 1024px) {
    .banner-track { min-height: 240px; }
    .banner-empty { height: 320px; }

    .main-section { margin-bottom: 40px; }
    .shop-grid    { gap: 20px; }
}
