/**
 * modals.css - 모달 관련 스타일
 * 
 * 섹션 구성:
 * 1. 모달 오버레이
 * 2. 모달 콘텐츠
 * 3. 모달 헤더/닫기 버튼
 * 4. 기프트 상세 모달
 * 5. 합성식 스타일
 * 6. 팩 선택 모달
 * 7. 기프팩 선택 모달
 * 8. 필터 모달
 * 9. 확인 모달
 */

/* ============================================
   1. 모달 오버레이
   ============================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

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

.modal-overlay.hidden-behind {
  visibility: hidden !important;
  opacity: 0 !important;
  transition: none !important;
  animation: none !important;
}

/* ============================================
   2. 모달 콘텐츠
   ============================================ */
#gift-detail-modal,
.gift-detail-modal {
  z-index: 1100; /* Ensure it's above pack detail modal */
}

#gift-detail-modal .modal-content,
.gift-detail-modal .modal-content {
  background-color: transparent;
  padding: 0;
  border-radius: 0.75rem;
  width: 56.25rem;
  max-width: 56.25rem;
  min-width: 56.25rem;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0.625rem 2.5rem rgba(0, 0, 0, 0.3);
  position: relative;
  animation: modalSlideIn 0.3s ease-out;
  overflow: hidden;
}

.modal-content {
  background-color: #fff;
  padding: 1.25rem;
  border-radius: 0.75rem;
  width: 56.25rem;
  max-width: 56.25rem;
  min-width: 56.25rem;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0.625rem 2.5rem rgba(0, 0, 0, 0.3);
  position: relative;
  animation: modalSlideIn 0.3s ease-out;
  overflow: hidden;
}

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

.modal-content h3 {
  margin: 0 0 0.9375rem 0; /* Consistent margin */
  padding-bottom: 0.9375rem; /* Consistent padding */
  border-bottom: 1px solid #eee; /* Consistent border */
}

/* Modal Close Button */
.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.2em;
  color: #666;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
  transition: all 0.2s;
  cursor: pointer;
  position: static; /* Reset absolute positioning */
}

.modal-close-btn:hover {
  background: #f0f0f0;
  color: #333;
  transform: none;
}

/* Modal Header Adjustment */
.modal-header {
  padding: 0.9375rem 1.25rem;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.2em;
  font-weight: 700;
}

/* Modal Search */
.modal-search {
  margin-bottom: 1.25rem;
}

.modal-search input {
  width: 100%;
  padding: 0.625rem 0.9375rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  box-sizing: border-box; /* Include padding in width */
}

.modal-search input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.1875rem rgba(0, 123, 255, 0.1);
}

/* Modal Actions */
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.625rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid #e0e0e0;
}

.modal-cancel-btn {
  background-color: var(--secondary-color);
  color: #fff;
  border: none;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  font-weight: 600;
  cursor: pointer;
}

.modal-confirm-btn {
  background-color: var(--primary-color);
  color: #fff;
  border: none;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  font-weight: 600;
  cursor: pointer;
}

.modal-cancel-btn:hover {
  background-color: #5a6268;
}

.modal-confirm-btn:hover {
  background-color: var(--primary-hover);
}

/* Gift Detail Modal Specific */
#gift-detail-content,
.gift-detail-content-dynamic {
  overflow-y: auto;
  padding: 0;
}

/* 상단 헤더 영역 */
.gift-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  margin-bottom: 0;
  padding: 1.25rem;
  background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
  border-bottom: 0.1875rem solid #8b0000;
  border-radius: 0.75rem 0.75rem 0 0;
}

.gift-detail-image {
  width: 11.25rem;
  height: 11.25rem;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  flex-shrink: 0;
}

.gift-detail-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;
  background-position: center;
  pointer-events: none;
  z-index: 0;
}

.gift-detail-image img {
  width: 7rem;
  height: 7rem;
  object-fit: contain;
  position: relative;
  z-index: 1;
}

.gift-detail-image i {
  color: rgba(255, 255, 255, 0.3);
  font-size: 3em;
}

.gift-detail-info {
  flex: 1;
  color: #fff;
}

.gift-detail-title-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.75rem;
}

.hard-only-badge {
  color: #ff3333;
  font-size: 0.6em;
  vertical-align: super;
  margin-left: 0.25rem;
  font-weight: bold;
}

