/**
 * product_detail.css
 * 상품 상세 페이지
 */

/* ========================================
   상품 상세 - 메인 레이아웃
======================================== */
.product-detail {
    display: grid;
    grid-template-columns: 45% 55%;
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    background: var(--bg-color);
    padding: var(--spacing-xl);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* ========================================
   왼쪽: 이미지 영역
======================================== */
.product-images {
    position: sticky;
    top: 20px;
    height: fit-content;
}

.product-main-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--bg-light);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-light);
    margin-bottom: var(--spacing-md);
}

.product-main-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.product-main-image img:hover {
    transform: scale(1.05);
}

/* 썸네일 */
.product-thumbnails {
    display: flex;
    gap: var(--spacing-sm);
    overflow-x: auto;
    padding-bottom: var(--spacing-xs);
}

.product-thumbnails::-webkit-scrollbar {
    height: 6px;
}

.product-thumbnails::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.product-thumbnails .thumbnail {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border: 2px solid var(--border-light);
    border-radius: 4px;
    cursor: pointer;
    object-fit: cover;
    transition: all 0.3s ease;
}

.product-thumbnails .thumbnail:hover {
    border-color: var(--primary-color);
    opacity: 0.8;
}

.product-thumbnails .thumbnail.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

/* ========================================
   오른쪽: 상품 정보
======================================== */
.product-info {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

/* 상품명 */
.product-name {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-color);
    margin-bottom: 0;
}

/* 가격 박스 */
.product-price-box {
    padding: var(--spacing-md);
    background: var(--bg-light);
    border-radius: 8px;
}

.price-original {
    font-size: 1.2em;
    color: var(--text-lighter);
    text-decoration: line-through;
    margin-bottom: var(--spacing-xs);
    text-align: right;  /* ← 추가 */
}

.price-sale {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    justify-content: flex-end;  /* ← 추가! */
}

.price-sale .price {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-color);
}

.discount-badge {
    font-size: 20px;
    font-weight: 700;
    color: var(--danger-color);
    background: rgba(220, 53, 69, 0.1);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 4px;
}

.product-status {
    font-size: 24px;
    font-weight: 700;
    padding: var(--spacing-md);
    text-align: right;  /* ← 추가 */
}

.product-status.soldout {
    color: var(--text-lighter);
}

.product-status.contact {
    color: var(--primary-color);
}

/* 입력형 옵션 (제조사 등) */
.product-input-options {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.option-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--border-light);
}

.option-label {
    font-weight: 600;
    color: var(--text-light);
    font-size: 15px;
}

.option-value {
    color: var(--text-color);
    font-size: 15px;
}

.divider {
    border: none;
    border-top: 1px solid var(--border-light);
    margin: var(--spacing-sm) 0;
}

/* 선택형 옵션 */
.product-select-options {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.option-select-row {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.option-select-row .option-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-weight: 600;
    color: var(--text-color);
    font-size: 15px;
}

.required {
    color: var(--danger-color);
    font-size: 16px;
}

.option-select {
    width: 100%;
    height: 45px;
    padding: 0 var(--spacing-md);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-size: 15px;
    background: var(--bg-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.option-select:hover {
    border-color: var(--primary-color);
}

.option-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* 수량 선택 */
.product-quantity-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: var(--spacing-md);
    align-items: center;
}

.quantity-control {
    display: flex;
    align-items: center;
    width: fit-content;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.qty-btn {
    width: 40px;
    height: 45px;
    border: none;
    background: var(--bg-light);
    color: var(--text-color);
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.qty-btn:hover {
    background: var(--border-light);
}

.qty-btn:active {
    background: var(--border-color);
}

.qty-input {
    width: 60px;
    height: 45px;
    border: none;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-input:focus {
    outline: none;
}

/* 총 가격 */
.product-total-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    background: var(--bg-light);
    border-radius: 8px;
    margin-top: auto;
}

.total-label {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-light);
}

.total-price {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
}

/* 버튼 */
.product-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}

.btn {
    height: 55px;
    border: none;
    border-radius: 4px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cart {
    background: var(--bg-color);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-cart:hover:not(:disabled) {
    background: var(--primary-color);
    color: var(--bg-color);
}

.btn-buy {
    background: var(--primary-color);
    color: var(--bg-color);
}

.btn-buy:hover:not(:disabled) {
    background: #0056b3;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   하단: 상품 설명
======================================== */
.product-description {
    background: var(--bg-color);
    padding: var(--spacing-xl);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.product-description h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--border-light);
}

.description-content {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-light);
}

/* ========================================
   반응형 - 태블릿 (768px ~ 1199px)
======================================== */
@media (max-width: 1199px) {
    .product-detail {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }
    
    .product-images {
        position: relative;
        top: 0;
    }
    
    .product-name {
        font-size: 24px;
    }
    
    .price-sale .price {
        font-size: 28px;
    }
}

/* ========================================
   반응형 - 모바일 (767px 이하)
======================================== */
@media (max-width: 767px) {
    .product-detail {
        padding: var(--spacing-md);
    }
    
    .product-main-image {
        aspect-ratio: 4 / 3;
    }
    
    .product-thumbnails .thumbnail {
        width: 60px;
        height: 60px;
    }
    
    .product-name {
        font-size: 20px;
    }
    
    .product-price-box {
        padding: var(--spacing-md);
    }
    
    .price-original {
        font-size: 16px;
    }
    
    .price-sale .price {
        font-size: 24px;
    }
    
    .discount-badge {
        font-size: 16px;
    }
    
    .option-row {
        grid-template-columns: 1fr;
        gap: var(--spacing-xs);
    }
    
    .product-quantity-row {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }
    
    .product-total-price {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }
    
    .total-price {
        font-size: 26px;
    }
    
    .product-buttons {
        grid-template-columns: 1fr;
    }
    
    .btn {
        height: 50px;
        font-size: 16px;
    }
    
    .product-description {
        padding: var(--spacing-md);
    }
    
    .product-description h2 {
        font-size: 20px;
    }
    
    .description-content {
        font-size: 15px;
    }
}