/**
 * gifts.css - 기프트 목록 관련 스타일
 * 
 * 섹션 구성:
 * 1. 기프트 그리드
 * 2. 기프트 카드
 * 3. 등급 뱃지
 * 4. 이미지 컨테이너
 * 5. 합성 아이콘
 * 6. 기프트 정보
 * 7. 팩 카드 (팩거래)
 * 8. 기프트 선택 그리드
 * 9. 필터 UI
 */

/* ============================================
   1. 기프트 그리드
   ============================================ */
.gifts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 2rem;
  padding: 1.875rem 1.25rem;
  background: rgba(42, 36, 25, 0.3);
  border-radius: 0.75rem;
  min-width: 60rem;
}

/* ============================================
   2. 기프트 카드
   ============================================ */
.gift-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  padding: 0.75rem;
  background: rgba(42, 36, 25, 0.5);
  border-radius: 0.75rem;
  border: 2px solid rgba(212, 175, 55, 0.2);
  box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(212, 175, 55, 0.1);
}

.gift-card:hover {
  transform: translateY(-0.5rem) scale(1.05);
  border-color: #ffae00;
  box-shadow: 
    0 0 0.9375rem rgba(255, 174, 0, 0.6),
    inset 0 0 0.625rem rgba(255, 174, 0, 0.2);
  z-index: 10;
}

.gift-card:hover .gift-image-container {
  filter: brightness(1.15) drop-shadow(0 0 0.3125rem rgba(255, 174, 0, 0.5));
}

.gift-tier-badge {
  position: absolute;
  top: -0.5rem;
  left: 0.5rem;
  font-family: 'Noto Sans KR', sans-serif;
  font-weight: 900;
  font-size: 2.375rem;
  color: #ffae00;
  z-index: 2;
  text-shadow: 0 0 0.3125rem rgba(255, 174, 0, 0.5), 2px 2px 0px rgba(0, 0, 0, 0.8);
  letter-spacing: -1px;
  /* Reset previous badge styles */
  width: auto;
  height: auto;
  border-radius: 0;
  background: none;
  border: none;
  box-shadow: none;
}

.gift-tier-badge.tier-1,
.gift-tier-badge.tier-2,
.gift-tier-badge.tier-3,
.gift-tier-badge.tier-4,
.gift-tier-badge.tier-5 {
  background: none;
  color: #ffae00;
  text-shadow: 0 0 0.3125rem rgba(255, 174, 0, 0.5), 2px 2px 0px rgba(0, 0, 0, 0.8);
}

.gift-tier-badge.tier-EX {
  background: none;
  color: #ccff00;
  text-shadow: 0 0 0.3125rem rgba(204, 255, 0, 0.5), 2px 2px 0px rgba(0, 0, 0, 0.8);
}

/* 테두리 이미지를 사용하는 이미지 컨테이너 */
.gift-image-container {
  width: 8.75rem;
  height: 8.75rem;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.3s ease;
}

.gift-image-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../기타/에고기프트_테두리.webp');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
  z-index: 0;
}

/* 합성 아이콘(우측 하단) */
.gift-attribute-icon {
  position: absolute;
  bottom: 0.25rem;
  right: 0.25rem;
  width: 2.25rem;
  height: 2.25rem;
  z-index: 2;
  pointer-events: none;
}

.gift-attribute-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}

.gift-image-placeholder {
  width: 5.625rem;
  height: 5.625rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: transparent;
  position: relative;
  z-index: 1;
}

.gift-image-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gift-image-placeholder i {
  font-size: 3em;
  color: rgba(102, 126, 234, 0.3);
}

.gift-info {
  padding: 0.625rem 0.3125rem 0;
  text-align: center;
  width: 100%;
}

.gift-name {
  margin: 0 0 0.5rem 0;
  font-size: 0.95em;
  font-weight: 600;
  color: #f5e6d3;
  line-height: 1.3;
  min-height: 2.6em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: keep-all;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.gift-effect {
  display: none; /* 효과 설명 숨김 */
}

.gift-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  justify-content: center;
  margin-top: 0.375rem;
}

.gift-keywords {
  display: none;
}

