/*
 * 상품 상세 페이지 - 모던 반응형 디자인
 * 강조 색상: #008f8c
 */

/* ========================================
   상세 페이지 헤더 설정
   ======================================== */
/* 모바일에서 기본 헤더 및 탭 네비게이션 숨김 */
@media (max-width: 1023px) {
    #header {
        display: none !important;
    }

    .tab_nav.common {
        display: none !important;
    }
}

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

/* 상품 이미지 슬라이더 */
.pv_slider {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    margin-bottom: 0.5rem;
    overflow: hidden;
    box-sizing: border-box;
}

.pv_slider img {
    width: 100%;
    height: 100%;
    object-fit: fill;
    display: block;
}

@media (min-width: 768px) {
    .pv_slider {
        aspect-ratio: 4 / 3;
        margin: 0 1rem 0.5rem;
    }
}

@media (min-width: 1024px) {
    .pv_slider {
        aspect-ratio: 4 / 3;
        border-radius: var(--radius-lg);
        margin: 1rem 2rem 0.5rem;
    }
}

.pagination {
    position: absolute;
    bottom: 16px;
    right: 16px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    border-radius: 20px;
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 600;
}

/* 상품 기본 정보 */
.product_info {
    background: var(--bg-white, #ffffff);
    padding: 0.2rem 1rem;
    margin-bottom: 0.5rem;
}

@media (min-width: 768px) {
    .product_info {
        padding: 1rem;
        border-radius: 16px;
        margin: 0 1rem 0.5rem;
    }
}

.brand {
    font-size: clamp(0.75rem, 2vw, 0.875rem);
    color: var(--primary-color, #008f8c);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.product_info .title {
    font-size: clamp(1.25rem, 4vw, 1.5rem);
    font-weight: 800;
    color: var(--text-primary, #1a1a1a);
    line-height: 1.3;
    margin: 0 0 1rem;
}

.price_actions_row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.price_row {
    flex: 1;
}

.price_row .price {
    font-size: clamp(1.5rem, 5vw, 2rem);
    font-weight: 800;
    color: #ff4757;
}

.actions {
    display: flex;
    gap: 8px;
}

.btn_like,
.btn_share,
.btn_alarm {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-gray, #f8f9fa);
    border: 1px solid var(--border-color, #e5e5e5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.btn_like:hover,
.btn_share:hover,
.btn_alarm:hover {
    background: var(--primary-color, #008f8c);
    border-color: var(--primary-color, #008f8c);
    transform: scale(1.1);
}

.btn_like img,
.btn_share img,
.btn_alarm img {
    width: 22px;
    height: 22px;
    transition: all 0.3s ease;
}

.btn_like:hover img,
.btn_share:hover img,
.btn_alarm:hover img {
    filter: brightness(0) invert(1);
}

/* 가격 비교 */
.price_compare {
    background: var(--bg-white, #ffffff);
    padding: 0.2rem 1rem;
    margin-bottom: 0.5rem;
}

@media (min-width: 768px) {
    .price_compare {
        padding: 0.2rem;
        border-radius: 16px;
        margin: 0 1rem 0.5rem;
    }
}

.price_compare .title {
    font-size: clamp(1.125rem, 3vw, 1.25rem);
    font-weight: 700;
    color: var(--text-primary, #1a1a1a);
    margin: 0 0 0.5rem;
}

.price_list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 0.5rem;
}

.price_item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-radius: 8px;
    border: 1.5px solid;
    transition: all 0.3s ease;
}

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

.price_item:not(.primary) {
    border-color: var(--border-color, #e5e5e5);
    background: var(--bg-white, #ffffff);
}

.price_item:hover {
    border-color: var(--primary-color, #008f8c);
    background: #f0fffe;
    transform: translateX(4px);
}

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

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

.price_info_text {
    font-size: 0.75rem;
    color: var(--text-light, #999);
    line-height: 1.5;
    margin: 0;
}

/* 추천 이유 */
.reason_section {
    background: var(--bg-white, #ffffff);
    padding: 1.5rem 1rem;
    margin-bottom: 1rem;
}

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

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

.reason_text {
    font-size: clamp(0.9375rem, 2.5vw, 1rem);
    color: var(--text-secondary, #666);
    line-height: 1.7;
    white-space: pre-wrap;
    margin: 0;
}

/* 상품 설명 */
.description_section {
    background: var(--bg-white, #ffffff);
    padding: 1.5rem 1rem;
    margin-bottom: 1rem;
}

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

.description_content {
    font-size: clamp(0.9375rem, 2.5vw, 1rem);
    color: var(--text-secondary, #666);
    line-height: 1.7;
    overflow: hidden;
    overflow-wrap: break-word;
    word-break: break-word;
}

.description_content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
}

.description_content h1,
.description_content h2,
.description_content h3 {
    color: var(--text-primary, #1a1a1a);
    margin: 1.5rem 0 1rem;
    font-weight: 700;
}

.description_content p {
    margin: 1rem 0;
}

.description_content ul,
.description_content ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.description_content li {
    margin: 0.5rem 0;
}

/* CKEditor 콘텐츠 내부 요소 overflow 방지 */
.description_content.ck-content * {
    max-width: 100%;
}

.description_content.ck-content img,
.description_content.ck-content video,
.description_content.ck-content iframe,
.description_content.ck-content table {
    max-width: 100%;
    height: auto;
    overflow: hidden;
}

.description_content.ck-content table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.description_content.ck-content pre {
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* 연관 상품 */
.related_section {
    background: var(--bg-gray, #f8f9fa);
    padding: 1.5rem 1rem;
    margin-bottom: 1rem;
}

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

.related_section .section_title {
    font-size: clamp(1.125rem, 3vw, 1.25rem);
    font-weight: 700;
    color: var(--text-primary, #1a1a1a);
    margin: 0 0 1rem;
}

.related_grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

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

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

.related_item {
    display: flex;
    flex-direction: column;
    background: var(--bg-white, #ffffff);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

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

.related_item .item_img {
    width: 100%;
    aspect-ratio: 1 / 1;
    background-color: #f0f0f0;
    background-size: cover;
    background-position: center;
    transition: transform 0.5s ease;
}

.related_item:hover .item_img {
    transform: scale(1.08);
}

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

.related_item .item_price {
    font-size: clamp(1rem, 3vw, 1.125rem);
    font-weight: 700;
    color: var(--text-primary, #1a1a1a);
    padding: 0 12px 12px;
    margin: 0;
}

/* 하단 고정 버튼 */
.pv_bottom {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 768px;
    background: var(--bg-white, #ffffff);
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 12px;
    border-top: 1px solid var(--border-color, #e5e5e5);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 1000;
}

.pv_bottom .btn_like,
.pv_bottom .btn_alarm {
    width: 48px;
    height: 48px;
    border: 1.5px solid var(--border-color, #e5e5e5);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-white, #ffffff);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.pv_bottom .btn_like:hover,
.pv_bottom .btn_alarm:hover {
    border-color: var(--primary-color, #008f8c);
    background: #f0fffe;
}

.pv_bottom .btn_like img,
.pv_bottom .btn_alarm img {
    width: 24px;
    height: 24px;
}

.pv_bottom .btn_buy {
    flex: 1;
    height: 48px;
    background: var(--primary-color, #008f8c);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.pv_bottom .btn_buy:hover {
    background: var(--primary-hover, #007370);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 143, 140, 0.3);
}

/* 공유 모달 */
.share_modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.share_modal.active {
    display: flex;
}

.share_modal_content {
    background: var(--bg-white, #ffffff);
    border-radius: 16px;
    padding: 2rem;
    max-width: 400px;
    width: calc(100% - 2rem);
    margin: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.share_modal_content h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary, #1a1a1a);
    margin: 0 0 1.5rem;
    text-align: center;
}

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

.share_modal_buttons button {
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.share_modal_buttons button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.share_modal_buttons .btn_kakao {
    background: #FEE500;
    color: #000000;
}

.share_modal_buttons .btn_kakao:hover {
    background: #F7DC00;
}

.share_modal_buttons .btn_facebook {
    background: #1877F2;
    color: #ffffff;
}

.share_modal_buttons .btn_facebook:hover {
    background: #1565D8;
}

.share_modal_buttons .btn_copy {
    background: var(--text-secondary, #666);
    color: #ffffff;
}

.share_modal_buttons .btn_copy:hover {
    background: var(--text-primary, #1a1a1a);
}

.share_modal_buttons .btn_close {
    background: var(--bg-gray, #f8f9fa);
    color: var(--text-primary, #1a1a1a);
    border: 1px solid var(--border-color, #e5e5e5);
}

.share_modal_buttons .btn_close:hover {
    background: var(--border-color, #e5e5e5);
}

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

    /* 하단 고정 버튼 - PC에서는 숨김 */
    .pv_bottom {
        display: none;
    }

    /* 상품 이미지 슬라이더 */
    .pv_slider,
    .product_image_slider {
        aspect-ratio: 4 / 3;
        border-radius: var(--radius-lg);
        margin: 1rem auto 0.5rem;
    }

    /* 상품 정보 섹션 */
    .product_info,
    .price_compare,
    .recommendation_reason,
    .product_description,
    .similar_products,
    .related_products {
        padding: 2rem;
        border-radius: var(--radius-lg);
        margin: 0.5rem 1rem;
    }

    .product_info .title {
        font-size: clamp(1.5rem, 3vw, 2rem);
    }

    .price_row .price {
        font-size: clamp(2rem, 4vw, 2.5rem);
    }

    /* 가격 비교 리스트 2열 그리드 */
    .price_list,
    .price_comparison_list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    /* 구매 버튼 */
    .product_actions {
        max-width: 768px;
        margin: 0 auto;
        padding: 0 2rem;
    }
}

/* ========================================
   PC 대화면 (1400px+)
   ======================================== */
@media (min-width: 1400px) {
    /* 유사 상품 5열 */
    .related_grid {
        grid-template-columns: repeat(5, 1fr);
    }
}
