@import url("https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;600;700&display=swap");

/* Tooltip Container Positioning */
.tooltip-box-container {
  position: fixed; /* ikut layar, bukan parent */
  top: 0;
  left: 0;
  transform: none; /* jangan pakai translateX(-50%) lagi */
  z-index: 9999;
  display: none;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.15s ease-in-out;
}

.tooltip-box-container[style*="display: block"] {
  visibility: visible !important;
  opacity: 1 !important;
}

.tooltip-trigger {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.tooltip-trigger:hover .tooltip-box-container {
  display: block;
  visibility: visible;
  opacity: 1;
}

/* Ensure tooltip content is properly positioned */
.tooltip-box-container .tooltip-box {
  max-height: 90vh;
  overflow-y: auto;
  position: relative; /* biar ikut container */
  max-width: 380px; /* jangan fixed 400px */
  white-space: normal !important;
  word-break: break-word !important;
  background: linear-gradient(180deg, #0a0c12, #0f141c);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 18px;
  color: #e6e6e6;
  font-family: "Rajdhani", sans-serif;
  font-size: 15px;
  z-index: 9999;
  box-shadow: 0 0 35px rgba(0, 0, 0, 0.7);
  /* ⬇️ Fix supaya nama panjang tidak keluar box */
  white-space: normal !important;
  word-break: break-word !important;
}

.tooltip-box-container::before,
.tooltip-box-container::after {
  display: none !important;
  content: none !important;
}

/* Tooltip arrow */
.tooltip-box-container::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid #0a0c12;
}

.tooltip-box-container::after {
  content: "";
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid rgba(255, 255, 255, 0.08);
}

/* Default style */
.tooltip-box {
  /* position: absolute; */
  display: block;
  width: 400px;
  background: linear-gradient(180deg, #0a0c12, #0f141c);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 18px;
  color: #e6e6e6;
  font-family: "Rajdhani", sans-serif;
  font-size: 15px;
  z-index: 9999;
  box-shadow: 0 0 35px rgba(0, 0, 0, 0.7);
}

/* === Grade Borders/Glows === */
.tooltip-box.grade-0,
.tooltip-box.border-grade-0 {
  border-color: #ffffff;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
}
.tooltip-box.grade-1,
.tooltip-box.border-grade-1 {
  border-color: #ffff00;
  box-shadow: 0 0 20px rgba(255, 255, 0, 0.4);
}
.tooltip-box.grade-2,
.tooltip-box.border-grade-2 {
  border-color: #800080;
  box-shadow: 0 0 20px rgba(128, 0, 128, 0.4);
}
.tooltip-box.grade-3,
.tooltip-box.border-grade-3 {
  border-color: #ffa500;
  box-shadow: 0 0 20px rgba(255, 165, 0, 0.4);
}
.tooltip-box.grade-4,
.tooltip-box.border-grade-4 {
  border-color: #0000ff;
  box-shadow: 0 0 20px rgba(0, 0, 255, 0.4);
}
.tooltip-box.grade-5,
.tooltip-box.border-grade-5 {
  border-color: #ffc0cb;
  box-shadow: 0 0 20px rgba(255, 192, 203, 0.4);
}
.tooltip-box.grade-6,
.tooltip-box.border-grade-6 {
  border-color: #add8e6;
  box-shadow: 0 0 20px rgba(173, 216, 230, 0.4);
}
.tooltip-box.grade-7,
.tooltip-box.border-grade-7 {
  border-color: #008000;
  box-shadow: 0 0 20px rgba(0, 128, 0, 0.4);
}
.tooltip-box.grade-8,
.tooltip-box.border-grade-8 {
  border-color: #008000;
  box-shadow: 0 0 20px rgba(0, 128, 0, 0.4);
}
.tooltip-box.grade-9,
.tooltip-box.border-grade-9 {
  border-color: #ff9208;
  box-shadow: 0 0 20px rgba(255, 146, 8, 0.4);
}
.tooltip-box.grade-10,
.tooltip-box.border-grade-10 {
  border-color: #ff0000;
  box-shadow: 0 0 20px rgba(255, 0, 0, 0.4);
}

.tooltip-trigger {
  position: relative;
  display: inline-block;
  cursor: url("https://i.imgur.com/eN4c1uC.png"), auto;
  color: #ffcc85;
  font-weight: bold;
}

/* === Header === */
.tooltip-header {
  display: flex;
  align-items: flex-start;
  margin-bottom: 14px;
  gap: 14px;
}
.tooltip-subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: #ffda73;
  font-weight: 600;
}
.tooltip-img {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
}
.tooltip-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  color: #7cff5b;
  text-shadow: 0 0 12px rgba(60, 255, 134, 0.8);
  /* ⬇️ tambahan supaya aman */
  overflow-wrap: break-word;
  word-break: break-word;
}
.tooltip-tags {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap; /* biar otomatis turun ke bawah kalau kepanjangan */
  gap: 4px;
  align-items: center;
}

