/*
 * 딜레이다 메인 페이지 - 모던 반응형 디자인
 * 강조 색상: #008f8c
 * PC/Mobile 반응형 지원
 */

/* ========================================
   1. 기본 설정 및 변수
   ======================================== */
:root {
    --primary-color: #008f8c;
    --primary-hover: #007370;
    --text-primary: #1a1a1a;
    --text-secondary: #666;
    --text-light: #000;
    --border-color: #e5e5e5;
    --bg-white: #ffffff;
    --bg-gray: #f8f9fa;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s ease;
}

* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   2. 레이아웃
   ======================================== */
.fcontents {
    display: flex;
    flex-direction: column;
    width: 100%;
    background: var(--bg-gray);
    gap: 0;
    padding: 0 0 2rem 0;
}

/* ========================================
   3. 배너 섹션
   ======================================== */
.banner {
    width: 100%;
}

.banner-swiper {
    width: 100%;
    aspect-ratio: 2 / 1;
    position: relative;
    overflow: hidden;
    background: #ffffff;
}

@media (min-width: 768px) {
    .banner-swiper {
        aspect-ratio: 2 / 1;
        border-radius: var(--radius-lg);
        margin: 1rem;
        width: calc(100% - 2rem);
    }
}

.banner-swiper .swiper-wrapper {
    width: 100%;
    height: 100%;
}

.banner-swiper .swiper-slide {
    width: 100%;
    height: 100%;
}

.header-text-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: block;
    overflow: hidden;
}

.header-text-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.header-text-wrapper:hover img {
    transform: scale(1.05);
}

.banner-swiper .swiper-pagination {
    bottom: 12px;
    z-index: 10;
}

.banner-swiper .swiper-pagination-bullet {
    background: #ffffff;
    opacity: 0.6;
    width: 8px;
    height: 8px;
    transition: var(--transition);
}

.banner-swiper .swiper-pagination-bullet-active {
    background: var(--primary-color);
    opacity: 1;
    width: 24px;
    border-radius: 4px;
}

/* ========================================
   4. 섹션 공통 스타일
   ======================================== */
.section {
    background: var(--bg-white);
    padding: 2rem 1rem;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .section {
        padding: 2.5rem 2rem;
        border-radius: var(--radius-lg);
        margin: 0 1rem 1rem;
    }
}

.subtitle {
    padding: 0 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .subtitle {
        padding: 0 2rem;
    }
}

@media (min-width: 1024px) {
    .subtitle {
        padding: 0;
        margin-bottom: 2rem;
    }
}

.subtitle-2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.text-wrapper-5,
.text-wrapper-8 {
    font-size: clamp(0.9rem, 4vw, 1.25rem);
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.3;
}

@media (min-width: 1024px) {
    .text-wrapper-5,
    .text-wrapper-8 {
        font-size: 1.5rem;
    }
}

