/* Import fonts */
@import url('https://fonts.googleapis.com/css2?family=Nanum+Gothic:wght@400;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* CSS 변수 시스템 */
:root {
  /* 기본 색상 시스템 */
  --primary-hue: 122;
  --primary-saturation: 39%;
  --primary-lightness: 49%;
  
  /* 메인 컬러 */
  --primary-color: hsl(var(--primary-hue), var(--primary-saturation), var(--primary-lightness));
  --primary-hover: hsl(var(--primary-hue), var(--primary-saturation), calc(var(--primary-lightness) - 5%));
  
  /* 배경 그라데이션 색상 */
  --background-start: hsl(14, 83%, 63%);
  --background-mid1: hsl(334, 76%, 57%);
  --background-mid2: hsl(197, 72%, 49%);
  --background-end: hsl(265, 100%, 50%);
  
  /* 테마 색상 */
  --text-primary: rgba(255, 255, 255, 0.95);
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-tertiary: rgba(255, 255, 255, 0.5);
  
  --surface-primary: rgba(0, 0, 0, 0.8);
  --surface-secondary: rgba(255, 255, 255, 0.1);
  --surface-tertiary: rgba(255, 255, 255, 0.05);
  
  /* 그림자 효과 */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.3);
  
  /* 타이포그래피 */
  --font-family-primary: 'Poppins', 'Nanum Gothic', sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-md: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  
  /* 레이아웃 */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  
  /* 반응형 중단점 */
  --breakpoint-sm: 576px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 992px;
  --breakpoint-xl: 1200px;
  
  /* 애니메이션 */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;
  
  /* 테두리 */
  --border-radius-sm: 4px;
  --border-radius-md: 8px;
  --border-radius-lg: 16px;
  --border-radius-xl: 24px;
  
  /* 모바일 퍼스트 타이포그래피 */
  --font-size-base: 16px;
  --line-height-base: 1.5;
  --font-scale-ratio: 1.2;
  
  /* 모바일 기본 여백 */
  --container-padding: 1rem;
  --section-spacing: 2rem;
  --component-spacing: 1rem;
  
  /* 접근성 관련 변수 */
  --focus-ring-color: hsla(var(--primary-hue), 100%, 50%, 0.5);
  --focus-ring-width: 3px;
  --motion-reduce: 0.5;
  
  /* 컨트라스트 비율 개선을 위한 색상 */
  --text-high-contrast: rgba(255, 255, 255, 0.95);
  --text-medium-contrast: rgba(255, 255, 255, 0.8);
  --text-low-contrast: rgba(255, 255, 255, 0.6);
}

/* 라이트 모드 지원 */
@media (prefers-color-scheme: light) {
  :root {
    --text-primary: rgba(0, 0, 0, 0.95);
    --text-secondary: rgba(0, 0, 0, 0.7);
    --text-tertiary: rgba(0, 0, 0, 0.5);
    
    --surface-primary: rgba(255, 255, 255, 0.9);
    --surface-secondary: rgba(0, 0, 0, 0.1);
    --surface-tertiary: rgba(0, 0, 0, 0.05);
  }
}

/* Animation Keyframes */
@keyframes gradient {
  0% { background-position: 0% 50%; }
  25% { background-position: 50% 100%; }
  50% { background-position: 100% 50%; }
  75% { background-position: 50% 0%; }
  100% { background-position: 0% 50%; }
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0px); }
}

@keyframes glow {
  0% { box-shadow: 0 0 5px var(--primary-color); }
  50% { box-shadow: 0 0 20px var(--primary-color); }
  100% { box-shadow: 0 0 5px var(--primary-color); }
}

/* 애니메이션 키프레임 개선 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Body and Container */
body {
  font-family: 'Poppins', 'Nanum Gothic', sans-serif;
  background: linear-gradient(-145deg, 
    var(--background-start),
    var(--background-mid1),
    var(--background-mid2),
    var(--background-end));
  background-size: 600% 600%;
  animation: gradient 22s ease-in-out infinite;
  height: 100vh;
  margin: 0;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transform: none; /* Remove scaling */
  width: 100%; /* Adjust width */
  height: 100%; /* Adjust height */
  background-attachment: fixed; /* Fix background issue */
  font-size: var(--font-size-base);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
  -ms-touch-action: manipulation;
}