.gift-detail-tier {
  display: inline-block;
  padding: 0;
  background: none;
  color: #ffae00;
  font-family: 'Noto Sans KR', sans-serif;
  font-weight: 900;
  font-size: 2.375rem;
  text-shadow: 0 0 0.3125rem rgba(255, 174, 0, 0.5), 0.125rem 0.125rem 0 rgba(0, 0, 0, 0.8);
  letter-spacing: -0.0625rem;
  border-radius: 0;
  margin-right: 0.5rem;
}

.gift-detail-tier.tier-EX {
  color: #ccff00;
  text-shadow: 0 0 0.3125rem rgba(204, 255, 0, 0.5), 0.125rem 0.125rem 0 rgba(0, 0, 0, 0.8);
}

.gift-detail-info h2 {
  margin: 0;
  font-size: 2em;
  color: #fff;
  flex: 1;
}

.gift-detail-keywords {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.625rem;
}

.gift-detail-keywords .keyword-icon {
  color: #ff6b6b;
  font-size: 1.3em;
  flex-shrink: 0;
}

.gift-detail-keywords .keyword-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.gift-detail-keywords .keyword-tag {
  padding: 0.375rem 0.875rem;
  background: rgba(255, 107, 107, 0.2);
  color: #ffcccc;
  border: 1px solid rgba(255, 107, 107, 0.4);
  border-radius: 0.25rem;
  font-size: 1em;
  font-weight: 500;
}

.gift-detail-price {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.gift-detail-price .price-icon {
  width: 1.5rem;
  height: 1.5rem;
  object-fit: contain;
}

.gift-detail-price .price-value {
  color: #ffd700;
  font-weight: 700;
  font-size: 1.3em;
}

/* 상세 정보 섹션 */
.gift-detail-body {
  padding: 1.25rem;
  background: #fff;
}

.gift-detail-section {
  margin-bottom: 1.25rem;
  padding: 0.9375rem;
  background: #f9f9f9;
  border-left: 0.25rem solid #8b0000;
  border-radius: 0.25rem;
}

.gift-detail-section:last-child {
  margin-bottom: 0;
}

.gift-detail-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.75rem 0;
  padding: 0.5rem 0.75rem;
  background: #8b0000;
  color: #fff;
  font-weight: 700;
  font-size: 1em;
  border-radius: 0.25rem;
}

.gift-detail-section-title i {
  font-size: 0.9em;
}

.gift-detail-section-content {
  padding: 0.5rem 0;
  line-height: 1.7;
  color: #333;
}

/* 합성식 스타일*/
.synthesis-formula {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem;
  background: #fff;
  border: 0.125rem solid #e0e0e0;
  border-radius: 0.375rem;
}

.synthesis-step {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem;
  background: #f5f5f5;
  border-radius: 0.25rem;
}

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

.synthesis-item {
  padding: 0.375rem 0.75rem;
  background: #fff;
  border: 0.125rem solid #ddd;
  border-radius: 0.25rem;
  font-weight: 600;
  color: #555;
  font-size: 0.9em;
}

.synthesis-operator {
  color: #999;
  font-weight: 700;
  font-size: 1.2em;
}

.synthesis-result {
  padding: 0.375rem 0.75rem;
  background: #8b0000;
  color: #fff;
  border-radius: 0.25rem;
  font-weight: 700;
  font-size: 0.9em;
}

.synthesis-arrow {
  color: #8b0000;
  font-size: 1.3em;
  font-weight: 700;
}

/* 확장 팩 리스트*/
.gift-detail-packs-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.gift-detail-packs-list li {
  display: block;
  width: fit-content;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.375rem;
  background: #fff;
  border: 1px solid #ddd;
  border-left: 0.25rem solid #8b0000;
  border-radius: 0.25rem;
  color: #333;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.gift-detail-packs-list li:hover {
  background-color: #fff3e0;
  border-color: #ff9800;
  border-left-color: #ff9800;
  transform: translateX(0.3125rem);
  box-shadow: 0 0.125rem 0.3125rem rgba(0,0,0,0.1);
}

.gift-detail-packs-list li:last-child {
  margin-bottom: 0;
}

/* 강화 효과 탭*/
.gift-effect-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.9375rem;
  border-bottom: 0.125rem solid #e0e0e0;
  padding-bottom: 0.625rem;
}

