/* ================================
   거래 화면 스타일
   거래 컨테이너, 거래 카드, 거래 폼
================================ */

.trade-container {
  max-width: 900px;
  margin: 0 auto;
  background: var(--card-bg);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.trade-container h2 {
  color: white;
  text-align: center;
  margin-bottom: 8px;
}

.trade-offer-row {
  margin-bottom: 12px;
}

.trade-offer-row label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 6px;
}

.trade-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.trade-item-row .trade-item-select {
  flex: 1;
  min-width: 160px;
}

.trade-qty-input {
  width: 80px;
}

.trade-block-pokemon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.trade-block-pokemon img {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
}

.trade-block-item {
  font-size: 13px;
  color: var(--pokemon-blue);
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
}

.trade-block-empty {
  color: var(--text-secondary);
  font-size: 13px;
}

.trade-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  justify-content: center;
}

.trade-tab {
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-normal);
  font-family: inherit;
}

.trade-tab:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.trade-tab.active {
  background: linear-gradient(135deg, var(--pokemon-red), #ff5a36);
  color: white;
}

.trade-section {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 24px;
}

.trade-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.trade-empty {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
}

.trade-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 12px;
}

.trade-card-pokemon {
  display: flex;
  align-items: center;
  gap: 24px;
  flex: 1;
}

.trade-pokemon-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.trade-pokemon-item img {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
}

.trade-pokemon-item .name {
  font-size: 12px;
  font-weight: 600;
  color: var(--pokemon-blue);
}

.trade-arrow {
  font-size: 24px;
  color: var(--text-secondary);
}

.trade-owner-label {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.trade-owner-label.mine {
  background: linear-gradient(135deg, #4fc3f7, #29b6f6);
  color: white;
}

.trade-owner-label.opponent {
  background: linear-gradient(135deg, #ff8a65, #ff7043);
  color: white;
}

.trade-pokemon-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.trade-pokemon-stats .star-rank {
  font-size: 10px;
}

.trade-pokemon-stats .grade-badge {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}

.trade-card-info {
  text-align: right;
}

.trade-from {
  font-weight: 600;
  color: var(--pokemon-blue);
  margin-bottom: 4px;
}

.trade-date {
  font-size: 12px;
  color: var(--text-secondary);
}

.trade-card-actions {
  display: flex;
  gap: 8px;
}

.trade-card-actions button {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.btn-accept {
  background: #00b894;
  color: white;
}

.btn-reject {
  background: #d63031;
  color: white;
}

.btn-cancel {
  background: #636e72;
  color: white;
}

.new-trade-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.trade-step h3 {
  color: var(--pokemon-blue);
  font-size: 16px;
  margin-bottom: 12px;
}

.trade-select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
}

.trade-pokemon-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  padding: 8px;
  background: #f8f9fa;
  border-radius: 12px;
}

.trade-pokemon-card {
  padding: 8px;
  background: white;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-fast);
  border: 2px solid transparent;
  position: relative;
}

.trade-pokemon-card:hover {
  border-color: var(--pokemon-red);
}

.trade-pokemon-card.selected {
  border-color: var(--pokemon-red);
  background: #fff5f5;
}

.trade-pokemon-card.shiny {
  background: linear-gradient(135deg, #fff9c4, #fff59d, #fff9c4);
  background-size: 200% 200%;
  border: 2px solid #ffd700;
  box-shadow: 0 2px 10px rgba(255, 215, 0, 0.3), inset 0 0 15px rgba(255, 255, 255, 0.2);
  animation: shiny-glow 3s ease-in-out infinite;
}

.trade-pokemon-card.shiny::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shiny-shimmer 2s infinite;
  pointer-events: none;
}

.trade-pokemon-card.shiny .shiny-badge {
  position: absolute;
  top: 2px;
  left: 2px;
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  color: #8b6914;
  font-size: 8px;
  font-weight: bold;
  padding: 1px 4px;
  border-radius: 6px;
  border: 1px solid #ffd700;
  box-shadow: 0 1px 4px rgba(255, 215, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.8);
  z-index: 10;
  animation: shiny-badge-pulse 2s ease-in-out infinite;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
  white-space: nowrap;
}

.trade-pokemon-card.shiny:hover {
  border-color: #ffd700;
  box-shadow: 0 3px 15px rgba(255, 215, 0, 0.5), inset 0 0 20px rgba(255, 255, 255, 0.3);
}

.trade-pokemon-card.shiny .trade-pokemon-card img {
  filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.5));
}

.trade-pokemon-card img {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
}

.trade-pokemon-card .name {
  font-size: 10px;
  font-weight: 600;
  color: var(--pokemon-blue);
  margin-top: 4px;
}

.trade-empty-small {
  grid-column: 1 / -1;
  text-align: center;
  padding: 24px;
  color: var(--text-secondary);
  font-size: 14px;
}

.selected-pokemon {
  margin-top: 12px;
  padding: 12px;
  background: linear-gradient(135deg, #fff5f5, #fff0f5);
  border: 2px solid var(--pokemon-red);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.selected-pokemon img {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
}

.selected-pokemon .info {
  flex: 1;
}

.selected-pokemon .name {
  font-weight: 600;
  color: var(--pokemon-blue);
}

.selected-pokemon .level {
  font-size: 12px;
  color: var(--text-secondary);
}

#submit-trade-btn {
  margin-top: 16px;
}

#submit-trade-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.custom-select-container {
  position: relative;
  width: 100%;
}

.custom-select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 2px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 12px 12px;
  max-height: 250px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  margin-top: -10px;
}

.custom-select-dropdown.hidden {
  display: none;
}

.dropdown-item {
  padding: 12px 16px;
  cursor: pointer;
  transition: background-color 0.2s;
  font-size: 15px;
  color: #2c3e50;
}

.dropdown-item:hover {
  background: linear-gradient(135deg, rgba(227, 53, 13, 0.1), rgba(255, 90, 54, 0.1));
}

.dropdown-item.disabled {
  color: var(--text-secondary);
  cursor: default;
  text-align: center;
}

.dropdown-item.disabled:hover {
  background: transparent;
}

.trade-pokemon-card.rarity-legendary {
  background: linear-gradient(135deg, #fff8e1, #ffcc02);
}

.trade-pokemon-card.rarity-mythical {
  background: linear-gradient(135deg, #fce4ec, #e91e63);
}

.trade-pokemon-card.rarity-epic {
  background: linear-gradient(135deg, #ede7f6, #9c27b0);
}

.trade-pokemon-card.rarity-rare {
  background: linear-gradient(135deg, #e3f2fd, #2196f3);
}

.trade-pokemon-card.rarity-uncommon {
  background: linear-gradient(135deg, #e8f5e9, #4caf50);
}

.trade-pokemon-card .card-level {
  position: absolute;
  top: 5px;
  left: 5px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: bold;
  z-index: 10;
}

/* 미디어 쿼리 */
@media (max-width: 768px) {
  .trade-pokemon-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .trade-tabs {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .trade-pokemon-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}