.subdesc {
    font-size: clamp(0.875rem, 2.5vw, 1rem);
    color: var(--text-secondary);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.subdesc img {
    width: 16px;
    height: 16px;
    vertical-align: middle;
}

.more {
    width: 24px;
    height: 24px;
    opacity: 0.6;
    transition: var(--transition);
    cursor: pointer;
}

.more:hover {
    opacity: 1;
    transform: translateX(4px);
}

@media (min-width: 1024px) {
    .more {
        width: 28px;
        height: 28px;
    }
}

/* ========================================
   5. 추천딜 섹션
   ======================================== */
.chu {
    background: var(--bg-white);
    padding: 2rem 1rem;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .chu {
        border-radius: var(--radius-lg);
    }
}

.chu-swiper {
    width: 100%;
    padding: 0 0rem 30px !important;
}

@media (min-width: 768px) {
    .chu-swiper {
        padding: 0 0rem 30px !important;
    }
}

.chu-swiper .swiper-pagination {
    bottom: -50px;
    z-index: 10;
}

.chu-swiper .swiper-pagination-bullet {
    background: #ffffff;
    opacity: 0.6;
    width: 8px;
    height: 8px;
    transition: var(--transition);
}

.chu-swiper .swiper-pagination-bullet-active {
    background: var(--primary-color);
    opacity: 1;
    width: 24px;
    border-radius: 4px;
}

.main-layer {
    width: 100%;
    padding: 0.5rem 0;
}

.main-layer-2 {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.main-layer-2:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

.main-s {
    position: relative;
    width: 100%;
    aspect-ratio: 22 / 10;
    overflow: hidden;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.main-s-overlay {
    position: absolute;
    inset: 0;
    background: inherit;
    transition: transform 0.5s ease;
}

.main-s:hover .main-s-overlay {
    transform: scale(1.08);
}

.main-top {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    z-index: 2;
}

.div-wrapper-2 {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 0.85;
}

.text-wrapper-6 {
    font-size: clamp(0.75rem, 2vw, 0.875rem);
    color: #ffffff;
    font-weight: 600;
    white-space: nowrap;
}

.jjim-on {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
    margin-left: auto;
}

.jjim-on:hover {
    background: #ffffff;
    transform: scale(1.1);
}

.jjim-on img {
    width: 20px;
    height: 20px;
}

.title {
    font-size: clamp(1rem, 3vw, 1.125rem);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
    padding: 0 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.site-g {
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 120px;
}

.site-m,
.site-s,
.site-wrapper {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1.5px solid;
    transition: var(--transition);
}

.site-m {
    border-color: #ff4757;
    background: linear-gradient(135deg, #fff5f5 0%, #ffffff 100%);
}

.site-s,
.site-wrapper {
    border-color: var(--border-color);
    background: var(--bg-white);
}

.site-m:hover,
.site-s:hover,
.site-wrapper:hover {
    border-color: var(--primary-color);
    background: #f0fffe;
    transform: translateX(4px);
}

.site,
.site-2 {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
}

.text-wrapper-7 {
    font-size: clamp(0.875rem, 2.5vw, 1rem);
    font-weight: 600;
    color: var(--text-primary);
}

.price {
    font-size: clamp(0.875rem, 2.5vw, 1rem);
    font-weight: 700;
    color: #ff4757;
}

.main-btn {
    text-align: center;
    margin: 0 1rem 1rem;
    padding: 14px 24px;
    background: var(--bg-white);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
    cursor: pointer;
}

.main-btn:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.main-btn .btn {
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    font-weight: 700;
    color: var(--primary-color);
    text-align: center;
    transition: var(--transition);
}

.main-btn:hover .btn {
    color: #ffffff;
}

/* ========================================
   6. 주간별 마감딜 섹션
   ======================================== */
.week {
    background: var(--bg-white);
    padding: 2rem 1rem;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .week {
        border-radius: var(--radius-lg);
    }
}

.subtitle-3 {
    padding: 0 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .subtitle-3 {
        padding: 0 2rem;
    }
}

@media (min-width: 1024px) {
    .subtitle-3 {
        padding: 0;
        margin-bottom: 2rem;
    }
}

.week-menu {
    padding: 0 1rem 1.5rem;
}

@media (min-width: 768px) {
    .week-menu {
        padding: 0 2rem 1.5rem;
    }
}

.wmenu {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.wmenu::-webkit-scrollbar {
    display: none;
}

.wtap,
.wtap-2 {
    flex: 1;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.wtap {
    background: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.wtap-2 {
    background: var(--bg-white);
    border: 2px solid var(--border-color);
}

.wtap:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.wtap-2:hover {
    border-color: var(--primary-color);
    background: #f0fffe;
}

.text-wrapper-9 {
    font-size: clamp(0.875rem, 2.5vw, 1rem);
    font-weight: 700;
    color: #ffffff;
}

.text-wrapper-10 {
    font-size: clamp(0.875rem, 2.5vw, 1rem);
    font-weight: 700;
    color: var(--text-primary);
}

.wlist {
    padding: 0 1rem;
}

@media (min-width: 768px) {
    .wlist {
        padding: 0 2rem;
    }
}

.wlist-2 {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wlist-3 {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: var(--bg-white);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    overflow: hidden;
}

.wlist-3:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.wimg {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

@media (min-width: 768px) {
    .wimg {
        width: 140px;
        height: 140px;
    }
}

.wimg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.wlist-3:hover .wimg img {
    transform: scale(1.1);
}

.wcontent {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    min-width: 0;
}

.text-wrapper-11 {
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    font-weight: 700;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-wrapper-12 {
    font-size: clamp(0.875rem, 2vw, 0.9375rem);
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========================================
   7. 베스트딜 섹션
   ======================================== */
.best {
    background: var(--bg-white);
    padding: 2rem 0;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .best {
        border-radius: var(--radius-lg);
        margin: 1rem 1rem 1rem;
    }
}

.best-f {
    padding: 1rem 1rem 2rem;
}

@media (min-width: 768px) {
    .best-f {
        padding: 1rem 1rem 1rem;
    }
}

.best-s {
    position: relative;
    width: 100%;
    aspect-ratio: 22 / 10 !important;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1rem;
    display: block;
}

.best-s > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.best-s:hover > img {
    transform: scale(1.08);
}

.best-s .div-wrapper-2 {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 9;
}

.best-jjim-on {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.best-jjim-on:hover {
    background: #ffffff;
    transform: scale(1.1);
}

.best-jjim-on img {
    width: 22px;
    height: 22px;
}

.best-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 1rem;
}

.title-2 {
    padding: 10px 0 10px 0;
    font-size: clamp(1rem, 3vw, 1.125rem);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.line {
    width: 100%;
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.desc {
    font-size: clamp(0.875rem, 2.5vw, 1rem);
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.site-m-wrapper {
    display: flex;
    padding: 12px 16px;
    border: 1.5px solid #ff4757;
    background: linear-gradient(135deg, #fff5f5 0%, #ffffff 100%);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.site-m-wrapper:hover {
    border-color: var(--primary-color);
    background: #f0fffe;
    transform: translateX(4px);
}

.site-3 {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
}

/* ========================================
   8. 알쓸정보 섹션
   ======================================== */
.info {
    background: var(--bg-white);
    padding: 2rem 0 3rem;
}

@media (min-width: 768px) {
    .info {
        border-radius: var(--radius-lg);
        margin: 0 1rem 1rem;
    }
}

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

@media (min-width: 768px) {
    .frame {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
        padding: 0 2rem;
    }
}

@media (min-width: 1024px) {
    .frame {
        grid-template-columns: repeat(4, 1fr);
    }
}

.info-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: var(--transition);
}

.info-row:hover {
    transform: translateY(-4px);
}

.info-img {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.info-row:hover .info-img {
    box-shadow: var(--shadow-md);
}

.info-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.info-row:hover .info-img img {
    transform: scale(1.08);
}

.info-title {
    font-size: clamp(0.875rem, 2vw, 1rem);
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8em;
}

/* ========================================
   9. 유틸리티
   ======================================== */
.no-items {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 1rem;
}

/* Lazy loading */
img[loading="lazy"] {
    opacity: 1;
    transition: opacity 0.4s ease-in-out;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

.skeleton-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 카운트다운 타이머 */
.countdown-timer {
    font-variant-numeric: tabular-nums;
}

/* 애니메이션 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

/* ========================================
   10. 베스트딜 랭킹 스타일
   ======================================== */
.best-ranking,
.best-ranking-section {
    background: var(--bg-white);
    padding: 16px;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .best-ranking,
    .best-ranking-section {
        border-radius: var(--radius-lg);
    }
}

.best-ranking a,
.best-ranking-section a {
    text-decoration: none;
    color: inherit;
}

/* 랭킹 헤더 */
.ranking-header {
    margin-bottom: 12px;
}

.ranking-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.ranking-date {
    font-size: 12px;
    color: #aaa;
}

/* 1위 HERO 배너 */
.rank-hero {
    position: relative;
    display: block;
    margin: 12px 0 20px;
    border-radius: 12px;
    overflow: hidden;
}

.hero-bg img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    filter: brightness(0.55);
}

.hero-content {
    position: absolute;
    inset: 0;
    padding: 16px;
    display: flex;
    align-items: flex-end;
}

.hero-rank {
    font-size: 40px;
    font-weight: 800;
    color: #fff;
    margin-right: 12px;
}

.hero-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.hero-thumb {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.hero-text {
    flex: 1;
    min-width: 0;
}

.hero-title {
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hero-reason {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    margin: 4px 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hero-price {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.hero-price .shop {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
}

.hero-price .price {
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

/* 랭킹 리스트 */
.ranking-list {
    margin-top: 0;
}

.ranking-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.rank-num {
    width: 26px;
    font-size: 16px;
    font-weight: 700;
}

.rank-thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    margin: 0 12px;
    object-fit: cover;
}

.rank-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.rank-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-reason {
    font-size: 12px;
    color: #666;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-price {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.rank-price .shop {
    font-size: 12px;
    color: #888;
}

.rank-price .price {
    font-size: 14px;
    font-weight: 700;
    color: #ff4d4f;
}

.no-deals {
    padding: 40px 0;
    text-align: center;
    color: #888;
}

/* 베스트딜 로딩 스켈레톤 */
.best-ranking .loading-skeleton {
    padding: 20px 0;
    text-align: center;
}

@media (min-width: 768px) {
    .hero-bg img {
        height: 220px;
    }

    .hero-title {
        font-size: 17px;
    }

    .ranking-item {
        padding: 16px 0;
    }
}

/* ========================================
   11. 상품 태그 스타일
   ======================================== */
.product-tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: clamp(0.7rem, 2vw, 0.8rem);
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    opacity: 0.9;
}

/* 남은시간 하단 배치 */
.main-bottom {
    position: absolute;
    bottom: 12px;
    left: 12px;
    z-index: 2;
}

/* 베스트딜 카드 태그 */
.best-s .product-tag {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 9;
}

/* 베스트딜 카드 남은시간 하단 배치 */
.best-s .div-wrapper-2.bottom-left {
    top: auto;
    bottom: 12px;
    left: 12px;
}

/* ========================================
   12. 플로팅 팝업 스타일
   ======================================== */
.floating-popup {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.4s ease-out;
}

.floating-popup.show {
    transform: translateY(0);
}

.floating-popup.hide {
    transform: translateY(100%);
}

.popup-content {
    background: var(--bg-white);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.popup-content img {
    width: 100%;
    height: auto;
    max-height: 50vh;
    object-fit: contain;
}

.popup-image-link {
    display: block;
}

.popup-text {
    padding: 1rem 1.5rem;
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.6;
    overflow-y: auto;
    max-height: 30vh;
}

.popup-buttons {
    display: flex;
    border-top: 1px solid var(--border-color);
}

.popup-buttons button {
    flex: 1;
    padding: 1rem;
    border: none;
    background: var(--bg-white);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.popup-buttons button:first-child {
    border-right: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.popup-buttons button:last-child {
    color: var(--primary-color);
}

.popup-buttons button:hover {
    background: var(--bg-gray);
}

@media (min-width: 768px) {
    .floating-popup {
        left: 50%;
        right: auto;
        transform: translateX(-50%) translateY(100%);
        width: 480px;
        max-width: 90vw;
    }

    .floating-popup.show {
        transform: translateX(-50%) translateY(0);
    }

    .floating-popup.hide {
        transform: translateX(-50%) translateY(100%);
    }

    .popup-content {
        border-radius: var(--radius-lg);
        margin-bottom: 20px;
    }
}

/* ========================================
   13. PC 필터 섹션 (1024px+만 표시)
   ======================================== */
.filter-section {
    display: none;
}

@media (min-width: 1024px) {
    .filter-section {
        display: block;
        background: var(--bg-white);
        border-radius: var(--radius-lg);
        padding: 2rem 2.5rem;
        margin: 0;
        box-shadow: var(--shadow-sm);
    }

    .filter-container {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }

    .filter-group {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .filter-label {
        font-size: 0.9375rem;
        font-weight: 700;
        color: var(--text-primary);
        margin: 0;
    }

    .filter-options {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .filter-btn {
        padding: 0.625rem 1.25rem;
        border: 2px solid var(--border-color);
        background: var(--bg-white);
        border-radius: 24px;
        font-size: 0.875rem;
        font-weight: 600;
        color: var(--text-primary);
        cursor: pointer;
        transition: var(--transition);
        white-space: nowrap;
    }

    .filter-btn:hover {
        border-color: var(--primary-color);
        background: var(--primary-light);
        transform: translateY(-2px);
    }

    .filter-btn.active {
        border-color: var(--primary-color);
        background: var(--primary-color);
        color: #ffffff;
    }

    /* 카테고리 필터 버튼 - 각 카테고리별 색상 */
    .category-filters .filter-btn:not(.active):hover {
        border-color: var(--filter-color, var(--primary-color));
        background: color-mix(in srgb, var(--filter-color, var(--primary-color)) 10%, white);
    }

    .category-filters .filter-btn.active {
        background: var(--filter-color, var(--primary-color));
        border-color: var(--filter-color, var(--primary-color));
    }

    /* 전체 버튼은 항상 메인 색상 사용 */
    .category-filters .filter-btn[data-category="전체"] {
        --filter-color: var(--primary-color);
    }

    /* 필터링된 상품 섹션 */
    .filtered-products-section {
        background: var(--bg-white);
        border-radius: var(--radius-lg);
        padding: 2.5rem;
        margin: 0;
    }

    .filtered-products-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 2rem;
        padding-bottom: 1rem;
        border-bottom: 2px solid var(--border-color);
    }

    .section-title {
        font-size: 1.5rem;
        font-weight: 800;
        color: var(--text-primary);
        margin: 0;
    }

    .btn-reset-filter {
        padding: 0.625rem 1.25rem;
        border: 2px solid var(--border-color);
        background: var(--bg-white);
        border-radius: 24px;
        font-size: 0.875rem;
        font-weight: 600;
        color: var(--text-secondary);
        cursor: pointer;
        transition: var(--transition);
    }

    .btn-reset-filter:hover {
        border-color: var(--primary-color);
        color: var(--primary-color);
        background: var(--primary-light);
    }

    .filtered-products-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }

    /* 로딩 상태 */
    .filtered-products-grid.loading {
        opacity: 0.5;
        pointer-events: none;
    }

    .loading-message {
        grid-column: 1 / -1;
        text-align: center;
        padding: 3rem;
        color: var(--text-secondary);
        font-size: 1rem;
    }
}

@media (min-width: 1400px) {
    .filtered-products-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* ========================================
   PC 레이아웃 (1024px+)
   ======================================== */
@media (min-width: 1024px) {
    /* 전체 컨테이너 */
    .fcontents {
        max-width: 768px;
        margin: 0 auto;
        padding: 1.5rem 2rem 3rem;
        gap: 1.5rem;
    }

    /* 배너 비율 변경 */
    .banner-swiper {
        aspect-ratio: 2 / 1;
        border-radius: var(--radius-lg);
        margin: 0;
        width: 100%;
    }

    .banner {
        margin-bottom: 0;
    }

    /* 추천딜 섹션 */
    .chu {
        border-radius: var(--radius-lg);
    }

    .subtitle {
        padding: 0;
        margin-bottom: 2rem;
    }

    /* 주간별 딜 섹션 */
    .week {
        border-radius: var(--radius-lg);
    }

    .subtitle-3,
    .week-menu {
        padding: 0;
    }

    .wlist {
        padding: 0;
    }

    /* 주간별 딜 2열 그리드 */
    .wlist-2 {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .wlist-3 {
        display: flex;
    }

    .wimg {
        width: 120px;
        height: 120px;
        flex-shrink: 0;
    }

    /* 베스트딜 섹션 */
    .best-ranking,
    .best-ranking-section {
        border-radius: var(--radius-lg);
    }

    /* 1위 히어로 배너 확대 */
    .hero-bg img {
        height: 280px;
    }

    /* 베스트딜 리스트 - PC 기본 스타일은 1200px+에서 적용 */

    /* 알쓸정보 섹션 */
    .info {
        border-radius: var(--radius-lg);
        margin: 0;
        padding: 2.5rem;
    }

    .frame {
        padding: 0;
    }
}

/* ========================================
   태블릿 레이아웃 (1024-1199px) - 베스트딜
   ======================================== */
@media (min-width: 1024px) and (max-width: 1199px) {
    .best-ranking,
    .best-ranking-section {
        padding: 1.5rem;
    }

    .ranking-list {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .ranking-item {
        border-bottom: 1px solid var(--border-color);
        padding: 0.75rem 0;
        display: flex;
        align-items: center;
    }
}

/* ========================================
   데스크톱 레이아웃 (1200px+) - 베스트딜
   ======================================== */
@media (min-width: 1200px) {
    .best-ranking,
    .best-ranking-section {
        padding: 2.5rem;
    }

    .ranking-list {
        display: grid;
        grid-template-columns: repeat(1, 1fr);
        gap: 1rem;
    }

    .ranking-item {
        border-bottom: none;
        padding: 1rem;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        transition: var(--transition);
    }

    .ranking-item:hover {
        border-color: var(--primary-color);
        box-shadow: var(--shadow-sm);
    }
}

/* ========================================
   PC 대화면 (1400px+)
   ======================================== */
@media (min-width: 1400px) {
    /* 알쓸정보 5열 */
    .frame {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========================================
   Sidebar Banner Layout (PC 1024px+)
   ======================================== */

/* Default layout - no sidebar */
#contents {
    width: 100%;
}

.content-wrapper {
    display: flex;
    width: 100%;
    justify-content: center;
}

.main-content {
    width: 100%;
    max-width: 768px;
}

.sidebar-banner {
    display: none;
}

/* PC Layout with Sidebar (1024px+) */
@media (min-width: 1024px) {
    #contents {
        max-width: 1024px;
        margin: 0 auto;
        padding: 0 1rem;
    }

    .content-wrapper {
        display: flex;
        gap: 1rem;
        width: 100%;
        justify-content: flex-start;
    }

    /* Main content area */
    .main-content {
        width: 768px;
        flex-shrink: 0;
    }

    /* Sidebar banner (when present) */
    .sidebar-banner {
        display: block;
        flex-shrink: 0;
        width: 240px;
        margin-top: 1.5rem;
    }

    /* When no sidebar, content stays centered at 768px */
    .content-wrapper:not(:has(.sidebar-banner)) {
        justify-content: center;
    }

    .sidebar-banner-wrapper {
        position: sticky;
        top: 1.5rem;
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .sidebar-banner-item {
        display: block;
        border-radius: var(--radius-md);
        overflow: hidden;
        box-shadow: var(--shadow-sm);
        transition: var(--transition);
    }

    .sidebar-banner-item:hover {
        box-shadow: var(--shadow-md);
        transform: translateY(-2px);
    }

    .sidebar-banner-item img {
        width: 100%;
        height: auto;
        display: block;
    }
}

/* Note: Removed 1200px+ adjustment to maintain 1024px layout
   Previously had width: 280px at 1200px+
   But 280px + 16px gap + 768px content = 1064px > 1024px
   Keeping sidebar at 240px ensures perfect 1024px fit (240 + 16 + 768 = 1024) */