.effect-tab-btn {
  padding: 0.5rem 1rem;
  background: #f5f5f5;
  border: 0.125rem solid #ddd;
  border-radius: 0.375rem 0.375rem 0 0;
  color: #666;
  font-weight: 600;
  font-size: 0.95em;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: none;
}

.effect-tab-btn:hover {
  background: #e8e8e8;
  border-color: #ccc;
}

.effect-tab-btn.active {
  background: #8b0000;
  color: #fff;
  border-color: #8b0000;
  transform: translateY(0.125rem);
}

.gift-effect-content {
  position: relative;
  min-height: 3.75rem;
}

.effect-level-content {
  display: none;
  line-height: 1.8;
  color: #333;
}

.effect-level-content.active {
  display: block;
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-0.625rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 추가 키워드 스타일*/
.extra-keywords {
  display: flex;
  flex-direction: column;
}

.keyword-row {
  display: grid;
  grid-template-columns: 1fr 3fr;
  gap: 1.5rem;
  padding: 0.875rem 0;
  border-bottom: 1px solid #e0e0e0;
  align-items: center;
}

.keyword-row:last-child {
  border-bottom: none;
}

.keyword-name {
  font-weight: 700;
  color: #8b0000;
  font-size: 0.95em;
  padding-right: 1.5rem;
  border-right: 0.125rem solid #ddd;
  text-align: left;
  align-self: stretch;
  display: flex;
  align-items: center;
}

.keyword-description {
  line-height: 1.7;
  color: #333;
  font-size: 0.95em;
}

.gift-description-note {
  margin-top: 0.9375rem;
  padding-top: 0.9375rem;
  border-top: 1px dashed #ccc;
  color: #666;
  font-style: italic;
}

/* 선택 모달 패딩 */
#gift-select-modal .modal-content,
#synthesis-gift-modal .modal-content,
#order-gift-select-modal .modal-content {
  padding: 1.25rem;
  width: 70rem;
  max-width: 70rem;
  min-width: 70rem;
}

#gift-select-modal h3,
#synthesis-gift-modal h3,
#order-gift-select-modal h3 {
  margin-top: 0;
}

/* Keyword Filter Styles */
.large-modal {
  width: 62.5rem;
  max-width: 62.5rem;
  min-width: 62.5rem;
}

.small-modal {
  width: 25rem;
  max-width: 25rem;
  min-width: 25rem;
  padding: 1.25rem;
}

.modal-header {
  padding: 1.25rem;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
}

/* Modal Controls (Gift Select) */
.modal-controls {
  display: flex;
  flex-direction: column; /* Stack vertically */
  gap: 0.625rem;
  margin-bottom: 1.25rem;
}

.modal-controls .modal-search {
  margin-bottom: 0; /* Remove margin from search inside controls */
}

.pack-filter-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

#gift-select-pack-filter-btn {
  align-self: flex-start; /* Align button to the left */
  padding: 0.5rem 1rem;
  background-color: #8b7355; /* Match theme color */
  color: #fff;
  border: none;
  border-radius: 0.25rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

#gift-select-pack-filter-btn:hover {
  background-color: #a08565;
}

#gift-select-pack-filter-btn.active {
  background-color: var(--primary-color, #d4af37);
  color: #1a1612;
}

#gift-select-pack-filter-btn .pack-filter-text {
  max-width: 12.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#gift-select-pack-filter-clear {
  padding: 0.5rem 0.625rem;
  background-color: #dc3545;
  color: #fff;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

#gift-select-pack-filter-clear:hover {
  background-color: #c82333;
}

/* ============================================ */
/* Filter Modal (조건 설정) - DeckMaker Style */
/* ============================================ */
.filter-modal-content { 
  width: 56.25rem; 
  max-width: 56.25rem; 
  min-width: 56.25rem;
  max-height: 85vh; 
  display: flex; 
  flex-direction: column; 
  padding: 0;
  overflow: hidden;
}

