/* =============================================================================
   FREEEXILE: MODERN ARPG SKILL BAR & COOLDOWN SWEEPS
   Stylesheet: hud_skills.css (Native CSS, Strict Line Cap <= 350 lines)
   PoE2 Grimdark Aesthetics, 120 FPS Radial Sweeps & Tactile Press States
   ============================================================================= */

/* --- SKILL BAR DOCKED CONTAINER --- */
.hud-skill-bar {
  position: absolute;
  right: 14px;
  bottom: 12px;
  z-index: 25;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 18px;
  background: rgba(5, 5, 8, 0.72);
  border: 1px solid rgba(82, 82, 91, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
}

/* Grouping Dividers for Action Categorization */
.hud-skill-divider {
  width: 1px;
  height: 28px;
  align-self: center;
  background: linear-gradient(180deg, transparent, rgba(120, 113, 108, 0.4), transparent);
}

/* --- INDIVIDUAL SKILL SLOT BASE --- */
.skill-slot {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(120, 113, 108, 0.45);
  background: radial-gradient(circle at 35% 25%, #27272a 0%, #09090b 70%, #000000 100%);
  color: #e4e4e7;
  cursor: pointer;
  outline: none;
  touch-action: manipulation;
  transition: transform 0.08s ease-out, border-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.75), inset 0 1px 2px rgba(255, 255, 255, 0.12);
}

/* Tactile Hover & Press States */
.skill-slot:hover {
  border-color: rgba(217, 119, 6, 0.75);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.85), 0 0 10px rgba(217, 119, 6, 0.35);
}

.skill-slot:active,
.skill-slot.is-pressed {
  transform: scale(0.92);
  border-color: rgba(245, 158, 11, 0.95);
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.95), 0 0 12px rgba(245, 158, 11, 0.45);
  filter: brightness(0.92);
}

/* --- SLOT SIZING SPECIALIZATIONS --- */
/* Primary Attack Slot (Slot 0, LMB) */
.skill-slot-primary {
  width: 52px;
  height: 52px;
  border-color: rgba(217, 119, 6, 0.65);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.85), 0 0 8px rgba(217, 119, 6, 0.25);
}

/* Dodge Roll Slot (Space / Evasion) */
.skill-slot-dodge {
  width: 50px;
  height: 50px;
  border-color: rgba(168, 85, 247, 0.55);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.85), 0 0 8px rgba(168, 85, 247, 0.25);
}

/* Flask / Potion Slot (Key 4) */
.skill-slot-flask {
  width: 38px;
  height: 38px;
  border-color: rgba(220, 38, 38, 0.55);
  border-radius: 12px;
}

/* --- ICON CONTAINER & SPRITE ATLAS RENDERING --- */
.skill-icon-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.skill-icon {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
}

/* Canonical Martial Skills Atlas Sprite Rendering */
.skill-icon.icon-atlas {
  background-image: url('../assets/skills/martial_skills_atlas.png');
  background-size: 400% 400%;
  background-repeat: no-repeat;
  background-position: calc(var(--atlas-col, 0) * 33.3333%) calc(var(--atlas-row, 0) * 33.3333%);
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* Default SVG Icon Colors */
.skill-icon svg {
  width: 54%;
  height: 54%;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8));
  transition: transform 0.15s ease;
}

.skill-slot:hover .skill-icon svg {
  transform: scale(1.08);
}

/* --- 360° CLOCKWISE RADIAL COOLDOWN SWEEP OVERLAY --- */
.cooldown-overlay {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Luminous golden sweep edge + dark radial backdrop */
  background: conic-gradient(
    from 0deg at 50% 50%,
    transparent 0deg,
    transparent calc(var(--cooldown-sweep, 0deg) - 2deg),
    rgba(251, 191, 36, 0.85) calc(var(--cooldown-sweep, 0deg) - 1deg),
    rgba(251, 191, 36, 0.95) var(--cooldown-sweep, 0deg),
    rgba(5, 5, 8, 0.82) var(--cooldown-sweep, 0deg) 360deg
  );
  transition: opacity 0.12s ease;
  z-index: 5;
}