.gift-tags .tag,
.gift-keywords .keyword {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  background: linear-gradient(135deg, rgba(139, 111, 71, 0.9) 0%, rgba(90, 74, 53, 0.9) 100%);
  color: #f5e6d3;
  border-radius: 0.75rem;
  font-size: 0.75em;
  font-weight: 600;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.4), inset 0 0.0625rem 0 rgba(212, 175, 55, 0.2);
  border: 0.0625rem solid rgba(212, 175, 55, 0.3);
  white-space: nowrap;
  text-shadow: 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.5);
}

/* Packs List */
.packs-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(21.875rem, 1fr));
  gap: 1.25rem;
  padding: 0.625rem 0;
}

.pack-card {
  background: #fff;
  border: 0.0625rem solid #e0e0e0;
  border-radius: 0.625rem;
  padding: 1.25rem;
  transition: all 0.2s;
}

.pack-card:hover {
  box-shadow: var(--card-shadow);
  border-color: var(--primary-color);
}

.pack-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.9375rem;
  padding-bottom: 0.625rem;
  border-bottom: 0.125rem solid #f0f0f0;
}

.pack-name {
  margin: 0;
  font-size: 1.2em;
  color: #333;
}

.pack-count {
  font-size: 0.9em;
  color: #666;
  background: #f0f0f0;
  padding: 0.25rem 0.75rem;
  border-radius: 0.75rem;
}

.pack-gifts {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pack-gift-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem;
  background: #f9f9f9;
  border-radius: 0.375rem;
  transition: background 0.2s;
  cursor: pointer;
}

.pack-gift-item:hover {
  background: #e9f2ff;
}

.gift-tier-icon {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.6875rem;
  color: #fff;
  flex-shrink: 0;
}

.gift-tier-icon.tier-1 {
  background: var(--tier-1-color);
}

.gift-tier-icon.tier-2 {
  background: var(--tier-2-color);
}

.gift-tier-icon.tier-3 {
  background: var(--tier-3-color);
}

.gift-tier-icon.tier-4 {
  background: var(--tier-4-color);
}

.gift-tier-icon.tier-EX {
  background: var(--tier-EX-color);
  color: #000; /* Bright background needs dark text */
}

.gift-name-small {
  font-size: 0.95em;
  color: #333;
  flex: 1;
}

/* Gift Select Grid (for modal) */
.gift-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.25rem, 1fr));
  gap: 0.625rem;
  height: 60vh;
  overflow-y: auto;
  padding: 0.625rem;
  margin: 0.9375rem 0;
  align-content: start;
  min-width: 40rem;
}

.gift-select-item {
  aspect-ratio: 1;
  background: #f5f5f5;
  border: 0.125rem solid #e0e0e0;
  border-radius: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0.5rem;
  text-align: center;
}

.gift-select-item:hover {
  border-color: var(--primary-color);
  background: #e9f2ff;
}

.gift-select-item.selected {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: #fff;
}

.gift-select-item .tier-badge {
  font-size: 0.7em;
  margin-bottom: 0.25rem;
}

.gift-select-item .name {
  font-size: 0.8em;
  line-height: 1.2;
  word-break: keep-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 100%;
  height: 3em;
  min-height: 3em;
}

/* Content Header Layout */
.content-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
  flex-wrap: nowrap;
  min-width: 60rem;
}

.search-bar {
  flex: 0 0 15rem;
  position: relative;
  flex-shrink: 0;
}

.search-bar i {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: #888;
  font-size: 1rem;
}

.search-bar input {
  width: 100%;
  padding: 0.75rem 0.75rem 0.75rem 2.5rem;
  border: 0.0625rem solid rgba(212, 175, 55, 0.3);
  border-radius: 0.375rem;
  background: rgba(0, 0, 0, 0.3);
  color: #e0e0e0;
  font-size: 1rem;
}

.search-bar input:focus {
  outline: none;
  border-color: #d4af37;
  box-shadow: 0 0 0 0.125rem rgba(212, 175, 55, 0.2);
}

/* Quick Filter Bar */
.quick-filter-bar {
  display: flex;
  gap: 0.375rem;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.quick-filter-btn {
  padding: 0.375rem 0.75rem;
  color: #fff;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
  font-size: 0.85em;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.2);
  min-height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  white-space: nowrap;
}

.quick-filter-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  filter: brightness(1.1);
}

