/* ===== 기본 리셋 ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --lg-red: #C8132A;
  --lg-red-dark: #a50f22;
  --lg-red-light: #f5e6e8;
  --white: #ffffff;
  --gray-50: #f9f9f9;
  --gray-100: #f0f0f0;
  --gray-200: #e0e0e0;
  --gray-500: #9e9e9e;
  --gray-700: #555555;
  --gray-900: #1a1a1a;
  --sidebar-width: 230px;
  --header-height: 64px;
}

body {
  font-family: 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== 헤더 ===== */
.site-header {
  background: var(--white);
  border-bottom: 3px solid var(--lg-red);
  height: var(--header-height);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo-img {
  height: 26px;
  width: auto;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.company-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
}

.company-sub {
  font-size: 11px;
  color: var(--gray-500);
}

.header-search {
  flex: 1;
  max-width: 400px;
}

.search-input {
  width: 100%;
  padding: 8px 14px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--gray-50);
  color: var(--gray-900);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--lg-red);
  box-shadow: 0 0 0 3px rgba(200, 19, 42, 0.08);
  background: var(--white);
}

.search-input::placeholder {
  color: var(--gray-500);
}

.header-contact {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--gray-700);
  flex-shrink: 0;
}

.header-contact .phone {
  color: var(--lg-red);
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
}

.header-contact .phone:hover {
  text-decoration: underline;
}

/* ===== 레이아웃 ===== */
.layout {
  display: flex;
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  padding: 20px 24px;
  gap: 20px;
}

/* ===== 사이드바 ===== */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--header-height) + 20px);
  max-height: calc(100vh - var(--header-height) - 40px);
  overflow-y: auto;
}

.sidebar-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  padding: 0 4px;
}

.category-list {
  list-style: none;
  background: var(--white);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

.category-item {
  padding: 11px 16px;
  font-size: 14px;
  cursor: pointer;
  border-left: 4px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  color: var(--gray-700);
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.category-item + .category-item {
  border-top: 1px solid var(--gray-100);
}

.category-item:hover {
  background: var(--lg-red-light);
  color: var(--lg-red);
}

.category-item.active {
  background: var(--lg-red-light);
  border-left-color: var(--lg-red);
  color: var(--lg-red);
  font-weight: 700;
}

.cat-count {
  font-size: 11px;
  color: var(--gray-500);
  font-weight: 400;
}

.category-item.active .cat-count {
  color: var(--lg-red);
}

/* ===== 메인 콘텐츠 ===== */
.main-content {
  flex: 1;
  min-width: 0;
}

.content-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.category-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
}

.product-count {
  font-size: 14px;
  color: var(--gray-500);
}

.sort-controls {
  margin-left: auto;
}

.sort-select {
  padding: 6px 12px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: var(--white);
  color: var(--gray-700);
  cursor: pointer;
}

/* ===== 제품 그리드 ===== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

/* ===== 제품 카드 ===== */
.product-card {
  background: var(--white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.product-image-wrap {
  position: relative;
  overflow: hidden;
}

.product-image {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: var(--gray-100);
  display: block;
}

.service-tag {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(200, 19, 42, 0.9);
  color: var(--white);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
}

.product-info {
  padding: 12px 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.product-category-tag {
  font-size: 11px;
  color: var(--lg-red);
  font-weight: 600;
  letter-spacing: 0.03em;
}

.product-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.4;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-model {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-price-wrap {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--gray-100);
}

.product-price-label {
  font-size: 10px;
  color: var(--gray-500);
}

.product-price {
  font-size: 18px;
  font-weight: 800;
  color: var(--lg-red);
}

.product-price-unit {
  font-size: 12px;
  font-weight: 400;
  color: var(--gray-500);
}

.inquiry-price {
  font-size: 15px !important;
  color: var(--gray-700) !important;
  font-weight: 600 !important;
}

/* ===== 빈 상태 ===== */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-500);
}

.empty-state p {
  font-size: 15px;
}

/* ===== 푸터 ===== */
.site-footer {
  background: var(--gray-900);
  color: var(--gray-500);
  text-align: center;
  padding: 20px;
  font-size: 13px;
  margin-top: auto;
}

.footer-update {
  font-size: 11px;
  margin-top: 4px;
  opacity: 0.7;
}

/* ===== 제품 상세 모달 ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 16px;
  overflow-y: auto;
}

.modal-overlay.active {
  display: flex;
}

.modal-container {
  background: var(--white);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  padding: 32px 28px;
  position: relative;
  animation: modalSlideIn 0.25s ease-out;
}

.modal-detail {
  max-width: 640px;
}

.modal-detail-lg {
  max-width: 960px;
  padding: 28px;
}

/* ===== LG 스타일 상세 레이아웃 ===== */
.detail-layout {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

.detail-left {
  flex: 0 0 420px;
  max-width: 420px;
}

.detail-right {
  flex: 1;
  min-width: 0;
}

.detail-gallery {
  background: var(--gray-50);
  border-radius: 12px;
  overflow: hidden;
}

.detail-main-image {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: contain;
  display: block;
  padding: 20px;
  background: var(--white);
}

.detail-gallery-thumbs {
  display: flex;
  gap: 8px;
  padding: 12px;
  overflow-x: auto;
  background: var(--gray-50);
}

.detail-thumb {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  background: var(--white);
  padding: 4px;
  transition: border-color 0.15s;
}

.detail-thumb:hover {
  border-color: var(--gray-500);
}

.detail-thumb.active {
  border-color: var(--lg-red);
}

/* Right side header */
.detail-right-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--gray-200);
}

.detail-right-header .detail-category {
  font-size: 12px;
  color: var(--lg-red);
  font-weight: 600;
}

.detail-right-header .detail-title {
  font-size: 22px;
  font-weight: 700;
  margin-top: 4px;
  color: var(--gray-900);
  line-height: 1.3;
}

.detail-right-header .detail-model {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 4px;
}

/* Option selectors */
.detail-options {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.detail-option-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-option-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-700);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.detail-option-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.option-chip {
  padding: 7px 14px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: var(--white);
  color: var(--gray-700);
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}

.option-chip:hover {
  border-color: var(--lg-red);
  color: var(--lg-red);
  background: var(--lg-red-light);
}

.option-chip.active {
  border-color: var(--lg-red);
  background: var(--lg-red);
  color: var(--white);
  font-weight: 600;
}

/* Price display */
.detail-price-box {
  background: var(--gray-50);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 16px;
  position: relative;
}

.detail-discount-badge {
  display: inline-block;
  background: var(--lg-red);
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
}

.detail-original-price {
  font-size: 14px;
  color: var(--gray-500);
  text-decoration: line-through;
  margin-bottom: 2px;
}

.detail-current-price {
  font-size: 28px;
  font-weight: 800;
  color: var(--lg-red);
  line-height: 1.2;
}

.detail-price-unit {
  font-size: 14px;
  font-weight: 400;
  color: var(--gray-500);
}

.detail-price-desc {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
}

/* Bottom price table */
.detail-bottom {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-200);
}