.filter-modal-content .modal-header {
  margin: 0;
  padding: 1.25rem;
  border-bottom: 1px solid #eee;
  background: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.filter-modal-content .modal-header h3 {
  margin: 0;
  font-size: 1.2em;
  font-weight: 700;
  color: #333;
}

.filter-modal-scroll { 
  overflow-y: auto; 
  flex: 1; 
  padding: 1.25rem;
  background: #fafafa;
}

.filter-modal-scroll::-webkit-scrollbar { 
  width: 0.625rem; 
}

.filter-modal-scroll::-webkit-scrollbar-track { 
  background: #f0f0f0; 
  border-radius: 0.3125rem;
}

.filter-modal-scroll::-webkit-scrollbar-thumb { 
  background: #bbb; 
  border-radius: 0.3125rem;
  border: 0.125rem solid #f0f0f0;
}

.filter-modal-scroll::-webkit-scrollbar-thumb:hover {
  background: #999;
}

.filter-group-block { 
  border: 1px solid #e0e0e0; 
  border-radius: 0.5rem; 
  padding: 1rem 1.125rem; 
  background: #fff; 
  margin-bottom: 1rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.2s;
}

.filter-group-block:hover {
  box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.08);
}

.filter-group-block h4 { 
  margin: 0 0 0.75rem 0; 
  font-size: 1.1em; 
  display: flex; 
  align-items: center; 
  gap: 0.5rem; 
  color: #333;
  font-weight: 700;
  padding-bottom: 0.5rem;
  border-bottom: 0.125rem solid #f0f0f0;
}

.filter-chip-list { 
  display: flex; 
  flex-wrap: wrap; 
  gap: 0.5rem; 
}

.filter-chip { 
  position: relative; 
  display: inline-flex; 
  align-items: center; 
  gap: 0.3125rem; 
  background: #f8f9fa; 
  border: 0.09375rem solid #dee2e6; 
  border-radius: 1.25rem; 
  padding: 0.375rem 0.75rem; 
  font-size: 0.85em; 
  cursor: pointer; 
  user-select: none; 
  transition: all 0.2s ease; 
  line-height: 1.2;
  font-weight: 500;
  color: #333; /* 기본 글자색 */
  pointer-events: auto; /* 클릭 가능하도록 명시 */
  z-index: 1; /* 다른 요소 위에 표시 */
}

.filter-chip:hover {
  background: #e9ecef;
  border-color: #adb5bd;
  transform: translateY(-0.0625rem);
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
}

.filter-chip input { 
  display: none;
}

.filter-chip.active { 
  background: #8b0000; 
  border-color: #8b0000; 
  color: #fff; /* ?�택 ???�색 글??*/
  box-shadow: 0 0.125rem 0.375rem rgba(139, 0, 0, 0.3);
}

.filter-chip.active:hover {
  background: #6d0000;
  border-color: #6d0000;
  transform: translateY(-0.0625rem);
  box-shadow: 0 0.1875rem 0.5rem rgba(139, 0, 0, 0.4);
}

.filter-chip.active input { 
  filter: brightness(200%); 
}

.filter-chip span {
  color: inherit; /* 부모로부터 색상 상속 */
}

.filter-modal-actions { 
  display: flex; 
  justify-content: flex-end; 
  gap: 0.625rem;
  padding: 0.9375rem 1.25rem;
  border-top: 1px solid #eee;
  background: #fff;
}

.filter-modal-actions button { 
  background: #8b0000; 
  color: #fff; 
  border: none; 
  padding: 0.625rem 1.25rem; 
  border-radius: 0.5rem; 
  cursor: pointer; 
  font-weight: 600;
  font-size: 0.95em;
  transition: all 0.2s;
  pointer-events: auto; /* 클릭 가능하도록 명시 */
  z-index: 10; /* 다른 요소 위에 표시 */
}

.filter-modal-actions button:hover {
  background: #6d0000;
  transform: translateY(-0.0625rem);
  box-shadow: 0 0.125rem 0.375rem rgba(139, 0, 0, 0.3);
}

.filter-modal-actions button.secondary { 
  background: #6c757d;
}

.filter-modal-actions button.secondary:hover {
  background: #5a6268;
  box-shadow: 0 0.125rem 0.375rem rgba(108, 117, 125, 0.3);
}

/* 키워드 필터 그룹 스타일*/
.subgroup-wrapper { 
  margin-bottom: 0.875rem; 
  padding-bottom: 0.75rem; 
  border-bottom: 1px dashed #e0e0e0; 
}

.subgroup-wrapper:last-child { 
  border-bottom: none; 
  margin-bottom: 0; 
  padding-bottom: 0; 
}

