/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* 깔끔한 스크롤바 스타일 - 컨텐츠 위에 떠 있는 오버레이 스타일 */
html {
  scrollbar-width: none; /* Firefox: 기본 스크롤바 숨김 */
  overflow-y: scroll;
}

/* WebKit 브라우저 - 기본 스크롤바 숨김 */
::-webkit-scrollbar {
  width: 0;
  background: transparent;
}

/* 커스텀 오버레이 스크롤바는 JavaScript로 구현 */

/* 스크롤바 숨김 유틸리티 */
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* number input 스피너(화살표) 숨김 */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield; /* Firefox */
}

/* Hotwire Native 앱 전용 — 길게 누르기 시 링크 미리보기/콜아웃 비활성화 */
.turbo-native {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.turbo-native .select-text {
  -webkit-user-select: text;
  user-select: text;
}
.turbo-native a,
.turbo-native img,
.turbo-native button {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

/* ============================================
   웹 반응형 레이아웃 (481px+)
   ============================================
   Tailwind v4가 tailwind/application.css 내 CSS를
   @layer utilities에 넣어서 유틸리티 클래스를 오버라이드 못하므로
   이 파일(레이어 밖)에 배치하여 우선순위 확보.
   ============================================ */

/* 컨테이너 폭: web.html.erb에서 body 직접 스크롤 + main max-w-[960px]로 처리 */
/* #app-scroll-container는 application.html.erb (앱) 전용 — 웹에서는 존재하지 않음 */

/* Tablet: 2열 그리드 */
@media (min-width: 481px) {
  .product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 16px 0;
  }

  /* 그리드 직접 자식 (a.block): 오버플로우 방지 */
  .product-grid > a {
    min-width: 0;
    overflow: hidden;
  }

  /* 카드: 가로 → 세로 배치 */
  .product-grid .product-card {
    flex-direction: column;
    gap: 0;
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
    min-width: 0;
    background: var(--color-bg-card);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  }

  .product-grid .product-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: var(--color-bg-card);
  }

  /* 구분선 숨김 (그리드에서 불필요) */
  .product-grid .product-card > div[aria-hidden="true"]:last-of-type {
    display: none;
  }

  /* 썸네일: 풀 width 정사각형 */
  .product-grid .product-card-thumb {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    border-radius: 0;
    flex-shrink: 0;
  }

  /* 정보 영역: 패딩 추가 + 오버플로우 방지 */
  .product-grid .product-card-info {
    padding: 10px 12px 12px;
    min-width: 0;
    overflow: hidden;
  }

  /* 제목: 그리드에서 1줄 제한 */
  .product-grid .product-card-title {
    -webkit-line-clamp: 1 !important;
  }

  /* 채팅/좋아요 아이콘: 그리드에서 숨김 */
  .product-grid .product-card-stats {
    display: none !important;
  }

  /* 드롭다운 래퍼: 좌우 패딩 제거 (main px-4와 중복 방지) */
  .location-dropdown-wrapper {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* 카테고리 필터: 좌우 패딩 제거 */
  .category-filter-scroll {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
}

/* Desktop: 4열 그리드 */
@media (min-width: 769px) {
  .product-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ============================================
   스토어/상세 페이지 웹 반응형
   ============================================ */

/* 스토어 탭 sticky: 웹에서 top 보정 (앱 헤더 없음) */
@media (min-width: 481px) {
  .sticky-below-header {
    top: 0 !important;
  }
}

/* 상세 페이지 기본: 1컬럼 (Mobile + Tablet) */
.product-detail-top {
  display: block;
}

/* 관련 상품 그리드: 카드 너비 균등 + 오버플로우 방지 */
.product-related-grid > a {
  min-width: 0;
  overflow: hidden;
}

/* Desktop (769px+): 2컬럼 + 관련 상품 4열 */
@media (min-width: 769px) {
  .product-detail-top {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: start;
    margin-bottom: 16px;
  }

  .product-detail-image {
    border-radius: 12px;
    overflow: hidden;
  }

  /* 상품 정보: border-bottom 제거 (2컬럼에서 불필요) */
  .product-detail-info > div {
    border-bottom: none !important;
  }

  /* 판매자 정보: 좌측 컬럼 안 border 조정 */
  .product-detail-left > div:last-child {
    border-bottom: none !important;
  }

  /* 웹 CTA 버튼 영역 */
  .product-web-cta {
    padding-top: 8px;
  }

  .product-related-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

/* ============================================
   앱 다운로드 CTA 섹션
   ============================================ */
.app-download-cta {
  background: linear-gradient(135deg, #C6613F 0%, #D97757 50%, #E8956E 100%);
  margin-top: 32px;
}

.app-download-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  color: white;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
}

a.app-download-cta-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ============================================
   웹 배너 반응형
   ============================================ */

/* 화살표 버튼 기본 숨김 */
.banner-arrow {
  display: none;
}

/* 웹 전용 (모바일 웹 포함): 앱 배너 fixed → relative + 앱 전용 UI 제거 */
body:not(.turbo-native) .banner-container {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  transform: none !important;
  max-width: 100% !important;
  height: auto !important;
}

body:not(.turbo-native) .scrollable-content {
  margin-top: 0 !important;
  padding-top: 0 !important;
  border-radius: 0 !important;
  min-height: auto !important;
}

body:not(.turbo-native) .pull-refresh-backdrop {
  display: none !important;
}

/* Tablet (481px+): 배너 다중 슬라이드 + 인디케이터 숨김 */
@media (min-width: 481px) {
  .banner-slide { aspect-ratio: 1 / 1; }
  .banner-slide-inner { height: 100%; position: relative; }
  .banner-track { gap: 16px; }
  .banner-indicators { display: none !important; }
}

/* Desktop (769px+): 좌우 화살표 표시 */
@media (min-width: 769px) {
  .banner-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    border: none;
    color: rgba(0, 0, 0, 0.4);
    cursor: pointer;
    z-index: 15;
    transition: background 0.2s, color 0.2s;
  }

  .banner-arrow:hover {
    background: rgba(255, 255, 255, 0.65);
    color: rgba(0, 0, 0, 0.6);
  }

  .banner-arrow-prev { left: 8px; }
  .banner-arrow-next { right: 8px; }
}