.detail-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 12px;
}

.detail-price-table-wrap {
  overflow-x: auto;
}

.detail-price-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 400px;
}

.detail-price-table th,
.detail-price-table td {
  padding: 8px 12px;
  text-align: center;
  border-bottom: 1px solid var(--gray-100);
}

.detail-price-table th {
  background: var(--gray-50);
  color: var(--gray-500);
  font-weight: 600;
  font-size: 11px;
}

.detail-price-table td.period-label {
  font-weight: 600;
  color: var(--gray-700);
  text-align: left;
  white-space: nowrap;
}

.detail-price-table td.selected-cell {
  background: var(--lg-red-light);
  color: var(--lg-red);
  font-weight: 700;
}

/* Detail actions */
.detail-right .detail-actions {
  margin-top: 12px;
}

.detail-right .detail-actions .btn-inquiry {
  width: 100%;
  padding: 14px;
  font-size: 16px;
}

/* Responsive detail modal */
@media (max-width: 768px) {
  .modal-detail-lg {
    max-width: 100%;
    padding: 20px 16px;
  }

  .detail-layout {
    flex-direction: column;
    gap: 20px;
  }

  .detail-left {
    flex: none;
    max-width: 100%;
    width: 100%;
  }

  .detail-current-price {
    font-size: 24px;
  }
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 28px;
  color: var(--gray-500);
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  z-index: 1;
}

.modal-close:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

/* Detail modal */
.detail-header {
  margin-bottom: 24px;
}

.detail-category {
  font-size: 12px;
  color: var(--lg-red);
  font-weight: 600;
}

.detail-title {
  font-size: 22px;
  font-weight: 700;
  margin-top: 4px;
  color: var(--gray-900);
}

.detail-model {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 4px;
  word-break: break-all;
}

.detail-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-section h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 8px;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
}

.detail-table td,
.detail-table th {
  padding: 8px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--gray-100);
  text-align: left;
}

.detail-table td:first-child,
.detail-table th:first-child {
  color: var(--gray-500);
  width: 120px;
  font-weight: 500;
}