.subgroup-wrapper h5 { 
  margin: 0 0 0.5rem 0; 
  font-size: 0.9em; 
  font-weight: 700; 
  color: #555; 
  letter-spacing: 0.01875rem; 
}

/* 키워드 매칭 방식 토글 */
.kw-heading { 
  display: flex; 
  align-items: center; 
  gap: 0.75rem; 
  flex-wrap: wrap; 
}

.match-mode-toggle { 
  display: inline-flex; 
  border: 0.125rem solid #8b0000; 
  border-radius: 1.25rem; 
  overflow: hidden; 
  height: 2rem; 
  background: #fff; 
  user-select: none; 
  position: relative; 
  font-size: 0; 
}

.match-mode-toggle .mm-btn { 
  flex: 1 1 0; 
  background: transparent; 
  border: none; 
  padding: 0 1.25rem; 
  font-size: 0.72rem; 
  font-weight: 600; 
  letter-spacing: 0.03125rem; 
  color: #8b0000; 
  cursor: pointer; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  position: relative; 
  transition: all 0.18s ease; 
  white-space: nowrap; 
  pointer-events: auto; /* 클릭 가능하도록 명시 */
  z-index: 10; /* 다른 요소 위에 표시 */
}

.match-mode-toggle .mm-btn + .mm-btn { 
  border-left: 0.125rem solid #8b0000; 
}

.match-mode-toggle .mm-btn.active { 
  color: #fff; 
  background: #8b0000; 
}

.match-mode-toggle .mm-btn:focus-visible { 
  outline: 0.125rem solid #c00; 
  outline-offset: -0.125rem; 
  z-index: 2; 
}

.match-mode-toggle .mm-btn:not(.active):hover { 
  background: rgba(139, 0, 0, 0.08); 
}

.kw-heading .match-mode-toggle { 
  margin-left: auto; 
}

/* Gift Select Grid */
.gift-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
  gap: 1rem;
  padding: 1rem;
  overflow-y: auto;
  max-height: 65vh;
  background: #2a2419;
  border-radius: 0.5rem;
  border: 1px solid #5a4a35;
  margin-top: 0.625rem;
  width: 100%;
  min-width: 60rem;
}

/* Gift Select Item (Planner) - Card Style */
.gift-select-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(42, 36, 25, 0.5);
  border: 0.125rem solid rgba(212, 175, 55, 0.2);
  border-radius: 0.75rem;
  padding: 0.875rem 0.375rem 1.125rem 0.375rem;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.3), inset 0 0.0625rem 0 rgba(212, 175, 55, 0.1);
}

.gift-select-item:hover {
  transform: translateY(-0.25rem) scale(1.02);
  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;
  background: rgba(42, 36, 25, 0.5); /* 배경 어둡게 */
}

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

.gift-select-item.selected {
  border-color: #ffae00;
  background: rgba(42, 36, 25, 0.8);
  box-shadow: 0 0 0.625rem rgba(255, 174, 0, 0.3);
}

/* Exclusive Gift Style (전용 기프트 */
.gift-select-item.exclusive-gift {
  border-color: #4CAF50;
  box-shadow: 0 0 0.9375rem rgba(76, 175, 80, 0.4), 0 0.25rem 0.5rem rgba(0, 0, 0, 0.3);
}

/* Event Limited Gift Style (이벤트 한정 합성 기프트 - exclusive-gift와 동일 스타일*/
.gift-select-item.event-limited-gift {
  border-color: #4CAF50;
  box-shadow: 0 0 0.9375rem rgba(76, 175, 80, 0.4), 0 0.25rem 0.5rem rgba(0, 0, 0, 0.3);
}

.gift-select-item.event-limited-gift:hover {
  border-color: #4CAF50;
  box-shadow: 0 0 1.25rem rgba(76, 175, 80, 0.6), 0 0.375rem 0.75rem rgba(0, 0, 0, 0.4);
}

/* ?�택??전용 기프트- ?�택 ?�태가 최우??*/
.gift-select-item.exclusive-gift.selected {
  border-color: #ffae00 !important;
  box-shadow: 0 0 0.625rem rgba(255, 174, 0, 0.5), 0 0 1.25rem rgba(76, 175, 80, 0.3) !important;
}