/* 기본 레이아웃 컴포넌트 */
.container {
  width: 100%;
  max-width: var(--breakpoint-xl);
  margin-inline: auto;
  padding: var(--container-padding);
  background-color: var(--surface-primary);
  /* 
  border-radius: var(--border-radius-lg); */
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  transition: transform var(--transition-normal);
}

/* 그리드 레이아웃 시스템 */
.grid {
  display: grid;
  gap: var(--component-spacing);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}

/* 플렉스 레이아웃 시스템 */
.flex {
  display: flex;
  gap: var(--component-spacing);
  flex-wrap: wrap;
}

.flex-col {
  flex-direction: column;
}

/* 버튼 컴포넌트 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--border-radius-md);
  background: linear-gradient(45deg, var(--primary-color), var(--primary-hover));
  color: var(--text-high-contrast);
  font-size: 1rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.3s ease;
}

@media (hover: hover) {
  .btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
  }
}

.btn:active {
  transform: translateY(0);
}

/* 폼 컴포넌트 */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: var(--component-spacing);
}

.form-label {
  color: var(--text-high-contrast);
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--surface-secondary);
  border-radius: var(--border-radius-md);
  background: var(--surface-tertiary);
  color: var(--text-high-contrast);
  font-size: 1rem;
  transition: all 0.3s ease;
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--focus-ring-color);
}

/* 카드 컴포넌트 */
.card {
  background: var(--surface-primary);
  border-radius: var(--border-radius-lg);
  padding: var(--component-spacing);
  box-shadow: var(--shadow-md);
  transition: transform 0.3s ease;
}

@media (hover: hover) {
  .card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
  }
}

/* 반응형 타이포그래피 */
@media (max-width: 768px) {
  :root {
    --font-size-xs: 0.7rem;
    --font-size-sm: 0.8rem;
    --font-size-md: 0.9rem;
    --font-size-lg: 1rem;
    --font-size-xl: 1.1rem;
  }
}

/* 접근성 개선 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.visually-hidden:not(:focus):not(:active) {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

/* 포커스 표시자 개선 */
:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: 2px;
}

/* Form Elements */
.form-group input[type="text"],
.form-group input[type="password"],
.form-group select {
  width: 100%;
  padding: 12px 15px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.form-group select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg fill='white' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 40px;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  background-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 15px rgba(76, 175, 80, 0.3);
}

.form-group select option {
  background-color: #2d2d2d;
  color: var(--text-primary);
  padding: 12px;
}

/* Buttons */
.button-group input[type="submit"],
.button-group input[type="button"],
.download-btn {
  background: linear-gradient(45deg, var(--primary-color), #2196f3);
  color: var(--text-primary);
  border: none;
  padding: 12px 40px;
  border-radius: 30px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
}

.button-group input:hover,
.download-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 7px 20px rgba(0, 0, 0, 0.3);
  animation: glow 1.5s ease-in-out infinite;
}

.sold-out-text {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 2em;
  background-color: rgba(0, 0, 0, 0.5);
  padding: 10px;
  border-radius: 5px;
  text-align: center;
}
.unit-price {
  font-size: 0.9em;
  color: #666;
  margin-left: 5px;
}
.product-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 10px;
}

.product-buttons button {
  background: linear-gradient(45deg, var(--primary-color), #2196f3);
  color: var(--text-primary);
  border: none;
  padding: 8px 15px;
  border-radius: 30px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
}

.product-buttons button:hover {
  transform: translateY(-3px);
  box-shadow: 0 7px 20px rgba(0, 0, 0, 0.3);
  animation: glow 1.5s ease-in-out infinite;
}

/* Product Items */
.product-item {
  border: none;
  border-radius: 15px;
  padding: 20px;
  margin: 10px;
  display: inline-block;
  width: calc(25% - 20px);
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.product-item:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.product-item img {
  width: 100%;
  border-radius: 10px;
  transition: transform 0.3s ease;
}

.product-item:hover img {
  transform: scale(1.05);
}

#reservationModal .modal-content {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: none;
  border-radius: 15px;
  color: var(--text-primary);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

#reservationModal h2 {
  color: var(--text-primary);
  font-size: 1.5em;
  margin-bottom: 20px;
  text-align: center;
}

#reservationForm .form-group {
  margin: 20px 0;
}

