/* ============================================
   Pet UI Window Styles for OpenMUD
   Compact 340px single-column dashboard
   Uses theme variables from theme.css
   ============================================ */

/* Pet window positioning and base styles */
#pet-window {
  position: absolute;
  top: 140px;
  left: 20px;
  width: 340px;
  max-width: 90vw;
  background: var(--theme-bg-secondary);
  border: 2px solid var(--theme-border-primary);
  border-radius: 4px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
  z-index: 9999;
  display: none;
  flex-direction: column;
}

#pet-window.window-dragging {
  transition: none !important;
  user-select: none;
}

#pet-window .window-header {
  cursor: move;
  user-select: none;
}

#pet-window .window-header:active {
  cursor: grabbing;
}

/* Charmed pet accent — amber left border */
#pet-window.pet-charmed {
  border-left: 3px solid var(--theme-warning);
}

/* Fade-out animation on dismiss */
#pet-window.pet-fading {
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* ============================================
   Window Content
   ============================================ */

#pet-window .window-content {
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  gap: 8px;
  overflow: hidden;
}

/* ============================================
   Header — Name, Level, Type Badge
   ============================================ */

.pet-header-info {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  overflow: hidden;
}

.pet-name {
  font-weight: bold;
  color: var(--theme-text-primary);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.pet-level {
  color: var(--theme-text-secondary);
  font-size: 11px;
  white-space: nowrap;
}

.pet-type-badge {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: bold;
  white-space: nowrap;
}

.pet-type-badge.summoned {
  background: rgba(76, 175, 80, 0.1);
  color: var(--theme-accent-green);
  border: 1px solid rgba(76, 175, 80, 0.3);
}

.pet-type-badge.charmed {
  background: rgba(255, 193, 7, 0.1);
  color: var(--theme-warning);
  border: 1px solid rgba(255, 193, 7, 0.3);
}

/* ============================================
   Resource Bars
   ============================================ */

.pet-bars {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pet-bar-row {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 14px;
}

.pet-bar-label {
  width: 24px;
  font-size: 10px;
  color: var(--theme-text-secondary);
  text-align: right;
  flex-shrink: 0;
}

.pet-bar-container {
  flex: 1;
  height: 10px;
  background: var(--theme-bg-primary);
  border: 1px solid var(--theme-border-secondary);
  border-radius: 2px;
  overflow: hidden;
}

.pet-bar-fill {
  height: 100%;
  transition: width 0.3s ease;
  border-radius: 1px;
}

.pet-bar-fill.health {
  background: var(--theme-health-high);
}

.pet-bar-fill.health.medium {
  background: var(--theme-health-medium);
}

.pet-bar-fill.health.low {
  background: var(--theme-health-low);
}

.pet-bar-fill.health.critical {
  background: var(--theme-health-critical);
}

.pet-bar-fill.mana {
  background: var(--theme-mana);
}

.pet-bar-fill.stamina {
  background: var(--theme-stamina);
}

.pet-bar-text {
  width: 70px;
  font-size: 10px;
  color: var(--theme-text-secondary);
  text-align: right;
  flex-shrink: 0;
}

/* ============================================
   Status Line — Mode + Target
   ============================================ */

.pet-status-line {
  font-size: 11px;
  color: var(--theme-text-secondary);
  padding: 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pet-mode-text {
  color: var(--theme-text-primary);
  font-weight: bold;
}

.pet-target-text {
  color: var(--theme-health-critical);
}

/* Charm countdown */
.pet-charm-timer {
  font-size: 11px;
  color: var(--theme-text-secondary);
  padding: 0 0 2px 0;
}

.pet-charm-timer.warning {
  color: var(--theme-warning);
}

.pet-charm-timer.critical {
  color: var(--theme-health-critical);
  font-weight: bold;
}

/* ============================================
   Command Buttons — 3x2 Grid
   ============================================ */

.pet-commands {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.pet-cmd-btn {
  padding: 4px 2px;
  font-size: 11px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  background: var(--theme-bg-primary);
  border: 1px solid var(--theme-border-secondary);
  border-radius: 3px;
  color: var(--theme-text-secondary);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.pet-cmd-btn:hover {
  background: var(--theme-bg-tertiary);
  border-color: var(--theme-border-primary);
  color: var(--theme-text-primary);
}

.pet-cmd-btn:active {
  background: var(--theme-bg-tertiary);
}

.pet-cmd-btn.active {
  background: rgba(76, 175, 80, 0.2);
  border-color: rgba(76, 175, 80, 0.3);
  color: var(--theme-accent-green);
  font-weight: bold;
}

.pet-cmd-btn.dismiss {
  color: var(--theme-error);
  border-color: rgba(244, 67, 54, 0.3);
}

.pet-cmd-btn.dismiss:hover {
  background: rgba(244, 67, 54, 0.1);
  border-color: rgba(244, 67, 54, 0.4);
  color: var(--theme-error);
}

.pet-cmd-btn.confirming {
  background: rgba(244, 67, 54, 0.2);
  border-color: var(--theme-error);
  color: var(--theme-error);
  font-weight: bold;
  animation: pet-confirm-pulse 0.8s ease-in-out infinite;
}

@keyframes pet-confirm-pulse {
  0%, 100% { background: rgba(244, 67, 54, 0.2); }
  50% { background: rgba(244, 67, 54, 0.35); }
}

/* ============================================
   Equipment Row (future — summoned only)
   ============================================ */

.pet-equipment {
  display: none;
  font-size: 10px;
  color: var(--theme-text-secondary);
  padding: 2px 0;
  border-top: 1px solid var(--theme-border-secondary);
}

.pet-equipment.visible {
  display: block;
}

/* ============================================
   Effects Strip — Horizontal Buff/Debuff Icons
   ============================================ */

.pet-effects {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  min-height: 0;
}

.pet-effects:empty {
  display: none;
}

.pet-effect-icon {
  width: 18px;
  height: 18px;
  border-radius: 2px;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--theme-border-secondary);
  cursor: default;
}

.pet-effect-icon.buff {
  background: rgba(76, 175, 80, 0.1);
  border-color: rgba(76, 175, 80, 0.3);
  color: var(--theme-accent-green);
}

.pet-effect-icon.debuff {
  background: rgba(244, 67, 54, 0.1);
  border-color: rgba(244, 67, 54, 0.3);
  color: var(--theme-error);
}