/* Tier Badge - Inside Image Container Top Left */
.gift-select-item .gift-tier-badge {
  position: absolute;
  top: 0.25rem;
  left: 0.5rem;
  font-family: 'Noto Sans KR', sans-serif;
  font-weight: 900;
  font-size: 1.5rem;
  color: #ffae00;
  z-index: 10;
  text-shadow: 0 0 0.3125rem rgba(255, 174, 0, 0.5), 0.125rem 0.125rem 0 rgba(0, 0, 0, 0.8);
  line-height: 1;
}

.gift-select-item .gift-tier-badge.tier-EX {
  color: #ccff00;
  text-shadow: 0 0 0.3125rem rgba(204, 255, 0, 0.5), 0.125rem 0.125rem 0 rgba(0, 0, 0, 0.8);
}

/* Image Container */
.gift-select-item .gift-image-container {
  width: 6.5rem;
  height: 6.5rem;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.375rem;
}

/* Hexagon Border - Behind Image */
.gift-select-item .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; /* Frame behind image */
}

/* Image Placeholder - On Top */
.gift-select-item .gift-image-placeholder {
  width: 65%; /* Slightly smaller to fit inside frame */
  height: 65%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1; /* Image on top of frame */
}

.gift-select-item .gift-image-placeholder img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0.125rem 0.25rem rgba(0,0,0,0.5));
}

/* Attribute Icon - Bottom Right of Image */
.gift-select-item .gift-attribute-icon {
  position: absolute;
  bottom: 0.375rem;
  right: 0.375rem;
  width: 1.5rem;
  height: 1.5rem;
  z-index: 5;
  filter: drop-shadow(0 0 0.125rem rgba(0,0,0,0.8));
}

.gift-select-item .gift-attribute-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Name */
.gift-select-item .name {
  font-size: 0.85rem;
  color: #e0e0e0;
  text-align: center;
  font-weight: bold;
  width: 100%;
  padding: 0 0.375rem;
  text-shadow: 0.0625rem 0.0625rem 0.125rem rgba(0,0,0,0.8);
  
  /* Multi-line support */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  line-height: 1.3;
  height: 2.6em; /* Fixed height for 2 lines */
  margin-top: 0.25rem;
}

/* Pack Select Modal Specifics */
#pack-select-modal .modal-content {
  background-color: #1e1e1e;
  color: #e0e0e0;
  border: 1px solid #333;
  padding: 1.25rem;
  width: 70rem;
  max-width: 70rem;
  min-width: 70rem;
}

#pack-select-modal h3 {
  color: #fff;
  border-bottom: 1px solid #333;
  padding-bottom: 0.9375rem;
  margin-bottom: 0.9375rem;
}

#pack-select-modal .modal-search input {
  background-color: #2a2a2a;
  border: 1px solid #444;
  color: #fff;
}

#pack-select-modal .modal-search input:focus {
  border-color: #ffae00;
  box-shadow: 0 0 0 0.1875rem rgba(255, 174, 0, 0.1);
}

#pack-select-modal .modal-actions {
  border-top: 1px solid #333;
}

#pack-select-modal .modal-cancel-btn {
  background-color: #333;
  color: #fff;
  border: 1px solid #555;
}

#pack-select-modal .modal-cancel-btn:hover {
  background-color: #444;
  border-color: #777;
}

/* Pack Select Modal Grid */
.pack-select-grid {
  display: grid;
  grid-template-columns: repeat(5, 11rem);
  gap: 1.25rem;
  padding: 1.25rem;
  max-height: 65vh;
  overflow-y: auto;
  width: fit-content;
}

.pack-select-item {
  cursor: pointer;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: none;
  transition: all 0.2s ease;
  background-color: transparent;
  border: 0.1875rem solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.pack-select-item img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  border-radius: 0.375rem;
}

.pack-select-item:hover {
  transform: translateY(-0.3125rem) scale(1.02);
  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;
}

/* Pack Cancel Item */
.pack-cancel-item {
  background: #333;
  border: 0.125rem dashed #ff6b6b;
  border-radius: 0.5rem;
  aspect-ratio: 0.58;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pack-cancel-item:hover {
  border-color: #ff4444;
  background: #444;
  box-shadow: 0 0 0.9375rem rgba(255, 100, 100, 0.4);
}

.pack-cancel-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  color: #ff6b6b;
  font-weight: 600;
  text-align: center;
}

.pack-cancel-content i {
  font-size: 2em;
}