#reservationForm label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-primary);
  font-size: 1.1em;
}

#reservationForm input[type="number"] {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  font-size: 16px;
  transition: all 0.3s ease;
}

#reservationForm input[type="number"]:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 15px rgba(76, 175, 80, 0.3);
}

#reservationForm button {
  width: 100%;
  padding: 12px;
  background: linear-gradient(45deg, var(--primary-color), #2196f3);
  border: none;
  border-radius: 30px;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#reservationForm button:hover {
  transform: translateY(-3px);
  box-shadow: 0 7px 20px rgba(0, 0, 0, 0.3);
  animation: glow 1.5s ease-in-out infinite;
}

/* 숫자 입력 화살표 스타일링 */
#reservationForm input[type="number"]::-webkit-inner-spin-button,
#reservationForm input[type="number"]::-webkit-outer-spin-button {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  height: 2em;
  padding: 0 4px;
}
/* Coupang Product List Styles */
.coupang-product-card {
    border: none;
    border-radius: 15px;
    padding: 20px;
    margin: 10px;
    display: inline-block;
    width: calc(33.33% - 20px); /* 3개씩 표시하도록 수정 */
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    position: relative;
}

.coupang-product-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.coupang-product-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
    justify-content: center;
}

.coupang-product-buttons button {
    flex: 1;
    min-width: 100px;
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    background: linear-gradient(45deg, var(--primary-color), #2196f3);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.coupang-product-buttons button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.coupang-sold-out img {
    filter: brightness(50%);
}

.coupang-sold-out .sold-out-text {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 2em;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 5px;
    text-align: center;
}

/* 모달 관련 스타일 */
.modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.7);
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    background: var(--surface-primary);
    border-radius: var(--border-radius-lg);
    padding: var(--component-spacing);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.show .modal-content {
    transform: scale(1);
}

/* 상품 정보 모달 스타일 */
.product-info-content {
    padding: 20px;
    font-size: 14px;
    line-height: 1.6;
}

.product-info-content pre {
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    margin-top: 10px;
}

.product-info-content .json-key {
    color: #2196f3;
}

.product-info-content .json-string {
    color: #4caf50;
}

.product-info-content .json-number {
    color: #ff9800;
}

.product-info-content .json-boolean {
    color: #e91e63;
}

/* 폼 스타일 */
.add-product-form {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    z-index: 1000;
    max-width: 500px;
    width: 90%;
    opacity: 0;
    transition: all 0.3s ease;
    display: none;
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.add-product-form.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.form-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: none;
}

.form-overlay.show {
    opacity: 1;
}

/* 제품 그리드 스타일 */
.product-grid {
    display: grid;
    gap: 20px;
    padding: 20px;  
    justify-content: center;  /* 그리드 자체를 중앙 정렬 */
}

.product-grid .product-item {
    width: 100%;
    max-width: 500px;  /* 최대 너비 제한 */
    margin: 0 auto;    /* 좌우 마진 자동으로 중앙 정렬 */
}

/* 상품 정보 페이지에서만 적용되는 스타일 */
.product-info-page .product-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px); /* 헤더와 여백을 고려한 높이 */
}

.product-info-page .product-item {
    margin: 0;
    flex: 0 1 500px; /* flex-grow: 0, flex-shrink: 1, flex-basis: 500px */
}

/* 제품 상세 정보 박스 스타일 일관성 유지 */
.product-details-info {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
}

.product-details-info p {
    margin: 5px 0;
    color: var(--text-primary);
}

/* 할인가격 스타일 */
del {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9em;
}

.product-price {
    margin: 15px 0;
    line-height: 1.5;
}

/* Typography */
h1 {
  font-family: 'Poppins', 'Nanum Gothic', sans-serif;
  font-weight: 600;
  text-align: center;
  color: var(--text-primary);
  margin-bottom: 30px;
  font-size: calc(var(--font-size-base) * pow(var(--font-scale-ratio), 4));
  text-transform: uppercase;
  letter-spacing: 2px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Utilities */
.disabled {
  opacity: 0;
  pointer-events: none;
}

iframe {
  display: block;       /* iframes are inline by default */
  background: #000;
  border: none;         /* Reset default border */
  width: 100%;
  height: 100%;
  transform: none; /* Remove scaling */
}

/* 예약 구매 모달 스타일 개선 */
#reservationModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999; /* z-index 증가 */
}

