/* ============================================
   Character Sheet Styles for OpenMUD
   Extracted from mockup: plans/mockups/character_sheet.html
   Uses theme variables from theme.css
   ============================================ */

/* Character sheet window positioning (uses .inventory-window class) */
#character-sheet-window {
  top: 80px;  /* Slightly above inventory (default) */
  left: 200px;  /* Slightly right of inventory (default) */
}

/* Dragging state for character sheet */
#character-sheet-window.window-dragging {
  transition: none !important;
  user-select: none;
}

/* Window header drag handle styling */
#character-sheet-window .window-header {
  cursor: move;
  user-select: none;
}

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

/* Override window-content to be vertical for character sheet */
#character-sheet-window .window-content {
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 0;
}

/* ============================================
   Character Sheet Specific Styles
   ============================================ */
.character-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: var(--theme-spacing-lg);
  border-bottom: 1px solid var(--theme-border-secondary);
  padding-bottom: var(--theme-spacing-sm);
  width: 100%;
}

.char-tab {
  padding: 8px 16px;
  background: var(--theme-bg-primary);
  border: 1px solid var(--theme-border-secondary);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  color: var(--theme-text-secondary);
  cursor: pointer;
  transition: all var(--theme-transition-speed);
  font-family: inherit;
  font-size: 14px;
  white-space: nowrap;
  flex-shrink: 0;
}

.char-tab:hover {
  background: var(--theme-bg-tertiary);
  color: var(--theme-text-primary);
}

.char-tab.active {
  background: var(--theme-bg-secondary);
  color: var(--theme-room-name);
  border-color: var(--theme-border-primary);
  border-bottom: 2px solid var(--theme-bg-secondary);
  margin-bottom: -1px;
}

.tab-content {
  display: none;
  flex-direction: column;
  gap: var(--theme-spacing-lg);
  width: 100%;
}

.tab-content.active {
  display: flex;
  width: 100%;
}

/* ============================================
   Attributes Styles
   ============================================ */
.attributes-list {
  display: flex;
  flex-direction: column;
  gap: var(--theme-spacing-sm);
}

.attribute-item {
  display: flex;
  align-items: center;
  gap: var(--theme-spacing-md);
  padding: var(--theme-spacing-sm);
  background: var(--theme-bg-secondary);
  border-radius: 3px;
  transition: background var(--theme-transition-speed);
  cursor: help;
}

.attribute-item:hover {
  background: var(--theme-bg-tertiary);
}

.attr-name {
  flex: 1;
  color: var(--theme-text-secondary);
  font-size: 14px;
}

.attr-value {
  color: var(--theme-exit-color);
  font-weight: bold;
  font-size: 16px;
  min-width: 40px;
  text-align: right;
}

/* ============================================
   Points Available Section (from components.css)
   ============================================ */
.points-available-section {
  background: var(--theme-bg-tertiary);
  border: 1px solid var(--theme-accent-green);
  border-radius: 3px;
  padding: 10px;
  margin: 0;
  animation: pulse-border 2s ease-in-out infinite;
  text-align: center;
}

@keyframes pulse-border {
  0%, 100% {
    border-color: var(--theme-accent-green);
  }
  50% {
    border-color: var(--theme-accent-green-hover);
  }
}

.points-available-section p {
  margin: 0;
  color: var(--theme-accent-green);
  font-weight: bold;
  font-size: 15px;
}

#attr-points-remaining, #skill-points-remaining {
  font-size: 18px;
}

/* ============================================
   Stat Rows (from components.css)
   ============================================ */
.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--theme-border-secondary);
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-label {
  color: var(--theme-text-secondary);
}

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

/* ============================================
   Skills Styles
   ============================================ */
.skills-list {
  display: flex;
  flex-direction: column;
  gap: var(--theme-spacing-md);
}

.skill-item {
  padding: var(--theme-spacing-sm);
  background: var(--theme-bg-secondary);
  border-radius: 3px;
  display: block; /* Force block to prevent flex inheritance */
}

/* Unlearned skills styling */
.skill-item.unlearned,
.ability-item.unlearned {
  opacity: 0.6;
  font-style: italic;
}