.pack-cancel-content span {
  font-size: 0.9em;
}

/* 커스?�확인 모달 */
.confirm-modal {
  z-index: 2000;
}

.confirm-modal-content {
  background: linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 100%);
  border: 1px solid #444;
  border-radius: 0.75rem;
  padding: 1.875rem 2.5rem;
  width: 28.125rem;
  max-width: 28.125rem;
  min-width: 28.125rem;
  text-align: center;
  box-shadow: 0 1.25rem 3.75rem rgba(0, 0, 0, 0.5);
  animation: confirmModalIn 0.2s ease-out;
}

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

.confirm-modal-content p {
  color: #e0e0e0;
  font-size: 1.1rem;
  line-height: 1.6;
  margin: 0 0 1.5625rem 0;
  word-break: keep-all;
}

.confirm-modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.confirm-btn {
  padding: 0.625rem 1.75rem;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.confirm-btn.primary {
  background: linear-gradient(135deg, #c9a227 0%, #a68523 100%);
  color: #1a1a1a;
}

.confirm-btn.primary:hover {
  background: linear-gradient(135deg, #d4b02e 0%, #b89528 100%);
  transform: translateY(-0.0625rem);
}

.confirm-btn.secondary {
  background: #3a3a3a;
  color: #ccc;
  border: 1px solid #555;
}

.confirm-btn.secondary:hover {
  background: #4a4a4a;
  border-color: #666;
}

/* ============================================
   모달 내 필터 버튼 스타일
   ============================================ */
.modal-keyword-btn {
  padding: 0.25rem 0.5rem !important;
  font-size: 0.8em !important;
  height: 1.75rem !important;
  min-width: auto !important;
}

.tier-btn-modal {
  padding: 0.25rem 0.5rem;
  background: #2a1f1a;
  color: #ffae00;
  border: 1px solid rgba(255, 174, 0, 0.3);
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 700;
  font-size: 0.8em;
  font-family: 'Noto Sans KR', sans-serif;
  text-shadow: 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.5);
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
}

.tier-btn-modal:hover {
  background: #3a2f2a;
  border-color: rgba(255, 174, 0, 0.5);
}

.tier-btn-modal.active {
  background: #ffae00;
  color: #1a1410;
  border-color: #ffae00;
  box-shadow: 0 0.125rem 0.5rem rgba(255, 174, 0, 0.4);
  text-shadow: none;
}

/* 모달 내 필터 열기 버튼 */
.modal-filter-btn-open {
  padding: 0.25rem 0.625rem;
  background: #2a2a2a;
  color: #ccc;
  border: 1px solid #444;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-filter-btn-open:hover {
  background: #3a3a3a;
  border-color: #666;
  color: #fff;
}

.modal-filter-btn-open.has-filter {
  background: rgba(255, 174, 0, 0.2);
  border-color: rgba(255, 174, 0, 0.5);
  color: #ffae00;
}

/* 모달용 키워드 필터 모달 z-index */
#modal-keyword-filter {
  z-index: 1200;
}

/* ===================================
   후원하기 버튼 및 모달
   =================================== */

.donate-btn {
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
    margin-left: 1rem;
}

.donate-btn:hover {
    background: linear-gradient(135deg, #ff5252, #e04848);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(238, 90, 90, 0.4);
}

.donate-btn i {
    font-size: 1rem;
}

.donate-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

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

.donate-modal-content {
    background: #2a2a2a;
    border-radius: 1rem;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.donate-modal-content h3 {
    color: #fff;
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
}

.donate-modal-content > p {
    color: #aaa;
    margin: 0 0 1.5rem 0;
    font-size: 0.9rem;
}

.donate-modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    color: #888;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
}

.donate-modal-close:hover {
    color: #fff;
}

.donate-options {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.donate-option.coffee-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, #ffdd00, #ffc800);
    color: #333;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.donate-option.coffee-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 200, 0, 0.4);
}

.donate-option.coffee-btn i {
    font-size: 1.3rem;
}

.donate-option.qr-option {
    background: #333;
    border-radius: 0.75rem;
    padding: 1rem;
}

.donate-option.qr-option p {
    color: #aaa;
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
}

.donate-qr {
    width: 180px;
    height: 180px;
    border-radius: 0.5rem;
    background: white;
    padding: 0.5rem;
}


