/* ========================================
   모바일 최적화 CSS (콤팩트 버전)
   main.css 다음에 로드되어야 합니다
   ======================================== */

/* ========================================
   1. 기본 설정 (768px 이하)
   ======================================== */
@media (max-width: 768px) {
  /* CSS 변수 재정의 */
  :root {
    --font-xs: 0.7rem;
    --font-sm: 0.75rem;
    --font-base: 0.85rem;
    --font-lg: 0.95rem;
    --font-xl: 1.1rem;
    --font-2xl: 1.3rem;
    --spacing-xs: 0.2rem;
    --spacing-sm: 0.4rem;
    --spacing-md: 0.8rem;
    --spacing-lg: 1.2rem;
    --spacing-xl: 1.6rem;
  }

  /* ========================================
     2. 헤더 영역
     ======================================== */
.header {
  padding: 0.6rem 0;
}

.header-container {
  padding: 0 15px;
}

.logo-image {
  height: 32px;
  max-width: 120px;
}

.btn {
  padding: 8px 14px;
  font-size: 0.75rem;
}


/* 햄버거 메뉴 모바일 최적화 */
.hamburger-btn {
  padding: 6px 10px;
  font-size: 16px;
  min-width: 40px;
  min-height: 40px;
}

.hamburger-dropdown {
  right: -8px;
  min-width: 180px;
}

.menu-item {
  padding: 14px 16px;
}

.menu-icon {
  font-size: 14px;
}

.menu-text {
  font-size: 0.8rem;
}



  /* ========================================
     3. 히어로 섹션
     ======================================== */
  .hero-section {
    padding: 1.5rem 0;
    margin-bottom: 1.5rem;
  }

  .hero-title {
    font-size: 1.6rem;
    margin-bottom: 0.8rem;
  }

  .hero-product-btn {
    font-size: 0.8rem; /* 모바일에서 적절한 크기 */
    padding: 6px 12px; /* 작은 패딩 */
    line-height: 1; /* 라인 높이 고정 */
    align-self: center; /* flex 아이템 자체 중앙 정렬 */
  }


  .main-search-input {
    font-size: 14px;
    padding: 14px 50px 14px 18px;
  }

  .main-search-input {
    font-size: 14px;
    padding: 14px 50px 14px 18px;
  }

  .search-btn {
    width: 42px;
    height: 42px;
    font-size: 18px;
  }


  /* ========================================
     4. 메인 컨테이너 및 섹션
     ======================================== */
  .main-container {
    padding: 1.2rem 15px;
  }

  .content-section {
    padding: 1.2rem;
    margin-bottom: 1.2rem;
    border-radius: 1rem;
  }

  .section-title {
    font-size: 1.3rem;
    margin-bottom: 1rem;
  }

  .section-header {
    margin-bottom: 1rem;
    gap: 0.8rem;
  }

  .filter-btn {
    padding: 6px 12px;
    font-size: 0.7rem;
  }

  /* ========================================
     5. 상품 그리드 및 카드
     ======================================== */
  .product-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .product-set-card {
    margin-bottom: 15px;
  }

  .product-tags {
    padding: 8px 12px;
    font-size: 0.7rem;
  }

  /* ========================================
     6. 메인 상품 영역
     ======================================== */
  .main-product-section {
    padding: 12px;
  }

  .main-product-header {
    margin-bottom: 8px;
    font-size: 0.7rem;
  }

  /* 가로 배치 유지하되 크기 최적화 */
  .main-product-info {
    gap: 12px;
    align-items: flex-start;
  }

  .main-product-image {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
  }

  .main-product-content {
    flex: 1;
    min-width: 0;
    gap: 4px;
  }

  .main-product-title {
    font-size: 0.8rem;
    line-height: 1.2;
  }

  .main-product-price {
    font-size: 0.75rem;
  }

  .main-product-details {
    font-size: 0.65rem;
  }

  .sold-out-badge {
    font-size: 0.65rem;
    padding: 1px 4px;
    margin-left: 4px;
  }

  /* ========================================
     7. 대체상품 영역
     ======================================== */
  .alternatives-header {
    padding: 12px;
    font-size: 0.8rem;
  }

  .alternatives-toggle {
    width: 20px;
    height: 20px;
    font-size: 16px;
  }

  .alternative-item {
    padding: 12px;
  }

  /* 가로 배치 유지 */
  .alternative-info {
    gap: 10px;
    margin-bottom: 8px;
  }

  .alternative-image {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
  }

  .alternative-content {
    flex: 1;
    min-width: 0;
    gap: 3px;
  }

  .alternative-title {
    font-size: 0.75rem;
    line-height: 1.2;
  }

  .alternative-price {
    font-size: 0.7rem;
    margin-bottom: 3px;
  }

  .alternative-description {
    font-size: 0.65rem;
    margin-bottom: 6px;
  }

  .alternative-actions {
    margin-top: 8px;
    padding: 8px 0;
    gap: 8px;
  }

  .alternative-ratings {
    gap: 8px;
  }

  .rating-btn {
    padding: 3px 6px;
    font-size: 0.65rem;
    min-height: 32px;
    min-width: 32px;
  }

  .alternative-author {
    font-size: 0.65rem;
    margin-left: 8px;
  }

  .delete-btn {
    font-size: 0.7rem;
    padding: 3px 5px;
    min-height: 32px;
    min-width: 32px;
  }

  /* ========================================
     8. 상품 세트 하단 통계
     ======================================== */
  .product-set-stats {
    padding: 12px;
    gap: 0.8rem;
  }

  .stats-left {
    gap: 12px;
  }

  .stat-item {
    font-size: 0.65rem;
    padding: 3px 6px;
  }

  .price-summary {
    font-size: 0.6rem;
    padding: 3px 6px;
  }

  .sync-btn {
    padding: 3px 6px;
    font-size: 0.6rem;
  }

  .admin-delete-btn {
    padding: 6px 12px;
    font-size: 0.65rem;
  }


  /* ========================================
     10. 모달 및 폼
     ======================================== */
  .modal-content {
    margin: 2% auto;
    width: 94%;
    max-height: 94vh;
  }

  .modal-header {
    padding: 16px;
  }

  .modal-header h3 {
    font-size: 1.1rem;
  }

  .modal form {
    padding: 16px;
  }

  .form-group {
    margin-bottom: 16px;
  }

  .form-group label {
    font-size: 0.75rem;
    margin-bottom: 4px;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 10px;
    font-size: 0.8rem;
  }

  .form-section {
    margin-bottom: 20px;
    padding: 16px;
  }

  .form-section h4 {
    font-size: 0.9rem;
    margin-bottom: 12px;
  }

  /* ========================================
     11. 관리자/마이페이지
     ======================================== */
  .admin-header,
  .mypage-header {
    text-align: center;
    margin-bottom: 1.5rem;
  }

  .admin-header h1,
  .mypage-header h1 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
  }

  .admin-tabs {
    justify-content: center;
    gap: 8px;
    margin-bottom: 1.5rem;
  }

  .tab-btn {
    padding: 10px 18px;
    font-size: 0.75rem;
  }

  .admin-tab-content {
    padding: 1.2rem;
  }

  .user-card,
  .admin-product-card {
    padding: 16px;
    gap: 12px;
  }

  /* ========================================
     12. 기타 요소들
     ======================================== */
  .toast {
    top: 15px;
    right: 15px;
    left: 15px;
    max-width: none;
    padding: 10px 16px;
    font-size: 0.75rem;
  }

  .coupang-partners-notice {
    font-size: 0.6rem;
    margin-bottom: 6px;
    margin-left: 10px;
  }

  .market-badge {
    font-size: 0.65rem;
  }

  .price-diff {
    font-size: 0.6rem;
    padding: 1px 4px;
  }

  .btn {
    padding: 8px 14px;
    font-size: 0.75rem;
  }
}