.skill-slot.is-on-cooldown .cooldown-overlay {
  opacity: 1;
  visibility: visible;
}

/* Remaining Seconds Numeric Countdown */
.cooldown-counter {
  font-family: 'Cinzel', 'Noto Serif', monospace;
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 4px #000000, 0 0 8px rgba(0, 0, 0, 0.95), 0 0 2px #000000;
  letter-spacing: -0.02em;
  z-index: 6;
  pointer-events: none;
}

/* --- KEYBINDING & CHARGE BADGES --- */
.skill-keybind-badge {
  position: absolute;
  bottom: -3px;
  right: -3px;
  z-index: 10;
  padding: 1px 4px;
  min-width: 14px;
  border-radius: 4px;
  background: rgba(9, 9, 11, 0.95);
  border: 1px solid rgba(120, 113, 108, 0.55);
  color: #fbbf24;
  font-family: monospace;
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

.skill-charges-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  z-index: 10;
  padding: 1px 4px;
  min-width: 14px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.9);
  border: 1px solid rgba(5, 150, 105, 0.8);
  color: #ffffff;
  font-family: monospace;
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  transition: background 0.15s ease;
}

.skill-charges-badge.is-depleted {
  background: rgba(220, 38, 38, 0.9);
  border-color: rgba(185, 28, 28, 0.8);
}

/* --- 0.25S LUMINOUS READY FLASH PULSE --- */
.skill-slot.is-ready-pulse {
  animation: skill-ready-pulse 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes skill-ready-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.95), inset 0 0 16px rgba(251, 191, 36, 0.9);
    filter: brightness(1.75);
    transform: scale(1.08);
  }
  50% {
    box-shadow: 0 0 20px 4px rgba(251, 191, 36, 0.65), inset 0 0 8px rgba(251, 191, 36, 0.5);
    filter: brightness(1.35);
    transform: scale(1.04);
  }
  100% {
    box-shadow: 0 0 0 0 transparent, inset 0 0 0 transparent;
    filter: brightness(1);
    transform: scale(1);
  }
}

/* Expanding Outer Emitter Ring */
.ready-flash-emitter {
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  border: 2px solid transparent;
  pointer-events: none;
  opacity: 0;
  z-index: 4;
}

.skill-slot.is-ready-pulse .ready-flash-emitter {
  animation: ready-emitter-wave 0.25s ease-out forwards;
}

@keyframes ready-emitter-wave {
  0% {
    opacity: 1;
    transform: scale(0.85);
    border-color: rgba(251, 191, 36, 1);
  }
  100% {
    opacity: 0;
    transform: scale(1.35);
    border-color: rgba(251, 191, 36, 0);
  }
}

/* --- TACTILE BLOCKED ERROR SHAKE --- */
.skill-slot.is-cooldown-blocked {
  animation: skill-blocked-shake 0.18s ease-in-out;
  border-color: #ef4444 !important;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.85) !important;
}

@keyframes skill-blocked-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px) scale(0.96); }
  75% { transform: translateX(3px) scale(0.96); }
}

/* --- MOBILE ERGONOMIC & HIGH-DENSITY CLUSTER ADAPTATION --- */
@media (max-width: 768px) {
  .hud-skill-bar {
    right: 8px;
    bottom: 8px;
    gap: 6px;
    padding: 4px 6px;
  }
  .skill-slot {
    width: 40px;
    height: 40px;
  }
  .skill-slot-primary {
    width: 48px;
    height: 48px;
  }
  .skill-slot-dodge {
    width: 46px;
    height: 46px;
  }
  .skill-slot-flask {
    width: 34px;
    height: 34px;
  }
  .cooldown-counter {
    font-size: 11px;
  }
}