#reservationModal .modal-content {
    position: relative;
    background: var(--surface-primary);
    margin: 10% auto;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    z-index: 10000; /* z-index 증가 */
    opacity: 1;
    transform: none;
}

#reservationModal h2 {
    margin-bottom: 25px;
    color: var(--text-primary);
    font-size: 1.5em;
    text-align: center;
}

#reservationModal .form-group {
    margin: 20px 0;
}

#reservationModal input[type="number"] {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
}

#reservationModal button {
    width: 100%;
    padding: 12px;
    margin-top: 20px;
    background: linear-gradient(45deg, var(--primary-color), #2196f3);
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#reservationModal button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

#reservationModal .close {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-primary);
}

/* 선물 구매 모달 스타일 개선 */
#giftModal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    overflow: auto;
}

#giftModal .modal-content {
    background: rgba(0, 0, 0, 0.8);
    margin: 15% auto;
    padding: 20px;
    width: 80%;
    max-width: 500px;
    position: relative;
    border-radius: 10px;
    color: #fff;
    backdrop-filter: blur(10px);
    transform: scale(1); /* 수정: 초기 스케일을 1로 설정 */
    opacity: 1; /* 수정: 초기 투명도를 1로 설정 */
}

#giftModal h2 {
    color: #fff;
    margin-bottom: 20px;
    font-size: 1.5em;
}

#giftModal #productInfo {
    margin-bottom: 20px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
}

#giftModal .form-group {
    margin: 15px 0;
}

#giftModal label {
    display: block;
    margin-bottom: 8px;
    color: #fff;
}

#giftModal input[type="number"] {
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 16px;
}

#giftModal button {
    width: 100%;
    padding: 10px;
    background: linear-gradient(45deg, var(--primary-color), #2196f3);
    border: none;
    border-radius: 5px;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#giftModal button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

#giftModal .close {
    position: absolute;
    right: 15px;
    top: 10px;
    color: #fff;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

#giftModal .close:hover {
    color: #ddd;
}

/* Media Queries */
@media (max-width: 1024px) {
    .coupang-product-card {
        width: calc(50% - 20px); /* 태블릿에서는 2개씩 */
    }
}

@media (max-width: 768px) {
  .product-item {
    width: calc(50% - 20px);
  }

  .coupang-product-card {
    width: calc(100% - 20px); /* 모바일에서는 1개씩 */
  }
}

@media (max-width: 480px) {
  .product-item {
    width: calc(100% - 20px);
  }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-hover);
}

/* ...existing code... */

#priceGraphModal .modal-content {
    width: 90%;
    max-width: 800px;
    height: 80vh;
    max-height: 600px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

#priceGraph {
    flex: 1;
    width: 100%;
    height: 100%;
}

/* ...existing code... */

/* 영양성분 계산기 스타일 */
.recipe-builder {
    display: flex;
    gap: 30px;
    margin-top: 20px;
}

.food-selector {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    padding: 20px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    min-width: 400px;
}

.recipe-summary {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    padding: 20px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    min-width: 400px;
}

.food-list {
    max-height: 500px;
    overflow-y: auto;
    padding-right: 10px;
    position: relative;
}

.food-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 12px 15px;
    margin: 5px 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.food-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.food-name {
    color: var(--text-primary);
    font-size: 0.95em;
    display: block;
}

.food-category {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8em;
    display: block;
    margin-top: 4px;
}

.loading-indicator {
    display: none;
    text-align: center;
    padding: 10px;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    margin: 10px 0;
}