/* Search and toggle controls */
.skill-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skill-filter-input {
  width: 100%;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--theme-border-primary);
  color: var(--theme-text-primary);
  border-radius: 4px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color var(--theme-transition-speed);
}

.skill-filter-input:focus {
  border-color: var(--theme-room-name);
}

.skill-filter-input::placeholder {
  color: var(--theme-text-muted);
  opacity: 0.7;
}

.skill-toggle-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  color: var(--theme-text-secondary);
  font-size: 13px;
  padding: 4px 0;
  gap: 8px;
}

.skill-toggle-label:hover {
  color: var(--theme-text-primary);
}

.skill-toggle-label input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
  margin: 0;
}

.skill-toggle-label span {
  flex: 1;
}

.skill-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.skill-name {
  color: var(--theme-text-secondary);
  font-size: 13px;
  font-weight: 500;
}

.skill-rank {
  color: var(--theme-exit-color);
  font-size: 12px;
  font-weight: bold;
}

.skill-progress {
  height: 16px;
  background: var(--theme-bg-primary);
  border: 1px solid var(--theme-border-secondary);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
  margin-bottom: 4px;
}

.skill-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--theme-success), var(--theme-room-name));
  transition: width var(--theme-transition-speed);
}

/* XP bar in Character tab uses experience color */
#char-tab-character .skill-progress-fill {
  background: var(--theme-exp);
}

.skill-progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  color: white;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

.skill-tier {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  text-transform: uppercase;
  font-weight: bold;
}

.skill-tier.novice {
  background: rgba(102, 102, 102, 0.3);
  color: var(--theme-text-secondary);
}

.skill-tier.apprentice {
  background: rgba(76, 175, 80, 0.2);
  color: var(--theme-accent-green);
}

.skill-tier.journeyman {
  background: rgba(33, 150, 243, 0.2);
  color: var(--theme-info);
}

.skill-tier.expert {
  background: rgba(156, 39, 176, 0.2);
  color: #9c27b0;
}

.skill-tier.master {
  background: rgba(255, 193, 7, 0.2);
  color: var(--theme-warning);
}

/* ============================================
   Ability Styles
   ============================================ */
.ability-item {
  padding: var(--theme-spacing-sm);
  background: var(--theme-bg-secondary);
  border-radius: 3px;
  margin-bottom: 8px;
}

.ability-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.ability-name {
  color: var(--theme-room-name);
  font-size: 13px;
  font-weight: bold;
}

.ability-type {
  color: var(--theme-text-muted);
  font-size: 11px;
  font-style: italic;
}

.ability-cooldown {
  color: var(--theme-warning);
  font-size: 11px;
}

.ability-cooldown.ready {
  color: var(--theme-success);
}

.ability-desc {
  color: var(--theme-text-secondary);
  font-size: 12px;
  margin-top: 4px;
}

/* ============================================
   Resistance Styles
   ============================================ */
.resistance-item {
  display: flex;
  justify-content: space-between;
  padding: var(--theme-spacing-sm);
  background: var(--theme-bg-secondary);
  border-radius: 3px;
  font-size: 14px;
  margin-bottom: 6px;
}

.resistance-label {
  color: var(--theme-text-secondary);
}

.resistance-value {
  color: var(--theme-success);
  font-weight: bold;
}

.resistance-value.negative {
  color: var(--theme-error);
}

.resistance-source {
  font-size: 11px;
  color: var(--theme-text-muted);
  margin-left: 8px;
}

/* ============================================
   Helper Text
   ============================================ */
.help-text {
  color: var(--theme-text-secondary);
  font-size: 12px;
  font-style: italic;
  text-align: center;
  margin-top: var(--theme-spacing-md);
  padding-top: var(--theme-spacing-md);
  border-top: 1px solid var(--theme-border-secondary);
}

/* ============================================
   Tooltip Styles
   ============================================ */
.tooltip {
  position: fixed;
  background: var(--theme-bg-primary);
  border: 2px solid var(--theme-border-primary);
  border-radius: 4px;
  padding: 12px;
  color: var(--theme-text-primary);
  font-size: 12px;
  line-height: 1.5;
  z-index: 10000;
  pointer-events: none;
  display: none;
  max-width: 300px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.tooltip.visible {
  display: block;
}

.tooltip-header {
  color: var(--theme-room-name);
  font-weight: bold;
  font-size: 14px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--theme-border-secondary);
  padding-bottom: 4px;
}

