/* * 파일명: assets/css/style.css
 * 역할: 쇼핑몰 사용자 프론트엔드 전용 글로벌 통합 스타일시트
 */

:root {
    /* 기획안 명시 컬러 지정 */
    /* --main-color: #333132; /* 붉은 기가 미세하게 있는 다크그레이 */
    --main-color: #444; /* 붉은 기가 미세하게 있는 다크그레이 */
    --main-lighter-color: #545454;
    --main-darker-color: #2b2b2b;
    --point-color: #d4a05c;
    --font-red-color: #d40022;
    --bg-white: #fdfdfd; /* 밝은 화이트 톤 컨테이너 배경 */
    --border-color: #eaeaea;
}

/* 기본사용폰트 : 구글 Asta sans, 16px=1em 기준 */
html { overflow-y: scroll; } /* 페이지 길이에 상관없이 세로 스크롤바를 항상 표시하여 레이아웃 밀림 방지 */

body {
    font-family: 'Asta Sans', sans-serif;
    font-size: 16px; 
    background-color: #f5f5f5;
    color: var(--main-color);
    margin: 0;
    padding: 0;
    /* 푸터 하단 고정을 위한 flex 레이아웃 설정 */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* flex-item 수축(쪼그라듦) 현상 완벽 방어: 
   body 직계 자식들의 넓이를 100%로 강제하여 풀와이드 배경이 깨지지 않게 함 */
body > * {
    width: 100%;
}

/* 메인 본문 컨테이너가 남는 세로 공간을 꽉 채워 푸터를 최하단으로 밀어냄 */
body > .container:not(header) {
    flex: 1 0 auto;
}

/* 폰트 사이즈 규격화 (h1~h3만 사용) */
h1 { font-size: 2em; margin: 0; }
h2 { font-size: 1.5em; margin: 0; }
h3 { font-size: 1.25em; margin: 0; }
p, span { font-size: 1em; }

/* 전역 트랜지션 제한 (0.2초 초과 금지) 및 그림자/둥근모서리 사용 제한 */
* {
    box-sizing: border-box;
    transition: all 0.2s ease-in-out; 
    box-shadow: none !important; /* box-shadow 절대 사용 금지 */
}

/* 컨테이너 최대 너비 및 중앙 정렬 */
.container {
    width: 1200px;
    margin: 0 auto;
    background-color: var(--bg-white);
    /* padding: 0 1em; */
}

/* --- 레이아웃 유틸리티 (Flexbox 기반) --- */
.flex-row { display: flex; flex-direction: row; align-items: center; }
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.flex-3 { flex: 3; }
.flex-4 { flex: 4; }

/* 버튼 객체에만 제한적으로 border-radius 허용 */
.btn {
    border-radius: 4px;
    padding: 8px 16px;
    background-color: var(--main-color);
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    border: none;
}
.btn-point { background-color: var(--point-color); }

/* 품절 상태 공통 클래스 */
.sold-out-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.6); display: flex; align-items: center; justify-content: center; z-index: 10; }
.sold-out-text { background: rgba(0, 0, 0, 0.7); color: #fff; padding: 8px 20px; font-weight: bold; font-size: 1.1em; border-radius: 4px; letter-spacing: 2px; }
.btn-disabled { background-color: #ccc !important; border-color: #ccc !important; color: #fff !important; cursor: not-allowed !important; }

/* 기간할인 뱃지 */
.discount-badge { position: absolute; top: 0; left: 0; background-color: #e74c3c; color: #fff; padding: 4px 8px; font-size: 0.85em; font-weight: bold; z-index: 10; border-radius: 4px; }

/* 모바일 반응형 처리 */
@media (max-width: 768px) {
    .mobile-scrollable { overflow-x: auto; white-space: nowrap; }
}

/* =========================================
   0. 공통 헤더/네비게이션 (header.php)
========================================= */
.admin-shortcut { background: #000; color: #fff; padding: 5px 0; font-size: 0.875em; text-align: center; }
.admin-shortcut a { color: var(--point-color); margin: 0 10px; text-decoration: none; }

.top-menu { justify-content: flex-end; padding: 10px 0; font-size: 0.875em; gap: 5px; }
.top-menu a { color: var(--main-color); text-decoration: none; }

.header-main { padding: 20px 0; gap: 20px; align-items: center; }
.header-search input { width: 100%; padding: 10px; border: 2px solid var(--main-color); border-radius: 4px; outline: none; }
.header-cart { text-align: right; }

.gnb { position: relative; border-bottom: 2px solid var(--main-color); }
.gnb-list { display: flex; list-style: none; padding: 0; margin: 0; gap: 30px; }
.gnb-list > li { padding: 15px 0; cursor: pointer; position: relative; }

.sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: max-content;
    min-width: 100%;
    background: var(--main-color);
    border: 1px solid var(--main-darker-color);
    transform: scaleY(0);
    transform-origin: top;
    opacity: 0;
    z-index: 100;
    transition: 0.2s;
}
.gnb-list > li:hover .sub-menu {
    transform: scaleY(1);
    opacity: 1;
}
.sub-menu a {
    display: block;
    padding: 10px 20px;
    color: var(--border-color);
    text-decoration: none;
    border-bottom: 1px dashed var(--main-lighter-color);
    font-weight: normal;
}
.sub-menu a:last-child,
.sub-menu a:last-child:hover {
	border-bottom: none;
}
.sub-menu a:hover {
	font-weight: 800;
    background: #f9fafc;
    color: var(--point-color);
	border-bottom: 1px solid #f9fafc;
}
@media (max-width: 768px) {
    .gnb-list > li:hover .sub-menu { display: none; }
}

/* =========================================
   1. 메인 페이지 (home.php)
========================================= */
.admin-edit-btn { position: absolute; top: 10px; right: 10px; background-color: #fff; color: #ff0000; border: 2px solid #ff0000; padding: 5px 10px; font-weight: bold; cursor: pointer; z-index: 50; text-decoration: none; font-size: 0.875em; }
.admin-empty-section { border: 2px dashed #ccc; min-height: 200px; display: flex; align-items: center; justify-content: center; color: #999; position: relative; margin-bottom: 40px; }

/* 메인 배너가 컨테이너를 벗어나지 않도록 100%로 수정하고 강제 여백 제거 */
.main-banner-wrap { width: 100%; height: 480px; position: relative; background-color: #f8f8f8; overflow: hidden; margin-bottom: 40px; }

.main-banner-slide { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.sub-banner-wrap { width: 100%; min-height: 150px; background-color: #f0f0f0; position: relative; display: flex; align-items: center; justify-content: center; margin-bottom: 40px; }
.product-section { margin-bottom: 40px; position: relative; }
.product-section-title { margin-bottom: 20px; text-align: center; }
.product-section .product-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.product-card { border: 1px solid var(--border-color); padding: 15px; text-align: center; }
.product-card img { max-width: 100%; height: auto; margin-bottom: 10px; }
.product-card .price { font-weight: bold; color: var(--main-color); margin-top: 10px; font-size: 1.125em; }
.swiper-pagination-bullet-active { background: var(--point-color) !important; }
.swiper-button-next, .swiper-button-prev { color: var(--main-color) !important; }
@media (max-width: 768px) { .product-section .product-grid { grid-template-columns: repeat(2, 1fr); } }


/* =========================================
   2. 상품 목록 페이지 (list.php)
========================================= */
.shop-layout { display: flex; gap: 40px; padding: 40px 1em; align-items: flex-start; }
.shop-sidebar { width: 220px; flex-shrink: 0; }
.shop-sidebar h3 { border-bottom: 2px solid var(--main-color); padding-bottom: 15px; margin-top: 0; margin-bottom: 20px; font-size: 1.2em; }
.side-menu { list-style: none; padding: 0; margin: 0; }
.side-menu li { margin-bottom: 5px; }
.side-menu a { display: block; padding: 10px 15px; color: #555; text-decoration: none; border: 1px solid transparent; transition: 0.2s; background: #fff; }
.side-menu a:hover, .side-menu a.active { border-color: var(--point-color); color: var(--point-color); font-weight: bold; }
.side-sub-menu { list-style: none; padding-left: 20px; margin-top: 5px; display: none; }
.side-menu li.open .side-sub-menu { display: block; }
.side-sub-menu a { padding: 8px 15px; font-size: 0.9em; background: transparent; border: none; }
.side-sub-menu a:hover, .side-sub-menu a.active { background: #f9fafc; border: none; }
.shop-main { flex: 1; min-width: 0; }
.shop-top-bar { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); padding-bottom: 15px; margin-bottom: 30px; }
.shop-main .product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }

/* 기획안 반영: 상품 카드 내부 레이아웃 및 버튼 묶음 구조 변경 */
.item-card { background: #fff; border: 1px solid var(--border-color); text-align: left; display: flex; flex-direction: column; height: 100%; transition: border-color 0.2s; position: relative; }
.item-card:hover { border-color: var(--point-color); }
.item-card-link { display: flex; flex-direction: column; flex: 1; padding: 20px; text-decoration: none; color: inherit; }

.item-img-wrap { width: 100%; aspect-ratio: 1/1; margin-bottom: 15px; overflow: hidden; display: flex; align-items: center; justify-content: center; background: #fafafa; position: relative; }
.item-img-wrap img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* 2 & 3. 브랜드 및 호환모델 */
.card-brand-model { font-size: 0.85em; color: #666; margin-bottom: 8px; word-break: keep-all; }
/* 4. 상품명 */
.item-name { font-weight: bold; font-size: 1.05em; margin-bottom: 8px; line-height: 1.4; word-break: keep-all; }
/* 5. 파츠넘버 */
.item-pn { font-size: 0.8em; color: #888; margin-bottom: 15px; flex: 1; }

/* 6. 판매가 영역 (justify-content: space-between) */
.card-price-row { display: flex; justify-content: space-between; align-items: flex-end; margin-top: auto; border-top: 1px dashed #eee; padding-top: 15px; }
.card-price-original { text-decoration: line-through; opacity: 0.6; font-size: 0.9em; }
.card-price-final { font-size: 1.25em; font-weight: bold; color: var(--main-color); text-align: right; }
.card-price-final.has-discount { color: var(--point-color); }

/* 7. 하단 3분할/2분할 액션 버튼 */
.card-buttons { display: flex; border-top: 1px solid var(--border-color); width: 100%; }
.card-btn { flex: 1; padding: 12px 0; text-align: center; border: none; background: #fff; cursor: pointer; border-right: 1px solid var(--border-color); font-size: 0.9em; font-weight: bold; transition: 0.2s; color: var(--main-color); }
.card-btn:last-child { border-right: none; }
.card-btn:hover:not(:disabled) { background: #f9fafc; color: var(--point-color); }
.card-btn:disabled { color: #aaa; cursor: not-allowed; background: #f5f5f5; font-weight: normal; }

@media (max-width: 768px) {
    .shop-layout { flex-direction: column; padding: 20px 0; }
    .shop-sidebar { width: 100%; }
    .shop-main .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .item-card { padding: 15px; }
}


/* =========================================
   3. 상품 상세 페이지 (detail.php)
========================================= */
.product-detail-layout { padding: 40px 1em; }
.detail-top { display: flex; gap: 50px; margin-bottom: 60px; align-items: flex-start; }
.detail-gallery { flex: 1; width: 50%; }
.main-image { width: 100%; border: 1px solid var(--border-color); background: #fff; aspect-ratio: 1/1; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; overflow: hidden; }
.main-image img { max-width: 100%; max-height: 100%; object-fit: contain; }
.thumb-list { display: flex; gap: 10px; flex-wrap: wrap; }
.thumb-item { width: 80px; height: 80px; border: 1px solid var(--border-color); background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.thumb-item:hover, .thumb-item.active { border-color: var(--point-color); }
.thumb-item img { max-width: 100%; max-height: 100%; object-fit: contain; }
.detail-info { flex: 1; width: 50%; }
.detail-brand { color: #888; font-size: 0.95em; margin-bottom: 12px; line-height: 1.5; font-weight: 500; }
.detail-title { font-size: 2em; margin-top: 0; margin-bottom: 20px; line-height: 1.3; color: var(--main-color); }
.price-box { border-bottom: 2px solid var(--main-color); padding-bottom: 20px; margin-bottom: 20px; }
.price-sell { font-size: 2.2em; font-weight: bold; color: var(--point-color); }
.price-sell span { font-size: 0.6em; color: var(--main-color); font-weight: normal; margin-left: 5px; }
.price-original { text-decoration: line-through; }
.summary-table { width: 100%; border-collapse: collapse; margin-bottom: 30px; font-size: 0.95em; }
.summary-table th { text-align: left; padding: 10px 0; color: #666; width: 120px; font-weight: normal; }
.summary-table td { padding: 10px 0; color: #333; font-weight: bold; }
.option-box { background: #f9fafc; border: 1px solid #eee; padding: 20px; margin-bottom: 20px; }
.option-group { margin-bottom: 15px; }
.option-group label { display: block; margin-bottom: 8px; font-size: 0.9em; color: #555; }
.option-select { width: 100%; padding: 12px; border: 1px solid #ddd; outline: none; background: #fff; font-family: inherit; }
.option-select:focus { border-color: var(--point-color); }
.qty-wrap { display: flex; align-items: center; gap: 10px; margin-top: 20px; padding-top: 20px; border-top: 1px dashed #ddd; justify-content: flex-end; }
.qty-label { font-size: 0.9em; color: #666; }
.qty-input-group { display: flex; border: 1px solid #ddd; background: #fff; }
.qty-btn { width: 35px; height: 35px; border: none; background: transparent; font-size: 1.2em; cursor: pointer; }
.qty-input { width: 50px; height: 35px; border: none; border-left: 1px solid #ddd; border-right: 1px solid #ddd; text-align: center; outline: none; font-size: 1em; font-family: inherit; }
.total-price-box { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; font-size: 1.2em; font-weight: bold; }
.total-price-val { font-size: 1.25em; color: var(--font-red-color); }
.action-buttons { display: flex; gap: 10px; margin-top: 30px; }
.btn-lg { padding: 18px 0; font-size: 1.2em; font-weight: bold; text-align: center; cursor: pointer; flex: 1; border: none; }
.btn-buy { background: var(--main-color); color: #fff; }
.btn-cart { background: #fff; color: var(--main-color); border: 1px solid var(--main-color); }
.btn-wish { width: 60px; flex: none; background: #fff; border: 1px solid #ddd; color: #888; font-size: 1.5em; }
.detail-tabs { display: flex; border-bottom: 1px solid var(--main-color); margin-bottom: 40px; }
.tab-btn { flex: 1; padding: 15px 0; text-align: center; background: #f5f5f5; border: 1px solid #ddd; border-bottom: none; cursor: pointer; font-weight: bold; color: #888; font-size: 1.1em; transition: 0.2s; }
.tab-btn.active { background: #fff; color: var(--main-color); border: 1px solid var(--main-color); border-bottom: 1px solid #fff; margin-bottom: -1px; }
.detail-content-area { min-height: 500px; padding-bottom: 100px; line-height: 1.8; }
.sun-editor-editable { background-color: transparent !important; border: none !important; padding: 0 !important; font-family: inherit !important; font-size: inherit !important; color: inherit !important; }
.sun-editor-editable img { max-width: 100%; height: auto; }
.attribute-tags-box { margin-bottom: 40px; padding: 25px; background: #fff; border: 1px solid var(--border-color); }
.attr-tags-title { margin-top: 0; margin-bottom: 20px; font-size: 1.1em; color: var(--main-color); border-bottom: 2px solid var(--main-color); padding-bottom: 10px; }
.attr-tags-table { width: 100%; border-collapse: collapse; }
.attr-tags-row { border-bottom: 1px solid #f0f0f0; }
.attr-tags-th { padding: 15px 10px; width: 150px; text-align: left; color: #666; font-weight: normal; }
.attr-tags-td { padding: 15px 10px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.attr-tag-btn { display: inline-block; padding: 6px 14px; background: #f5f6f8; color: #333; text-decoration: none; border-radius: 4px; font-size: 0.95em; border: 1px solid #e1e5eb; transition: 0.2s; }
.attr-tag-btn:hover { background: var(--point-color) !important; color: #fff !important; border-color: var(--point-color) !important; }
.attr-info-text { display: inline-block; padding: 6px 0; color: #333; font-size: 0.95em; font-weight: bold; cursor: default; }
.empty-desc-msg { text-align: center; padding: 100px 0; color: #aaa; }

/* [복구] 상세 페이지 동적 옵션 렌더링 영역 전용 CSS 추가 */
.selected-options-area { border-top: 1px solid #eee; margin-top: 15px; }
.selected-opt-row { background: #fafafa; border-bottom: 1px solid #eee; padding: 15px; position: relative; }
.opt-row-name { font-size: 0.95em; color: #555; margin-bottom: 12px; padding-right: 25px; line-height: 1.3; word-break: keep-all; }
.opt-row-flex { display: flex; justify-content: space-between; align-items: center; }
.opt-qty-wrap { display: inline-flex; border: 1px solid #ddd; background: #fff; }
.opt-qty-btn { width: 32px; height: 32px; font-size: 1.2em; border: none; background: transparent; cursor: pointer; color: #666; display: flex; align-items: center; justify-content: center; }
.opt-qty-input { width: 45px; height: 32px; border: none; border-left: 1px solid #ddd; border-right: 1px solid #ddd; text-align: center; outline: none; font-size: 0.95em; background: #fff; color: #333; pointer-events: none; }
.opt-row-price { font-weight: bold; font-size: 1.1em; color: var(--main-color); }
.opt-remove-btn { position: absolute; top: 12px; right: 12px; background: none; border: none; font-size: 1.3em; color: #aaa; cursor: pointer; padding: 0; line-height: 1; }

@media (max-width: 768px) {
    .detail-top { flex-direction: column; gap: 30px; }
    .detail-gallery, .detail-info { width: 100%; }
    .action-buttons { flex-wrap: wrap; }
    .btn-wish { width: 100%; }
}


/* =========================================
   4. 폼 및 회원 관련 (로그인, 회원가입 등)
========================================= */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: bold; font-size: 0.9em; }
.form-control { width: 100%; padding: 12px; border: 1px solid var(--border-color); border-radius: 4px; }
.type-tab { flex: 1; text-align: center; padding: 15px; border: 1px solid var(--border-color); cursor: pointer; background: #f8f8f8; }
.type-tab.active { background: #fff; border-bottom: 2px solid var(--point-color); font-weight: bold; color: var(--point-color); }