/* D2R Item Tooltip Styles */

/* Tooltip trigger elements */
.d2-item,
.d2-skill,
.d2-runeword,
.d2-rune {
  cursor: help;
  border-bottom: 1px dotted currentColor;
  transition: color 0.2s;
}

.d2-item:hover,
.d2-skill:hover,
.d2-runeword:hover,
.d2-rune:hover {
  filter: brightness(1.2);
}

/* Item quality colors */
.d2-item.unique,
.d2-item[data-type="unique"] {
  color: #c7882e;
}

.d2-item.set,
.d2-item[data-type="set"] {
  color: #00ff00;
}

.d2-item.rare,
.d2-item[data-type="rare"] {
  color: #ffff00;
}

.d2-item.magic,
.d2-item[data-type="magic"] {
  color: #6495ed;
}

.d2-item.runeword,
.d2-runeword,
.d2-item[data-type="runeword"] {
  color: #c7b377;
}

.d2-rune,
.d2-item[data-type="rune"] {
  color: #ffa500;
}

.d2-skill {
  color: #87ceeb;
}

.d2-item.base,
.d2-item[data-type="base"] {
  color: #aaa;
}

/* Main tooltip container */
.d2-tooltip {
  position: fixed;
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease-in-out;
  max-width: 380px;
  min-width: 260px;
  font-family: 'Exocet', 'Cinzel', 'Times New Roman', serif;
}

.d2-tooltip.visible {
  opacity: 1;
}

/* Tooltip inner frame */
.d2-tooltip-inner {
  background: linear-gradient(180deg, #1a1a2e 0%, #0d0d1a 100%);
  border: 2px solid #4a3c28;
  border-radius: 4px;
  padding: 12px 16px;
  box-shadow: 
    0 0 20px rgba(0, 0, 0, 0.8),
    inset 0 0 30px rgba(0, 0, 0, 0.5),
    0 0 2px #8b7355;
  position: relative;
}

/* Decorative corners */
.d2-tooltip-inner::before,
.d2-tooltip-inner::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid #8b7355;
}

.d2-tooltip-inner::before {
  top: -2px;
  left: -2px;
  border-right: none;
  border-bottom: none;
}

.d2-tooltip-inner::after {
  bottom: -2px;
  right: -2px;
  border-left: none;
  border-top: none;
}

/* Item name header */
.d2-tooltip-name {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 4px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  line-height: 1.3;
}

