/* ============================================
   Trainer Window UI Styles for OpenMUD
   Recipe learning interface
   Uses theme variables from theme.css
   ============================================ */

/* Trainer Window Container */
#trainer-window {
  display: none;
  flex-direction: column;
  position: fixed;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  width: 400px;
  max-height: 500px;
  background: var(--theme-bg-secondary);
  border: 1px solid var(--theme-border-primary);
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  z-index: 1000;
}

/* Header */
#trainer-window .window-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--theme-bg-tertiary);
  border-bottom: 1px solid var(--theme-border-secondary);
  cursor: move;
}

#trainer-window .window-title {
  font-size: 12px;
  font-weight: bold;
  color: var(--theme-text-primary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

#trainer-window .window-controls {
  display: flex;
  gap: 4px;
}

#trainer-window .window-btn {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--theme-bg-primary);
  border: 1px solid var(--theme-border-secondary);
  border-radius: 2px;
  color: var(--theme-text-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

#trainer-window .window-btn:hover {
  background: var(--theme-accent-red);
  color: #fff;
}

/* Content Area */
#trainer-window .window-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

/* Trainer Header (name + currency) */
.trainer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--theme-bg-tertiary);
  border-bottom: 1px solid var(--theme-border-secondary);
}

#trainer-npc-name {
  font-size: 14px;
  font-weight: bold;
  color: #ffd700;
}

#trainer-player-currency {
  font-size: 12px;
  color: #ffd700;
}

/* Search Container */
.trainer-search-container {
  padding: 8px 12px;
  background: var(--theme-bg-tertiary);
  border-bottom: 1px solid var(--theme-border-secondary);
}

#trainer-search {
  width: 100%;
  padding: 6px 10px;
  background: var(--theme-bg-primary);
  border: 1px solid var(--theme-border-secondary);
  border-radius: 3px;
  color: var(--theme-text-primary);
  font-size: 12px;
  font-family: inherit;
}

#trainer-search:focus {
  outline: none;
  border-color: var(--theme-accent-blue);
}

#trainer-search::placeholder {
  color: var(--theme-text-muted);
}

/* Recipes List */
.trainer-items-container {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.trainer-items-container::-webkit-scrollbar {
  width: 6px;
}

.trainer-items-container::-webkit-scrollbar-track {
  background: var(--theme-bg-primary);
}

.trainer-items-container::-webkit-scrollbar-thumb {
  background: var(--theme-border-primary);
  border-radius: 3px;
}

#trainer-items-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Individual Recipe Item */
.trainer-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--theme-bg-tertiary);
  border: 1px solid var(--theme-border-secondary);
  border-radius: 3px;
  transition: all 0.2s;
}

.trainer-item:hover {
  background: #333333;
  border-color: var(--theme-border-primary);
}

.trainer-item.known {
  opacity: 0.6;
  background: rgba(76, 175, 80, 0.1);
  border-color: rgba(76, 175, 80, 0.3);
}

.trainer-item.locked {
  opacity: 0.5;
}

.trainer-item.just-learned {
  animation: learnPulse 2s ease-out;
}

@keyframes learnPulse {
  0% { background: rgba(76, 175, 80, 0.4); }
  100% { background: rgba(76, 175, 80, 0.1); }
}

/* Recipe Icon */
.trainer-item-icon {
  width: 28px;
  height: 28px;
  /* Removed filter to preserve SVG colors */
}

/* Recipe Info */
.trainer-item-info {
  flex: 1;
  min-width: 0;
}

.trainer-item-name {
  font-size: 12px;
  font-weight: bold;
  color: var(--theme-text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trainer-item-details {
  display: flex;
  gap: 10px;
  font-size: 10px;
  color: var(--theme-text-muted);
}

.trainer-item-skill {
  text-transform: capitalize;
}

.trainer-item-requirement {
  color: #aaa;
}

.trainer-item.locked .trainer-item-requirement {
  color: var(--theme-accent-red);
}

/* Recipe Actions */
.trainer-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.trainer-item-cost {
  font-size: 11px;
  color: #ffd700;
  font-weight: bold;
}

.trainer-status {
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 3px;
  text-transform: uppercase;
}

.trainer-status.known {
  background: rgba(76, 175, 80, 0.2);
  color: var(--theme-accent-green);
}

/* Learn Button */
.trainer-learn-btn {
  padding: 5px 12px;
  background: var(--theme-accent-green);
  border: none;
  border-radius: 3px;
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.trainer-learn-btn:hover:not([disabled]) {
  background: #66BB6A;
  transform: translateY(-1px);
}

.trainer-learn-btn[disabled] {
  background: #555;
  color: var(--theme-text-muted);
  cursor: not-allowed;
}

/* Empty State */
.trainer-empty {
  text-align: center;
  padding: 24px;
  color: var(--theme-text-muted);
  font-size: 12px;
}

/* Footer */
.trainer-footer {
  padding: 8px 12px;
  background: var(--theme-bg-tertiary);
  border-top: 1px solid var(--theme-border-secondary);
  font-size: 10px;
  color: var(--theme-text-muted);
  text-align: center;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 500px) {
  #trainer-window {
    width: 95%;
    left: 2.5%;
    transform: none;
  }
}