/* 키워드별 색상 (기본 상태) */
.quick-filter-btn[data-keyword="화상"] { background: #8a0000; }
.quick-filter-btn[data-keyword="출혈"] { background: #a35200; }
.quick-filter-btn[data-keyword="진동"] { background: #b08900; }
.quick-filter-btn[data-keyword="파열"] { background: #438900; }
.quick-filter-btn[data-keyword="침잠"] { background: #008a8a; }
.quick-filter-btn[data-keyword="호흡"] { background: #15345c; }
.quick-filter-btn[data-keyword="충전"] { background: #523461; }
.quick-filter-btn[data-keyword="참격"] { background: #363636; }
.quick-filter-btn[data-keyword="관통"] { background: #363636; }
.quick-filter-btn[data-keyword="타격"] { background: #363636; }
.quick-filter-btn[data-keyword="범용"] { background: #363636; }

.quick-filter-btn.active {
  filter: brightness(1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 0 0 3px rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.quick-filter-btn[data-keyword="화상"].active { background: #b20000; }
.quick-filter-btn[data-keyword="출혈"].active { background: #d56b00; }
.quick-filter-btn[data-keyword="진동"].active { background: #e2b500; }
.quick-filter-btn[data-keyword="파열"].active { background: #59b200; }
.quick-filter-btn[data-keyword="침잠"].active { background: #00b2b2; }
.quick-filter-btn[data-keyword="호흡"].active { background: #1d4678; }
.quick-filter-btn[data-keyword="충전"].active { background: #6c4581; }
.quick-filter-btn[data-keyword="참격"].active { background: #4a4a4a; }
.quick-filter-btn[data-keyword="관통"].active { background: #4a4a4a; }
.quick-filter-btn[data-keyword="타격"].active { background: #4a4a4a; }
.quick-filter-btn[data-keyword="범용"].active { background: #4a4a4a; }

/* Filter Controls */
.filter-controls {
  display: flex;
  gap: 0.625rem;
  margin-left: auto;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

/* Tier Quick Filters */
.tier-quick-filters {
  display: flex;
  gap: 0.375rem;
  margin-right: 0.625rem;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.tier-quick-btn {
  padding: 0.375rem 0.625rem;
  background: rgba(255, 174, 0, 0.2);
  color: #ffae00;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 700;
  font-size: 0.9em;
  font-family: 'Noto Sans KR', sans-serif;
  text-shadow: 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.5);
  min-height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.375rem;
  flex-shrink: 0;
  white-space: nowrap;
}

.tier-quick-btn:hover {
  background: rgba(255, 174, 0, 0.3);
  transform: translateY(-2px);
}

.tier-quick-btn.active {
  background: #ffae00;
  color: #1a1410;
  box-shadow: 0 2px 8px rgba(255, 174, 0, 0.4);
  text-shadow: none;
}

/* Mode Quick Filters */
.mode-quick-filters {
  display: flex;
  gap: 0.375rem;
  margin-right: 0.625rem;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.mode-quick-btn {
  padding: 0.375rem 0.625rem;
  background: rgba(0, 0, 0, 0.3);
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 700;
  font-size: 0.9em;
  font-family: 'Noto Sans KR', sans-serif;
  text-shadow: 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.5);
  min-height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 3.75rem;
  flex-shrink: 0;
  white-space: nowrap;
}

.mode-quick-btn:hover {
  transform: translateY(-2px);
}

/* Normal Mode Button - 연두색 */
.mode-quick-btn[data-mode="normal"] {
  color: #aaffaa;
  border: 1px solid rgba(170, 255, 170, 0.3);
}

.mode-quick-btn[data-mode="normal"]:hover {
  background: rgba(170, 255, 170, 0.2);
  box-shadow: 0 0 8px rgba(170, 255, 170, 0.3);
}

.mode-quick-btn[data-mode="normal"].active {
  background: #90ee90;
  color: #1a1410;
  border-color: #90ee90;
  box-shadow: 0 0 12px rgba(144, 238, 144, 0.6);
  text-shadow: none;
}

/* Hard Mode Button - 연홍색 */
.mode-quick-btn[data-mode="hard"] {
  color: #ff9999;
  border: 1px solid rgba(255, 153, 153, 0.3);
}

.mode-quick-btn[data-mode="hard"]:hover {
  background: rgba(255, 153, 153, 0.2);
  box-shadow: 0 0 8px rgba(255, 153, 153, 0.3);
}

.mode-quick-btn[data-mode="hard"].active {
  background: #ff6347;
  color: #1a1410;
  border-color: #ff6347;
  box-shadow: 0 0 12px rgba(255, 99, 71, 0.6);
  text-shadow: none;
}

/* Extreme Mode Button - 진홍색 */
.mode-quick-btn[data-mode="extreme"] {
  border: 1px solid rgba(220, 20, 60, 0.5);
  color: #ff6b6b;
}

.mode-quick-btn[data-mode="extreme"]:hover {
  background: rgba(220, 20, 60, 0.2);
  border-color: #dc143c;
  color: #ff4d4d;
  box-shadow: 0 0 8px rgba(220, 20, 60, 0.3);
}

.mode-quick-btn[data-mode="extreme"].active {
  background: #dc143c;
  color: white;
  border-color: #dc143c;
  box-shadow: 0 0 10px rgba(220, 20, 60, 0.4);
  text-shadow: none;
}

.filter-btn {
  padding: 0.375rem 0.875rem;
  background: #d4af37;
  border: 1px solid #ffd700;
  border-radius: 0.375rem;
  color: #1a1410;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  min-height: 2.25rem;
  font-size: 0.9em;
  gap: 0.5rem;
  transition: all 0.2s;
  box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.3);
  flex-shrink: 0;
  white-space: nowrap;
}

.filter-btn:hover {
  background: #f0c040;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(212, 175, 55, 0.4);
}

/* Synthesis Styles */
.synthesis-formula {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 0.9375rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 0.5rem;
}

.synthesis-step {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9375rem;
  flex-wrap: wrap;
}

.synthesis-items {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.synthesis-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3125rem;
  cursor: pointer;
  transition: transform 0.2s;
  width: 5rem;
}

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

.synthesis-item-image {
  width: 3.75rem;
  height: 3.75rem;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.synthesis-item-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  z-index: 1;
}

.synthesis-item-image::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../기타/에고기프트_테두리.webp');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  z-index: 0;
}

.synthesis-item-name {
  font-size: 0.8rem;
  text-align: center;
  color: #d4af37;
  word-break: keep-all;
  line-height: 1.2;
}

.synthesis-operator, .synthesis-arrow {
  font-size: 1.5rem;
  color: #aaa;
  font-weight: bold;
}

.synthesis-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3125rem;
  width: 5rem;
}

/* Special Layout for Moon's Memory */
.synthesis-special-group {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.synthesis-selection-container {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.625rem;
  border-radius: 0.5rem;
  border: 0.0625rem dashed #666;
}

.synthesis-selection-list {
  display: flex;
  flex-direction: column;
  gap: 0.3125rem;
}

.synthesis-selection-text {
  font-size: 0.9rem;
  color: #aaa;
  white-space: nowrap;
  font-weight: bold;
}

/* Fragments Layout (Moon's Memory) */
.fragments-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3125rem;
}

.fragments-row {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  position: relative;
  width: 100%;
}

.fragment-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  transition: transform 0.2s;
  width: 3.75rem;
}

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

.fragment-image {
  width: 2.5rem;
  height: 2.5rem;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fragment-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  z-index: 1;
}

.fragment-image::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../기타/에고기프트_테두리.webp');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  z-index: 0;
}

.fragment-name {
  font-size: 0.7rem;
  color: #d4af37;
  text-align: center;
  word-break: keep-all;
  line-height: 1.1;
}

.fragments-text-side {
  font-size: 0.9rem;
  color: #aaa;
  font-weight: bold;
  white-space: nowrap;
  position: absolute;
  left: calc(50% + 110px); /* 중앙에서 조각 너비(98px) + 여백 */
  top: 50%;
  transform: translateY(-50%);
}

.pack-link {
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: inline-block;
  padding: 0.125rem 0.3125rem;
  border-radius: 0.25rem;
}

.pack-link:hover {
  color: #ffae00;
  background-color: rgba(255, 174, 0, 0.1);
  text-decoration: underline;
  transform: translateY(-1px);
}