.nutrient-category {
    background: rgba(22, 22, 30, 0.98);  /* 약간 더 어둡게 조정 */
    padding: 25px;
    margin: 20px 0;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.nutrient-category h4 {
    color: #fff;
    margin-bottom: 20px;
    font-size: 1.2em;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nutrient-row {
    position: relative;
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nutrient-row:hover {
    background: rgba(25, 25, 35, 0.95);  /* 호버시 약간 밝아지는 효과 */
    transform: translateX(3px);
}

.nutrient-name {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95em;
    font-weight: 400;
    flex: 1;
    padding-right: 20px;
}

.nutrient-value {
    color: #81c784;
    font-weight: 500;
    font-size: 0.95em;
    min-width: 80px;
    text-align: right;
}

/* 카테고리별 구분을 위한 스타일 */
.nutrient-category[data-category="기본 정보"] {
    background: rgba(28, 28, 35, 0.95);
}

.nutrient-category[data-category="탄수화물 상세"] {
    background: rgba(30, 30, 40, 0.95);
}

.nutrient-category[data-category="지방산"] {
    background: rgba(32, 32, 45, 0.95);
}

.nutrient-category[data-category="비타민"] {
    background: rgba(34, 34, 50, 0.95);
}

.nutrient-category[data-category="미네랄"] {
    background: rgba(36, 36, 55, 0.95);
}

.nutrient-category[data-category="아미노산"] {
    background: rgba(38, 38, 60, 0.95);
}

/* 스크롤바 스타일링 */
.nutrient-list::-webkit-scrollbar {
    width: 6px;
}

.nutrient-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.nutrient-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.nutrient-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}


@media (max-width: 768px) {
    .recipe-builder {
        flex-direction: column;
    }

    .food-selector, 
    .recipe-summary {
        width: 100%;
        min-width: unset;
    }
}

.macro-ratio {
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
}

.ratio-bar {
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    margin-bottom: 10px;
}

.carbs-bar {
    background: #4CAF50;
    height: 100%;
    transition: width 0.3s ease;
}

.protein-bar {
    background: #2196F3;
    height: 100%;
    transition: width 0.3s ease;
}

.fat-bar {
    background: #FFC107;
    height: 100%;
    transition: width 0.3s ease;
}

.ratio-legend {
    display: flex;
    justify-content: space-between;
    font-size: 0.9em;
    color: var(--text-primary);
}

.ratio-legend span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.ratio-legend span::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.ratio-legend .carbs::before {
    background: #4CAF50;
}

.ratio-legend .protein::before {
    background: #2196F3;
}

.ratio-legend .fat::before {
    background: #FFC107;
}

.omega-section {
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
}

.omega3-bar {
    background: #00BCD4;
    height: 100%;
    transition: width 0.3s ease;
}

.omega6-bar {
    background: #FF9800;
    height: 100%;
    transition: width 0.3s ease;
}

.omega9-bar {
    background: #9C27B0;
    height: 100%;
    transition: width 0.3s ease;
}

.ratio-legend .omega3::before {
    background: #00BCD4;
}

.ratio-legend .omega6::before {
    background: #FF9800;
}

.ratio-legend .omega9::before {
    background: #9C27B0;
}

/* 검색 컨트롤 컨테이너 */
.search-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

/* Select 기본 스타일 */
#categorySelect {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(28, 28, 35, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px 12px;
  width: 100%;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

/* Select 화살표 커스텀 */
#categorySelect {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
}

/* 옵션 스타일링 */
#categorySelect option {
  background-color: #1c1c23 !important;
  color: rgba(255, 255, 255, 0.9) !important;
  padding: 8px 12px;
}

/* Firefox 특정 스타일 */
@-moz-document url-prefix() {
  #categorySelect {
      background-color: #1c1c23;
  }
  
  #categorySelect option {
      background-color: #1c1c23;
  }
}

/* Webkit 브라우저 특정 스타일 */
@media screen and (-webkit-min-device-pixel-ratio:0) {
  #categorySelect {
      background-color: #1c1c23;
  }
  
  #categorySelect option {
      background-color: #1c1c23 !important;
  }
}

/* Select 포커스 시 스타일 */
#categorySelect:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.2);
}

/* IE/Edge 특정 스타일 */
select::-ms-expand {
  display: none;
}

select:focus::-ms-value {
  background-color: #1c1c23;
  color: rgba(255, 255, 255, 0.9);
}

/* 검색 입력창 */
#searchInput {
    flex: 2;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
}

#searchInput:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.2);
    background-color: rgba(255, 255, 255, 0.08);
}

#searchInput::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* 모두 지우기 버튼 */
#clearAll {
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    transition: all 0.2s ease;
}

#clearAll:hover {
    background: rgba(255, 255, 255, 0.15);
}

#clearAll:active {
    transform: scale(0.98);
}

/* 검색 결과 컨테이너 스타일 유지 */
#searchResults {
    margin-top: 10px;
    max-height: 300px;
    overflow-y: auto;
    background: rgba(28, 28, 35, 0.95);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.search-result-item {
    padding: 12px 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.search-result-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .search-controls {
        flex-direction: column;
    }
    
    #categorySelect,
    #searchInput,
    #clearAll {
        width: 100%;
    }
}

