/*
 * 모든딜보기 페이지 - 모던 반응형 디자인
 * 강조 색상: #008f8c
 */

/* ========================================
   상세 페이지 헤더 설정
   ======================================== */
/* PC에서 header-back 및 gdetail-header 숨김 */
@media (min-width: 1024px) {
    .header-back,
    .gdetail-header {
        display: none !important;
    }
}

/* PC 페이지 타이틀 */
.page-title-pc {
    display: none;
}

@media (min-width: 1024px) {
    .page-title-pc {
        display: block;
        font-size: 2rem;
        font-weight: 700;
        color: var(--text-primary, #1a1a1a);
        text-align: center;
        padding: 2rem 0 1rem;
        margin: 0 auto;
        max-width: 480px;
    }

    /* all-deal-container용 (alerts, scrap, myhistory) */
    .all-deal-container .page-title-pc {
        max-width: 768px;
        text-align: left;
        padding: 1.5rem 0 1rem;
    }
}

.fcontents {
    background: var(--bg-gray, #f8f9fa);
    min-height: 100vh;
    padding: 0.5rem 0 2rem 0;
}

.all-deal-container {
    max-width: 100%;
    margin: 0 auto;
}

.bd {
    margin: 1rem;
}

.page-title {
    padding: 1.5rem 1rem;
    background: var(--bg-white, #ffffff);
    margin-bottom: 1rem 0 1rem 0;
}

@media (min-width: 768px) {
    .page-title {
        padding: 2rem;
        border-radius: 16px;
        margin: 1rem;
    }
}

.page-desc {
    font-size: clamp(0.875rem, 2.5vw, 1rem);
    color: var(--text-secondary, #666);
    font-weight: 500;
    margin: 0;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
}

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

/* 상품 그리드 */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0.5rem 0.5rem;
}

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

@media (min-width: 1024px) {
    .fcontents {
        padding: 1.5rem 2rem 3rem;
    }

    .all-deal-container {
        max-width: 768px;
        margin: 0 auto;
    }

    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
        padding: 0;
    }
}

/* 상품 카드 */
.product-card,
.product-item {
    background: var(--bg-white, #ffffff);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
}

.product-card:hover,
.product-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.product-link {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.product-image,
.product-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

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

.product-card:hover .product-image img,
.product-item:hover .product-image-wrapper img {
    transform: scale(1.08);
}

.product-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    border-radius: 20px;
    font-size: clamp(0.7rem, 2vw, 0.8125rem);
    color: #ffffff;
    font-weight: 600;
    z-index: 2;
}

.product-favorite {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 2;
}

.product-favorite:hover {
    background: #ffffff;
    transform: scale(1.1);
}

.product-favorite img {
    width: 18px;
    height: 18px;
}

/* 상품 정보 */
.product-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

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

.product-price {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.discount-rate {
    font-size: clamp(1rem, 3vw, 1.125rem);
    font-weight: 800;
    color: #ff4757;
}

.regular-price {
    font-size: clamp(0.75rem, 2vw, 0.875rem);
    color: var(--text-light, #999);
    text-decoration: line-through;
}

.sale-price {
    font-size: clamp(1rem, 3vw, 1.125rem);
    font-weight: 700;
    color: var(--text-primary, #1a1a1a);
}

.product-site {
    font-size: clamp(0.75rem, 2vw, 0.8125rem);
    color: var(--text-light, #999);
    margin: 0;
}

/* 로딩 스켈레톤 */
.loading-skeleton {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0 1rem;
}

@media (min-width: 768px) {
    .loading-skeleton {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}

@media (min-width: 1024px) {
    .loading-skeleton {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

.product-skeleton {
    background: var(--bg-white, #ffffff);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

.skeleton-text {
    height: 16px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    margin: 12px;
    border-radius: 4px;
}

.skeleton-text.short {
    width: 60%;
}

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

/* 로딩 스피너 */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    gap: 1rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color, #e5e5e5);
    border-top-color: var(--primary-color, #008f8c);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-spinner p {
    font-size: 0.875rem;
    color: var(--text-secondary, #666);
    margin: 0;
}

.no-more-products {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light, #999);
    font-size: 0.875rem;
}

.no-more-products p {
    margin: 0;
}

.no-products-found {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light, #999);
    font-size: 0.875rem;
}

.no-products-found p {
    margin: 0;
}

/* 찜하기 버튼 - product-image-wrapper 안에 위치 */
.product-image-wrapper .jjim-on,
.product-favorite,
.jjim-on {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.product-image-wrapper .jjim-on:hover,
.product-favorite:hover,
.jjim-on:hover {
    background: #ffffff;
    transform: scale(1.1);
}

.product-image-wrapper .jjim-on img,
.product-favorite img,
.jjim-on img {
    width: 14px;
    height: 18px;
}

/* 알림 버튼 */
.product-image-wrapper .alarm-on,
.alarm-on {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.product-image-wrapper .alarm-on:hover,
.alarm-on:hover {
    background: #ffffff;
    transform: scale(1.1);
}

.product-image-wrapper .alarm-on img,
.alarm-on img {
    width: 18px;
    height: 18px;
}

/* ========================================
   PC 레이아웃 추가 (1024px+)
   ======================================== */
@media (min-width: 1024px) {
    /* 컨테이너 */
    .all-deal-container {
        max-width: 768px;
        margin: 0 auto;
    }

    /* 페이지 타이틀/필터 영역 */
    .page-header,
    .filter-section {
        padding: 2rem 1rem;
        margin: 1.5rem 1rem;
        border-radius: var(--radius-lg);
    }

    /* 상품 그리드 패딩 */
    .products-grid {
        padding: 0 1rem;
    }
}

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

@media (min-width: 1024px) {
    .filter-section {
        display: block;
        background: var(--bg-white, #ffffff);
        border-radius: 16px;
        padding: 2rem 2.5rem;
        margin: 0 0 1.5rem 0;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }

    .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, #1a1a1a);
        margin: 0;
    }

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

    .filter-btn {
        padding: 0.625rem 1.25rem;
        border: 2px solid #e5e5e5;
        background: var(--bg-white, #ffffff);
        border-radius: 24px;
        font-size: 0.875rem;
        font-weight: 600;
        color: var(--text-primary, #1a1a1a);
        cursor: pointer;
        transition: all 0.3s ease;
        white-space: nowrap;
    }

    .filter-btn:hover {
        border-color: #008f8c;
        background: #e0f7f6;
        transform: translateY(-2px);
    }

    .filter-btn.active {
        border-color: #008f8c;
        background: #008f8c;
        color: #ffffff;
    }

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

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

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

/* ========================================
   PC 대화면 (1400px+)
   ======================================== */
@media (min-width: 1400px) {
    /* 상품 그리드 5열 */
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
    }
}
