/**
 * Reward Chest System Styles
 * Unified UI for claiming pending rewards from quests, pillage, and caravans.
 */

/* ============ REWARD BUTTON IN HEADER ============ */
.reward-btn {
  position: relative;
  padding: 6px 14px;
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
  color: #5a3e1b;
  transition: all 0.2s;
  font-family: inherit;
}

.reward-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(253, 160, 133, 0.5);
  animation: none;
}

.reward-btn.has-rewards {
  animation: rewardPulse 2s ease-in-out infinite;
}

.reward-btn .badge {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 20px;
  height: 20px;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: bold;
  line-height: 16px;
  text-align: center;
  background: #e74c3c;
  color: white;
}

@keyframes rewardPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(246, 211, 101, 0.7);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 8px rgba(246, 211, 101, 0);
  }
}

/* ============ REWARD PANEL ============ */
.reward-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  z-index: 1001;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.reward-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
  color: #5a3e1b;
}

.reward-panel-header h2 {
  margin: 0;
  font-size: 24px;
}

.reward-panel-header .close-btn {
  background: rgba(255, 255, 255, 0.3);
  border: none;
  color: #5a3e1b;
  font-size: 28px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s;
}

.reward-panel-header .close-btn:hover {
  background: rgba(255, 255, 255, 0.5);
}

.reward-panel-actions {
  padding: 12px 20px;
  background: #fdf7ef;
  border-bottom: 1px solid #f0e0c8;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.reward-panel-actions .reward-count {
  font-size: 14px;
  color: #8a6d3b;
  font-weight: 500;
}

#reward-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

#reward-panel-content::-webkit-scrollbar {
  width: 6px;
}

#reward-panel-content::-webkit-scrollbar-track {
  background: #f5f5f5;
}

#reward-panel-content::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

/* ============ REWARD CARDS ============ */
.reward-card {
  background: #fefdf8;
  border: 1px solid #f0e0c8;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.2s;
  animation: rewardSlideIn 0.3s ease-out;
}

.reward-card:hover {
  border-color: #daa520;
  box-shadow: 0 2px 8px rgba(218, 165, 32, 0.15);
}

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

.reward-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.reward-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reward-card-icon {
  font-size: 24px;
}

.reward-card-source {
  font-weight: 600;
  color: #333;
  font-size: 15px;
}

.reward-card-type {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.reward-type-quest {
  background: #e8f0fe;
  color: #1a73e8;
}

.reward-type-pillage {
  background: #fce8e6;
  color: #d93025;
}

.reward-type-caravan {
  background: #e6f4ea;
  color: #137333;
}

.reward-card-contents {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.reward-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: #f8f4e8;
  border: 1px solid #e8dcc0;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  color: #5a3e1b;
}

.reward-item-icon {
  font-size: 14px;
}

.reward-card-actions {
  display: flex;
  justify-content: flex-end;
}

.reward-card-time {
  font-size: 12px;
  color: #999;
  margin-bottom: 8px;
}

/* ============ BUTTONS ============ */
.btn-claim {
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
  color: #5a3e1b;
  transition: all 0.2s;
}

.btn-claim:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(253, 160, 133, 0.4);
}

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

.btn-claim-all {
  padding: 10px 24px;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
  color: #5a3e1b;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-claim-all:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 12px rgba(253, 160, 133, 0.5);
}

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

/* ============ CLAIM ANIMATION ============ */
.reward-card.claiming {
  animation: claimReward 0.5s ease-out forwards;
}

@keyframes claimReward {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
    background: #fff8dc;
    border-color: #daa520;
    box-shadow: 0 0 20px rgba(218, 165, 32, 0.3);
  }
  100% {
    opacity: 0;
    transform: scale(0.95) translateX(30px);
    height: 0;
    padding: 0;
    margin: 0;
    border: none;
  }
}

/* ============ EMPTY STATE ============ */
.reward-empty {
  text-align: center;
  padding: 40px 20px;
  color: #999;
}

.reward-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.reward-empty-text {
  font-size: 16px;
  font-weight: 500;
}

.reward-empty-subtext {
  font-size: 13px;
  margin-top: 4px;
  color: #bbb;
}

/* ============ SHIMMER ON NEW REWARDS ============ */
.reward-card.new-reward {
  position: relative;
  overflow: hidden;
}

.reward-card.new-reward::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(218, 165, 32, 0.15),
    transparent
  );
  animation: shimmer 1.5s ease-in-out;
}

@keyframes shimmer {
  from {
    left: -100%;
  }
  to {
    left: 100%;
  }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .reward-panel {
    width: 95%;
    max-height: 90vh;
  }

  .reward-panel-header {
    padding: 16px;
  }

  .reward-panel-header h2 {
    font-size: 20px;
  }

  .reward-card-contents {
    gap: 4px;
  }

  .reward-item {
    font-size: 12px;
    padding: 3px 8px;
  }
}