/* 변환된 URL 모바일 최적화 */
.converted-url {
  font-size: 0.6rem;
  padding: 1px 4px;
  word-break: break-all;
  line-height: 1.1;
}




/* ========================================
   13. 초소형 모바일 (480px 이하)
   ======================================== */
@media (max-width: 480px) {
  /* 폰트 추가 축소 */
  :root {
    --font-xs: 0.65rem;
    --font-sm: 0.7rem;
    --font-base: 0.8rem;
    --font-lg: 0.9rem;
    --font-xl: 1rem;
    --font-2xl: 1.2rem;
  }

  /* 헤더 더 작게 */
  .logo-image {
    height: 26px;
    max-width: 90px;
  }

  /* 히어로 더 작게 */
  .hero-title {
    font-size: 1.4rem;
  }

  .hero-subtitle {
    font-size: 0.9rem;
  }

  .main-search-input {
    padding: 12px 45px 12px 16px;
  }

  .search-btn {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }

  /* 컨테이너 더 작게 */
  .main-container {
    padding: 1rem 12px;
  }

  .content-section {
    padding: 1rem;
  }

  /* 상품 이미지 더 작게 */
  .main-product-image {
    width: 65px;
    height: 65px;
  }

  .alternative-image {
    width: 55px;
    height: 55px;
  }

  /* 플로팅 버튼 더 작게 */
  .add-product-btn {
    width: 48px;
    height: 48px;
    font-size: 20px;
  }

}




/* ========================================
   14. 터치 최적화
   ======================================== */
@media (hover: none) and (pointer: coarse) {
  /* 터치 타겟 최소 크기 보장 */
  .btn,
  .rating-btn,
  .delete-btn,
  .alternatives-toggle,
  .modal-close,
  .tab-btn {
    min-height: 32px;
    min-width: 32px;
  }

  /* 호버 효과 제거 */
  .product-set-card:hover,
  .content-section:hover,
  .main-product-info:hover,
  .alternative-info:hover {
    transform: none;
    background: inherit;
  }

  /* 터치 피드백 */
  .btn:active,
  .rating-btn:active {
    transform: scale(0.95);
    opacity: 0.8;
    transition: all 0.1s ease;
  }
}