.tag-upgrades img {
  width: 18px;
  height: 18px;
  margin-left: 2px;
  display: inline-block;
  vertical-align: middle;
}

.tag-upgrades {
  display: flex;
  flex-wrap: wrap; /* otomatis turun kalau terlalu banyak */
  gap: 2px;
}

.tag {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  margin-right: 4px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.tag.blue {
  background: #007bff;
  color: #fff;
}
.tag.green {
  background: #28a745;
  color: #fff;
}
.tag.purple {
  background: #6f42c1;
  color: #fff;
}
.tag.white {
  background: #ffffff;
  color: #000000;
}

/* === Trade row === */
.tooltip-trade {
  margin-top: 6px;
  font-size: 13px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.trade.ok {
  color: #00e676;
}
.trade.no {
  color: #ff5252;
}

/* === Body Stats === */
.tooltip-body {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  padding: 12px;
}
.tooltip-stats {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  padding: 12px;
  margin-top: 12px;
}
.stat {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}
.stat span:first-child {
  color: #6bb7ff;
}
.stat .highlight {
  color: #3cff86;
  font-weight: 700;
}

/* === Section Titles === */
.section {
  margin-top: 12px;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 14px;
  color: #ffda73;
  border-bottom: 1px solid rgba(255, 218, 115, 0.2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-bottom: 2px;

  text-align: left !important; /* ⬅️ Tambahin ini */
}

/* === Effects === */
.effects {
  list-style: none;
  padding-left: 12px;
}
.effects li {
  margin: 2px 0;
  color: #d6eaff;
  position: relative;
}
.effects li::before {
  content: "▶";
  font-size: 10px;
  color: #ffda73;
  position: absolute;
  left: -12px;
  top: 2px;
}

/* === Upgrade === */
.upgrade-icons img {
  width: 14px;
  margin-right: 2px;
}
.upgrade-icons {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.upgrade-text {
  display: block; /* biar selalu di bawah icon */
  text-align: left; /* bisa diganti center kalau mau rata tengah */
  margin-top: 6px; /* jarak dari ikon */
  color: #7cff5b;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.5px;
  text-shadow: 0 0 6px #28a745, 0 0 12px #28a745;
}

/* === Socket Information === */
.socket-info {
  margin-top: 12px;
}
.socket-title {
  font-weight: 600;
  font-size: 14px;
  color: #6bb7ff;
  margin-bottom: 6px;
}
.socket-slot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.socket-slot img {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
}
.socket-text {
  font-size: 14px;
  color: #ccc;
}
.socket-empty {
  color: #ff7575;
  font-weight: 600;
}
.socket-gem {
  color: #7cff5b;
  font-weight: 600;
}
/* Pastikan section selalu rata kiri */
.tooltip-body .section,
.tooltip-stats .section,
.tooltip-body .effects,
.tooltip-stats .effects,
.tooltip-body .upgrade-icons,
.tooltip-stats .upgrade-icons,
.tooltip-body .upgrade-text,
.tooltip-stats .upgrade-text {
  text-align: left !important;
  justify-content: flex-start !important;
}
.set-icons {
  display: flex;
  gap: 4px; /* kasih jarak antar icon */
  margin: 4px 0; /* kasih jarak atas-bawah */
}
.set-icons img {
  width: 32px;
  height: 32px;
  border: 1px solid #0f0; /* atau sesuai tema */
}

.tooltip-trigger {
  position: relative;
  display: inline-block;
}

.tooltip-box-container {
  position: absolute;
  top: 0;
  left: 0;
  transform: translate(var(--mouse-x, 20px), var(--mouse-y, 20px));
  pointer-events: none; /* biar ga ganggu klik */
  transition: opacity 0.15s ease-in-out;
  opacity: 0;
}

.tooltip-trigger:hover .tooltip-box-container {
  opacity: 1;
}