/* 수량 입력 스타일링 */
.amount-input {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 4px 8px;
}

.amount-input input {
    width: 50px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    text-align: right;
    padding: 4px;
}

.amount-input input:focus {
    outline: none;
}

.amount-input input::-webkit-inner-spin-button,
.amount-input input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.amount-input span {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    white-space: nowrap;
}

/* 수량 조절 버튼 */
.amount-controls {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.amount-control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 12px;
    line-height: 1;
    transition: background 0.2s ease;
}

.amount-control-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.amount-control-btn:active {
    transform: scale(0.95);
}

/* 검색 결과 텍스트 색상 */
.search-result-item {
    color: rgba(255, 255, 255, 0.9);
}

/* 선택된 음식 아이템 텍스트 색상 */
.selected-food-item {
    color: rgba(255, 255, 255, 0.9);
}

.selected-food-item input {
    color: rgba(255, 255, 255, 0.9);
}

/* 버튼 텍스트 색상 */
#clearAll {
    color: rgba(255, 255, 255, 0.9);
}

.remove-food {
    color: rgba(255, 255, 255, 0.9);
}
/* 영양소 행 툴팁 스타일 */
.nutrient-row {
    position: relative;
}

.nutrient-tooltip {
    display: none;
    position: fixed; /* absolute 대신 fixed 사용 */
    background: rgba(28, 28, 35, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px;
    min-width: 250px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.nutrient-row:hover .nutrient-tooltip {
    display: block;
}

.food-nutrient-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.food-nutrient-item:last-child {
    border-bottom: none;
}

/* 삭제 버튼 스타일 */
.remove-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.remove-btn:hover {
    color: #ff4d4d;
    background: rgba(255, 77, 77, 0.1);
}

/* input 화살표 제거 */
.amount-input {
    -webkit-appearance: none;
    -moz-appearance: textfield;
    appearance: none;
    margin: 0;
}

.amount-input::-webkit-outer-spin-button,
.amount-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* input 스타일 */
.amount-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.9);
    padding: 4px 8px;
    width: 60px;
    text-align: right;
}

.amount-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
}


@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 모바일 최적화 */
@media (max-width: var(--breakpoint-sm)) {
  .container {
    padding: var(--spacing-md);
    margin: var(--spacing-sm);
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .flex {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    padding: var(--spacing-md);
  }
}

@media (max-width: var(--breakpoint-md)) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 터치 디바이스 최적화 */
@media (hover: none) {
  .btn:hover {
    transform: none;
    box-shadow: none;
  }

  .card:hover {
    transform: none;
    box-shadow: var(--shadow-md);
  }
}

/* 성능 최적화 */
.optimize-gpu {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* 로딩 상태 */
.loading {
  position: relative;
  overflow: hidden;
}

.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    var(--surface-secondary),
    transparent
  );
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* 스크롤바 최적화 */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color) var(--surface-secondary);
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: var(--surface-secondary);
  border-radius: var(--border-radius-sm);
}

*::-webkit-scrollbar-thumb {
  background-color: var(--primary-color);
  border-radius: var(--border-radius-sm);
  border: 2px solid var(--surface-secondary);
}

/* 모달 애니메이션 개선 */
.modal {
  animation: fadeIn var(--transition-normal);
}

.modal-content {
  animation: scaleIn var(--transition-normal);
}

/* 토스트 메시지 */
.toast {
  position: fixed;
  bottom: var(--spacing-lg);
  right: var(--spacing-lg);
  padding: var(--spacing-md);
  background: var(--surface-primary);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-lg);
  animation: slideIn var(--transition-normal);
  z-index: 1000;
}

/* 기본 타이포그래피 설정 */
html {
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
}