.tooltip-section {
  margin: 6px 0;
  color: var(--theme-text-secondary);
  display: flex;
  flex-direction: column;
}

.tooltip-label {
  color: var(--theme-text-muted);
}

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

/* ============================================
   Effects List - Detailed View (Option 2)
   ============================================ */
.effects-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 0;
}

.effect-item {
  display: grid;
  grid-template-columns: 50px 1fr auto;
  gap: 12px;
  padding: 12px;
  background: var(--theme-bg-tertiary);
  border: 1px solid var(--theme-border);
  border-radius: 6px;
  align-items: center;
  transition: all 0.2s ease;
}

.effect-item:hover {
  background: var(--theme-bg-secondary);
  border-color: var(--theme-accent-primary);
}

.effect-item.buff {
  border-left: 3px solid var(--theme-success);
}

.effect-item.debuff {
  border-left: 3px solid var(--theme-danger);
}

.effect-item.other {
  border-left: 3px solid var(--theme-accent-primary);
}

.effect-icon-large {
  font-size: 36px;
  text-align: center;
  line-height: 1;
}

.effect-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.effect-name {
  font-size: 14px;
  font-weight: bold;
  color: var(--theme-text-primary);
}

.effect-description {
  font-size: 12px;
  color: var(--theme-text-secondary);
  line-height: 1.4;
}

.effect-modifiers {
  font-size: 11px;
  color: var(--theme-success);
  margin-top: 2px;
  font-weight: 500;
}

.effect-modifiers.negative {
  color: var(--theme-danger);
}

.effect-time-display {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 100px;
}

.effect-time-remaining {
  font-size: 16px;
  font-weight: bold;
  color: var(--theme-accent-primary);
  font-family: 'Courier New', monospace;
}

.effect-time-label {
  font-size: 10px;
  color: var(--theme-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.effect-progress-bar {
  width: 100px;
  height: 6px;
  background: rgba(0, 0, 0, 0.5); /* Dark background for empty portion */
  border: 1px solid var(--theme-border); /* Visible border */
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}

.effect-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--theme-success), var(--theme-room-name));
  transition: width 0.3s ease;
  border-radius: 2px; /* Slight rounding to match container */
}

.effect-progress-fill.expiring {
  background: linear-gradient(90deg, var(--theme-danger), var(--theme-warning));
}

.permanent-badge {
  display: inline-block;
  padding: 2px 6px;
  background: var(--theme-warning);
  color: var(--theme-bg-primary);
  font-size: 10px;
  font-weight: bold;
  border-radius: 3px;
  text-transform: uppercase;
  margin-left: 6px;
}

/* ============================================
   Custom Modal/Popup
   ============================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20000;
  backdrop-filter: blur(2px);
}

.modal-overlay.visible {
  display: flex;
}

.modal-content {
  background: var(--theme-bg-secondary);
  border: 2px solid var(--theme-border-primary);
  border-radius: 4px;
  padding: 20px;
  max-width: 400px;
  min-width: 300px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.9);
  animation: modal-appear 0.2s ease-out;
}

@keyframes modal-appear {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-header {
  color: var(--theme-room-name);
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 12px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--theme-border-secondary);
  padding-bottom: 8px;
}

.modal-body {
  color: var(--theme-text-primary);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 16px;
}

.modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.modal-btn {
  padding: 8px 20px;
  background: var(--theme-bg-primary);
  border: 1px solid var(--theme-border-secondary);
  border-radius: 4px;
  color: var(--theme-text-primary);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: all 0.2s;
  font-weight: bold;
}

.modal-btn:hover {
  background: var(--theme-bg-tertiary);
  border-color: var(--theme-border-highlight);
  transform: translateY(-1px);
}

.modal-btn.primary {
  border-color: var(--theme-accent-green);
  color: var(--theme-accent-green);
}

.modal-btn.primary:hover {
  background: rgba(76, 175, 80, 0.2);
}
