/**
 * Quest System Styles
 */

/* Quest Panel */
.quest-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 800px;
  max-height: 80vh;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.quest-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

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

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

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

#quest-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* Scrollbar styling */
#quest-panel-content::-webkit-scrollbar {
  width: 10px;
}

#quest-panel-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

#quest-panel-content::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 10px;
}

#quest-panel-content::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Quest Tabs */
.quest-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 2px solid #e0e0e0;
}

.quest-tab {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  color: #666;
  transition: all 0.2s;
}

.quest-tab:hover {
  color: #333;
  background: rgba(0, 0, 0, 0.05);
}

.quest-tab.active {
  color: #667eea;
  border-bottom-color: #667eea;
}

.quest-tab-content {
  display: none;
}

.quest-tab-content.active {
  display: block;
}

/* Quest List */
.quest-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Quest Card */
.quest-card {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
  border-left: 4px solid #ccc;
  transition: all 0.2s;
}

.quest-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.quest-active {
  border-left-color: #28a745;
  background: linear-gradient(135deg, #f8f9fa 0%, #e8f5e9 100%);
}

.quest-available {
  border-left-color: #667eea;
}

/* Quest Header */
.quest-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.quest-icon {
  font-size: 36px;
  line-height: 1;
}

.quest-title-area {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.quest-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #333;
}

.quest-category {
  padding: 4px 10px;
  font-size: 12px;
  text-transform: capitalize;
}

/* Quest Description */
.quest-description {
  margin: 0 0 15px 0;
  color: #666;
  line-height: 1.5;
}

/* Quest Objectives */
.quest-objectives {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 15px;
}

.quest-objective {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.objective-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #555;
}

.objective-text.complete {
  color: #28a745;
  font-weight: 500;
}

.objective-icon {
  font-size: 16px;
}

.objective-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #28a745 0%, #20c997 100%);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 12px;
  color: #666;
  font-weight: 500;
  min-width: 50px;
  text-align: right;
}

/* Quest Rewards */
.quest-rewards {
  padding: 12px;
  background: rgba(102, 126, 234, 0.1);
  border-radius: 6px;
  margin-bottom: 15px;
  font-size: 14px;
  color: #555;
}

.quest-rewards strong {
  color: #667eea;
}

/* Quest Buttons */
.quest-start-btn,
.quest-complete-btn {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.quest-start-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.quest-start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.quest-complete-btn {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
  animation: pulse 2s infinite;
}

.quest-complete-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
  }
}

/* Quest Empty State */
.quest-empty {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

.quest-empty p:first-child {
  font-size: 48px;
  margin-bottom: 10px;
}

.quest-empty .text-muted {
  font-size: 14px;
  color: #aaa;
}

/* Quest Button in Header */
.quest-btn {
  position: relative;
  padding: 6px 14px;
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  transition: all 0.2s;
  font-family: inherit;
}

/* Pulse animation when available quests exist */
.quest-btn.has-available-quests {
  animation: questPulse 2s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
}

.quest-btn.has-available-quests::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  opacity: 0;
  z-index: -1;
  animation: questGlow 2s ease-in-out infinite;
}

@keyframes questPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 8px rgba(102, 126, 234, 0);
  }
}

@keyframes questGlow {
  0%, 100% {
    opacity: 0;
  }
  50% {
    opacity: 0.6;
  }
}

.quest-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  animation: none; /* Stop pulse on hover */
}

.quest-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;
}

.badge-success {
  background: #28a745;
  color: white;
  animation: bounce 1s infinite;
}

.badge-info {
  background: #17a2b8;
  color: white;
}

@keyframes bounce {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .quest-panel {
    width: 95%;
    max-height: 90vh;
  }

  .quest-panel-header {
    padding: 15px;
  }

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

  #quest-panel-content {
    padding: 15px;
  }

  .quest-card {
    padding: 15px;
  }

  .quest-title {
    font-size: 18px;
  }

  .quest-icon {
    font-size: 28px;
  }
}

/* ─── Quest Hint System ─── */

@keyframes quest-hint-pulse {
  0% { box-shadow: 0 0 4px 1px rgba(218, 165, 32, 0.4); }
  50% { box-shadow: 0 0 12px 4px rgba(218, 165, 32, 0.8); }
  100% { box-shadow: 0 0 4px 1px rgba(218, 165, 32, 0.4); }
}

.quest-hint-target {
  animation: quest-hint-pulse 1.8s ease-in-out infinite;
  border-radius: 6px;
  position: relative;
  z-index: 2;
}

.quest-hint-tooltip {
  position: absolute;
  z-index: 1001;
  background: linear-gradient(135deg, #2c1810 0%, #3d2114 100%);
  color: #f4d47c;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid rgba(218, 165, 32, 0.5);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  white-space: nowrap;
  animation: quest-tooltip-fade-in 0.3s ease-out;
}

.quest-hint-tooltip::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid rgba(218, 165, 32, 0.5);
}

@keyframes quest-tooltip-fade-in {
  from { opacity: 0; transform: translateX(-50%) translateY(4px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