body {
  font-family: var(--font-family-primary);
  font-size: 1rem;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* 반응형 타이포그래피 스케일 */
h1 { font-size: calc(var(--font-size-base) * pow(var(--font-scale-ratio), 4)); }
h2 { font-size: calc(var(--font-size-base) * pow(var(--font-scale-ratio), 3)); }
h3 { font-size: calc(var(--font-size-base) * pow(var(--font-scale-ratio), 2)); }
h4 { font-size: calc(var(--font-size-base) * var(--font-scale-ratio)); }

/* 접근성 개선 */
.visually-hidden:not(:focus):not(:active) {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

/* 키보드 포커스 표시자 개선 */
:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: 2px;
}

/* 축소된 모션 설정 지원 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* 컨테이너 컴포넌트 개선 */
.container {
  width: 100%;
  max-width: var(--breakpoint-xl);
  margin-inline: auto;
  padding: var(--container-padding);
}

/* 그리드 시스템 개선 */
.grid {
  display: grid;
  gap: var(--component-spacing);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}

/* 플렉스 시스템 개선 */
.flex {
  display: flex;
  gap: var(--component-spacing);
  flex-wrap: wrap;
}

.flex-col {
  flex-direction: column;
}

/* 카드 컴포넌트 개선 */
.card {
  background: var(--surface-primary);
  border-radius: var(--border-radius-lg);
  padding: var(--component-spacing);
  box-shadow: var(--shadow-md);
  transition: transform 0.3s ease;
}

@media (hover: hover) {
  .card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
  }
}

/* 폼 컴포넌트 개선 */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: var(--component-spacing);
}

.form-label {
  color: var(--text-high-contrast);
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--surface-secondary);
  border-radius: var(--border-radius-md);
  background: var(--surface-tertiary);
  color: var(--text-high-contrast);
  font-size: 1rem;
  transition: all 0.3s ease;
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--focus-ring-color);
}

/* 버튼 컴포넌트 개선 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--border-radius-md);
  background: linear-gradient(45deg, var(--primary-color), var(--primary-hover));
  color: var(--text-high-contrast);
  font-size: 1rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.3s ease;
}

@media (hover: hover) {
  .btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
  }
}

.btn:active {
  transform: translateY(0);
}

/* 모달 컴포넌트 개선 */
.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.7);
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  width: 100%;
  max-width: 500px;
  background: var(--surface-primary);
  border-radius: var(--border-radius-lg);
  padding: var(--component-spacing);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modal.show .modal-content {
  transform: scale(1);
}

/* 로더 컴포넌트 */
.loader {
  width: 2rem;
  height: 2rem;
  border: 2px solid var(--surface-secondary);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 반응형 미디어 쿼리 */
@media (min-width: 576px) {
  :root {
    --container-padding: 1.5rem;
    --section-spacing: 3rem;
    --component-spacing: 1.5rem;
  }
}

@media (min-width: 768px) {
  :root {
    --container-padding: 2rem;
    --section-spacing: 4rem;
    --component-spacing: 2rem;
  }
}

@media (min-width: 992px) {
  :root {
    --container-padding: 2.5rem;
    --section-spacing: 5rem;
    --component-spacing: 2.5rem;
  }
}

/* 글래스모피즘 효과 */
.glass {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

.glass-dark {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* 고급 애니메이션 효과 */
.hover-float {
  transition: transform 0.3s ease;
}

.hover-float:hover {
  transform: translateY(-8px);
}

.hover-scale {
  transition: transform 0.3s ease;
}

.hover-scale:hover {
  transform: scale(1.05);
}

.hover-glow {
  transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 20px var(--primary-color);
}

/* 스켈레톤 로딩 효과 */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-secondary) 25%,
    var(--surface-tertiary) 50%,
    var(--surface-secondary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* 토스트 메시지 */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.toast {
  padding: 1rem;
  border-radius: var(--border-radius-md);
  background: var(--surface-primary);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease;
  max-width: 300px;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* 접근성 개선 */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary-color);
  color: white;
  padding: 8px;
  z-index: 100;
  transition: top 0.3s;
}

.skip-link:focus {
  top: 0;
}

/* ARIA 상태 표시 */
[aria-busy="true"] {
  cursor: progress;
}

[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.7;
}

/* 고대비 모드 */
@media (prefers-contrast: more) {
  :root {
    --primary-color: #0066cc;
    --text-primary: #000000;
    --text-secondary: #333333;
    --surface-primary: #ffffff;
    --surface-secondary: #cccccc;
  }
}

/* 반응형 타이포그래피 시스템 */
:root {
  --fluid-min-width: 320;
  --fluid-max-width: 1200;
  --fluid-min-size: 16;
  --fluid-max-size: 18;
  --fluid-min-ratio: 1.2;
  --fluid-max-ratio: 1.333;
}

@media screen and (min-width: 320px) {
  :root {
    --fluid-size: calc(
      var(--fluid-min-size) * 1px + (var(--fluid-max-size) - var(--fluid-min-size)) *
        (100vw - var(--fluid-min-width) * 1px) /
        (var(--fluid-max-width) - var(--fluid-min-width))
    );
  }
}

/* 터치 디바이스 최적화 */
@media (hover: none) {
  .hover-float,
  .hover-scale,
  .hover-glow {
    transform: none !important;
    box-shadow: none !important;
  }
  
  .btn,
  .card {
    transition: opacity 0.3s ease;
  }
  
  .btn:active,
  .card:active {
    opacity: 0.7;
  }
}

/* 스크롤 스냅 */
.scroll-snap-container {
  scroll-snap-type: y mandatory;
  overflow-y: scroll;
  height: 100vh;
}

.scroll-snap-item {
  scroll-snap-align: start;
  height: 100vh;
}

/* 커스텀 스크롤바 */
.custom-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color) var(--surface-secondary);
}