/* Name colors by type */
.d2-tooltip-name.unique { color: #c7882e; }
.d2-tooltip-name.set { color: #00ff00; }
.d2-tooltip-name.rare { color: #ffff00; }
.d2-tooltip-name.magic { color: #6495ed; }
.d2-tooltip-name.runeword { color: #c7b377; }
.d2-tooltip-name.rune { color: #ffa500; }
.d2-tooltip-name.skill { color: #87ceeb; }
.d2-tooltip-name.base { color: #aaaaaa; }

/* Base item type */
.d2-tooltip-basetype {
  text-align: center;
  font-size: 0.9rem;
  color: #808080;
  margin-bottom: 8px;
  font-style: italic;
}

/* Set name */
.d2-tooltip-setname {
  text-align: center;
  font-size: 0.85rem;
  color: #00ff00;
  margin-bottom: 8px;
}

/* Rune formula */
.d2-tooltip-runes {
  text-align: center;
  font-size: 0.9rem;
  color: #ffa500;
  margin-bottom: 10px;
  padding: 6px 10px;
  background: rgba(255, 165, 0, 0.1);
  border-radius: 3px;
  border: 1px solid rgba(255, 165, 0, 0.3);
}

.d2-tooltip-runes span {
  color: #c7b377;
}

/* Divider line */
.d2-tooltip-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, #4a3c28, transparent);
  margin: 10px 0;
}

/* Requirements section */
.d2-tooltip-requirements {
  font-size: 0.85rem;
  color: #808080;
  margin-bottom: 8px;
  padding-left: 4px;
}

.d2-tooltip-requirements div {
  margin: 2px 0;
}

.d2-tooltip-requirements .met {
  color: #808080;
}

.d2-tooltip-requirements .unmet {
  color: #ff4444;
}

/* Stats list */
.d2-tooltip-stats {
  list-style: none;
  padding: 0;
  margin: 0;
}

.d2-tooltip-stats li {
  font-size: 0.9rem;
  color: #6495ed;
  margin: 4px 0;
  line-height: 1.4;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
}

/* Stat type coloring */
.d2-tooltip-stats li.enhanced {
  color: #6495ed;
}

.d2-tooltip-stats li.fire {
  color: #ff6347;
}

.d2-tooltip-stats li.cold {
  color: #87ceeb;
}

.d2-tooltip-stats li.lightning {
  color: #ffd700;
}

.d2-tooltip-stats li.poison {
  color: #32cd32;
}

.d2-tooltip-stats li.magic {
  color: #da70d6;
}

.d2-tooltip-stats li.physical {
  color: #d2b48c;
}

.d2-tooltip-stats li.life {
  color: #ff6347;
}

.d2-tooltip-stats li.mana {
  color: #6495ed;
}

.d2-tooltip-stats li.skill {
  color: #87ceeb;
}

.d2-tooltip-stats li.resist {
  color: #c7b377;
}

.d2-tooltip-stats li.mf {
  color: #c7b377;
}

/* Skill-specific styles */
.d2-tooltip-class {
  text-align: center;
  font-size: 0.85rem;
  color: #87ceeb;
  margin-bottom: 4px;
}

.d2-tooltip-tree {
  text-align: center;
  font-size: 0.8rem;
  color: #666;
  margin-bottom: 8px;
}

.d2-tooltip-description {
  font-size: 0.9rem;
  color: #c0c0c0;
  margin: 8px 0;
  line-height: 1.5;
  font-style: italic;
}

.d2-tooltip-synergies {
  font-size: 0.85rem;
  color: #999;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(74, 60, 40, 0.5);
}

.d2-tooltip-synergies strong {
  color: #87ceeb;
}

/* Set bonus section */
.d2-tooltip-setbonus {
  font-size: 0.85rem;
  color: #00aa00;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 255, 0, 0.2);
}

.d2-tooltip-setbonus strong {
  color: #00ff00;
}

/* Note/flavor text */
.d2-tooltip-note {
  font-size: 0.8rem;
  color: #888;
  margin-top: 8px;
  font-style: italic;
  text-align: center;
}

/* Sockets */
.d2-tooltip-sockets {
  text-align: center;
  font-size: 0.85rem;
  color: #808080;
  margin-top: 6px;
}

/* Rune stats (weapon/armor/shield) */
.d2-tooltip-runestats {
  margin-top: 10px;
}

.d2-tooltip-runestats div {
  font-size: 0.85rem;
  margin: 3px 0;
  padding: 4px 8px;
  background: rgba(255, 165, 0, 0.05);
  border-radius: 2px;
}

.d2-tooltip-runestats .label {
  color: #888;
}

.d2-tooltip-runestats .value {
  color: #6495ed;
}

/* Runewords list */
.d2-tooltip-runewords {
  font-size: 0.8rem;
  color: #666;
  margin-top: 8px;
  text-align: center;
}

.d2-tooltip-runewords strong {
  color: #c7b377;
}

/* Loading state */
.d2-tooltip-loading {
  text-align: center;
  padding: 20px;
  color: #666;
}

.d2-tooltip-loading::after {
  content: '...';
  animation: loading 1s infinite;
}

@keyframes loading {
  0%, 33% { content: '.'; }
  34%, 66% { content: '..'; }
  67%, 100% { content: '...'; }
}

/* Error state */
.d2-tooltip-error {
  text-align: center;
  padding: 15px;
  color: #ff4444;
  font-size: 0.9rem;
}

/* Arrow pointer (optional) */
.d2-tooltip-arrow {
  position: absolute;
  width: 0;
  height: 0;
  border: 8px solid transparent;
}

.d2-tooltip-arrow.top {
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-bottom-color: #4a3c28;
}

.d2-tooltip-arrow.bottom {
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-top-color: #4a3c28;
}

/* Mobile/Touch adjustments */
@media (max-width: 768px) {
  .d2-tooltip {
    max-width: calc(100vw - 20px);
    min-width: 200px;
  }
  
  .d2-tooltip-inner {
    padding: 10px 12px;
  }
  
  .d2-tooltip-name {
    font-size: 1rem;
  }
  
  .d2-tooltip-stats li {
    font-size: 0.85rem;
  }
}

/* Print styles - hide tooltips */
@media print {
  .d2-tooltip {
    display: none !important;
  }
  
  .d2-item,
  .d2-skill,
  .d2-runeword,
  .d2-rune {
    border-bottom: none;
  }
}