.price-table .price-cell {
  color: var(--lg-red);
  font-weight: 700;
  font-size: 15px;
}

.detail-actions {
  margin-top: 24px;
  display: flex;
  gap: 10px;
}

.btn-inquiry {
  flex: 1;
  padding: 12px;
  background: var(--lg-red);
  color: var(--white);
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-inquiry:hover {
  background: var(--lg-red-dark);
}

/* ===== 견적 모달 폼 ===== */
.modal-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 6px;
}

.modal-desc {
  font-size: 14px;
  color: var(--gray-500);
  line-height: 1.6;
  margin-bottom: 24px;
}

.modal-info-box {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 24px;
}

.modal-info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.modal-info-row:last-child {
  margin-bottom: 0;
}

.modal-form-group {
  margin-bottom: 16px;
}

.modal-form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.modal-required {
  color: var(--lg-red);
  margin-left: 2px;
}

.modal-form-input,
.modal-form-select,
.modal-form-textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
  color: var(--gray-900);
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}

.modal-form-input:focus,
.modal-form-select:focus,
.modal-form-textarea:focus {
  outline: none;
  border-color: var(--lg-red);
  box-shadow: 0 0 0 3px rgba(200, 19, 42, 0.08);
}

.modal-form-input::placeholder,
.modal-form-textarea::placeholder {
  color: var(--gray-500);
}

.modal-form-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.modal-form-textarea {
  resize: vertical;
  min-height: 80px;
}

.modal-divider {
  height: 1px;
  background: var(--gray-200);
  margin: 18px 0;
}

.modal-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.modal-checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--lg-red);
  cursor: pointer;
}

.modal-checkbox-text {
  font-size: 13px;
  color: var(--gray-700);
  line-height: 1.5;
}

.modal-submit-btn {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  color: var(--white);
  background: var(--lg-red);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  margin-top: 18px;
}

.modal-submit-btn:hover {
  background: var(--lg-red-dark);
}

.modal-submit-btn:active {
  transform: scale(0.98);
}

.modal-submit-btn:disabled {
  background: var(--gray-500);
  cursor: not-allowed;
  transform: none;
}

/* 성공 메시지 */
.modal-success {
  display: none;
  text-align: center;
  padding: 40px 10px;
}

.modal-success-icon {
  width: 64px;
  height: 64px;
  background: #e8f5e9;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.modal-success-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 8px;
}

.modal-success-desc {
  font-size: 14px;
  color: var(--gray-500);
  line-height: 1.6;
}

.modal-back-btn {
  display: inline-block;
  margin-top: 24px;
  padding: 10px 28px;
  font-size: 14px;
  font-weight: 500;
  color: var(--lg-red);
  border: 1px solid var(--lg-red);
  border-radius: 8px;
  background: var(--white);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}

.modal-back-btn:hover {
  background: var(--lg-red-light);
}

/* ===== 모바일 카테고리 토글 ===== */
.mobile-category-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--lg-red);
  color: var(--white);
  border: none;
  border-radius: 24px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  z-index: 150;
  box-shadow: 0 4px 16px rgba(200, 19, 42, 0.3);
  gap: 6px;
  align-items: center;
}

/* ===== 반응형 ===== */
@media (max-width: 900px) {
  .layout {
    flex-direction: column;
    padding: 16px;
    gap: 16px;
  }

  .sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 100%;
    max-height: calc(100vh - var(--header-height));
    z-index: 150;
    background: var(--white);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    transform: translateY(-110%);
    transition: transform 0.3s ease;
    padding: 16px;
    border-radius: 0;
  }

  .sidebar.open {
    transform: translateY(0);
  }

  .sidebar-title {
    display: block;
  }

  .category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    box-shadow: none;
  }

  .category-item {
    border-left: none !important;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
  }

  .category-item + .category-item {
    border-top: 1px solid var(--gray-200);
  }

  .category-item.active {
    border-color: var(--lg-red);
    background: var(--lg-red-light);
  }

  .mobile-category-toggle {
    display: flex;
  }

  .header-contact span {
    display: none;
  }

  .header-search {
    max-width: 200px;
  }
}

@media (max-width: 600px) {
  .header-search {
    max-width: 150px;
  }

  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

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

  .modal-overlay {
    padding: 0;
    align-items: stretch;
  }

  .modal-container {
    border-radius: 0;
    min-height: 100vh;
    max-width: 100%;
    padding: 24px 16px;
  }
}

@media (max-width: 400px) {
  .product-grid {
    grid-template-columns: 1fr;
  }

  .header-search {
    display: none;
  }
}