.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: var(--surface-secondary);
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background-color: var(--primary-color);
  border-radius: 3px;
}

/* 입력 필드 개선 */
.input-group {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.input-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-tertiary);
  pointer-events: none;
}

.input-with-icon {
  padding-left: 2.5rem;
}

/* 폼 유효성 검사 스타일 */
.form-control:invalid {
  border-color: #dc3545;
}

.form-control:valid {
  border-color: #28a745;
}

.validation-message {
  font-size: var(--font-size-sm);
  color: #dc3545;
  margin-top: 0.25rem;
}

/* 그리드 시스템 확장 */
.grid-auto-fit {
  grid-template-columns: repeat(auto-fit, minmax(var(--min-column-width, 250px), 1fr));
}

.grid-auto-fill {
  grid-template-columns: repeat(auto-fill, minmax(var(--min-column-width, 250px), 1fr));
}

/* 마스크 효과 */
.text-mask {
  background: linear-gradient(45deg, var(--primary-color), var(--primary-hover));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: hue-rotate 10s linear infinite;
}

@keyframes hue-rotate {
  from {
    filter: hue-rotate(0deg);
  }
  to {
    filter: hue-rotate(360deg);
  }
}

/* 성능 최적화 */
.optimize-gpu {
  will-change: transform;
  backface-visibility: hidden;
  transform: translateZ(0);
  perspective: 1000px;
}

/* 프린트 스타일 */
@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    background: none !important;
    color: #000 !important;
  }
  
  .container {
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
  }
}

/* 로딩 상태 애니메이션 */
.loading-dots::after {
  content: '...';
  animation: loading-dots 1.5s infinite;
  display: inline-block;
  width: 1em;
}

@keyframes loading-dots {
  0% { content: '.'; }
  33% { content: '..'; }
  66% { content: '...'; }
}

/* 이미지 최적화 */
.img-responsive {
  max-width: 100%;
  height: auto;
  display: block;
}

.img-lazy {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.img-lazy.loaded {
  opacity: 1;
}

/* 테이블 반응형 */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .table-stack {
    display: block;
  }
  
  .table-stack tr {
    display: block;
    margin-bottom: 1rem;
  }
  
  .table-stack td {
    display: block;
    text-align: right;
  }
  
  .table-stack td::before {
    content: attr(data-label);
    float: left;
    font-weight: bold;
  }
}

/* 드롭다운 메뉴 */
.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1000;
  display: none;
  min-width: 200px;
  padding: 0.5rem 0;
  background: var(--surface-primary);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-lg);
}

.dropdown.show .dropdown-menu {
  display: block;
  animation: dropdown-fade 0.2s ease;
}

@keyframes dropdown-fade {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 툴팁 */
.tooltip {
  position: relative;
}

.tooltip::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem;
  background: var(--surface-primary);
  color: var(--text-primary);
  border-radius: var(--border-radius-sm);
  font-size: var(--font-size-sm);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.tooltip:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-5px);
}

html, body {
    touch-action: manipulation;
    -ms-touch-action: manipulation;
}

.table, .table td, .table tr {
    -webkit-tap-highlight-color: transparent;
    tap-highlight-color: transparent;
}
    