/* ==========================================================================
   GM PANEL STYLES · VÕ LÂM IDLE
   ========================================================================== */

#gmModal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

#gmModal.hidden {
  display: none !important;
}

.gm-box {
  width: min(960px, 98vw);
  height: min(720px, 94vh);
  background: linear-gradient(180deg, #18221e 0%, #0d1412 100%);
  border: 2px solid #b8974a;
  border-radius: 10px;
  box-shadow: 0 0 35px rgba(0, 0, 0, 0.95), 0 0 15px rgba(184, 151, 74, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font, 'IBM Plex Mono', monospace);
  color: var(--text, #e9e2d0);
  box-sizing: border-box;
}

/* Header */
.gm-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: linear-gradient(180deg, #2a3830 0%, #17211d 100%);
  border-bottom: 1px solid #7d632f;
  flex-shrink: 0;
}

.gm-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.gm-title-icon {
  font-size: 18px;
}

.gm-title-text {
  font-size: 13.5px;
  font-weight: 700;
  color: #ffd700;
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gm-hotkey-hint {
  font-size: 11px;
  color: #a0b2a6;
  white-space: nowrap;
}

.gm-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.gm-bag-badge {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 12px;
  background: #0c120f;
  border: 1px solid #4a5f55;
  color: #ffd700;
  font-weight: 600;
}

.gm-bag-badge.full {
  background: #501010;
  border-color: #ff4444;
  color: #ffaaaa;
  animation: gmPulse 1s infinite;
}

@keyframes gmPulse {
  50% { opacity: 0.6; }
}

.gm-close-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #7d632f;
  background: #1a231f;
  color: #ffd700;
  font-size: 14px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.15s ease;
}

.gm-close-btn:hover {
  background: #7d2a1f;
  color: #fff;
  border-color: #e0402a;
}

/* Quick Bar */
.gm-quick-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #101714;
  border-bottom: 1px solid #283730;
  font-size: 11px;
  flex-shrink: 0;
}

.gm-qlabel {
  color: #e6c67a;
  font-weight: bold;
  margin-right: 2px;
}

.gm-qbtn {
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid #3c4f45;
  background: #17231e;
  color: #e9e2d0;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.gm-qbtn:hover {
  background: #2a3c34;
  border-color: #ffd700;
  color: #ffd700;
  box-shadow: 0 0 6px rgba(255, 215, 0, 0.2);
}

/* Filter Bar */
.gm-filter-bar {
  padding: 8px 12px;
  background: #131c18;
  border-bottom: 1px solid #283730;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.gm-type-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.gm-tab-btn {
  padding: 4px 12px;
  border-radius: 12px;
  border: 1px solid #3c4f45;
  background: #0d1411;
  color: #a0b2a6;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.gm-tab-btn.on {
  border-color: #ffd700;
  background: radial-gradient(#4d3a14, #1c1406);
  color: #fff48f;
  box-shadow: 0 0 6px rgba(255, 215, 0, 0.35);
}

.gm-filter-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.gm-ctrl-group {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #bbb;
}

.gm-ctrl-group select {
  padding: 4px 6px;
  border-radius: 4px;
  border: 1px solid #3c4f45;
  background: #0c120f;
  color: #ffd700;
  font-size: 11px;
  outline: none;
  cursor: pointer;
}

.gm-ctrl-group select:focus {
  border-color: #ffd700;
}

.gm-search-box {
  flex: 1;
  min-width: 180px;
  display: flex;
  align-items: center;
  position: relative;
}

.gm-search-box input {
  width: 100%;
  padding: 5px 26px 5px 8px;
  border-radius: 4px;
  border: 1px solid #3c4f45;
  background: #0c120f;
  color: #fff;
  font-size: 11px;
  outline: none;
  box-sizing: border-box;
}

.gm-search-box input:focus {
  border-color: #ffd700;
  box-shadow: 0 0 6px rgba(255, 215, 0, 0.25);
}

.gm-clear-btn {
  position: absolute;
  right: 6px;
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  font-size: 12px;
  padding: 0 4px;
}

.gm-clear-btn:hover {
  color: #fff;
}

/* Content & Grid */
.gm-content {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  background: #0b110f;
}

.gm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 8px;
}

.gm-card {
  border-radius: 6px;
  padding: 8px;
  background: linear-gradient(135deg, #17221d 0%, #101815 100%);
  border: 1px solid #283730;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  transition: transform 0.12s ease, border-color 0.12s ease;
  box-sizing: border-box;
}

.gm-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
}

.gm-card.gold {
  border-left: 3px solid #ffd700;
}

.gm-card.gold:hover {
  border-color: #ffd700;
}

.gm-card.plat {
  border-left: 3px solid #7fe3ff;
}

.gm-card.plat:hover {
  border-color: #7fe3ff;
}

.gm-card.horse {
  border-left: 3px solid #ffaa00;
  background: linear-gradient(135deg, #1c251a 0%, #101912 100%);
}

.gm-card.horse:hover {
  border-color: #ffaa00;
  box-shadow: 0 4px 12px rgba(255, 170, 0, 0.25);
}

.gm-card-body {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.gm-item-pic {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: #070a09;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid #3c4f45;
}

.gm-item-pic.gold {
  border-color: #8c7438;
}

.gm-item-pic.plat {
  border-color: #38788c;
}

.gm-item-pic.horse {
  border-color: #8c6a28;
  background: radial-gradient(#261d0f, #0d120a);
}

.gm-item-pic img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  image-rendering: pixelated;
}

.gm-item-details {
  flex: 1;
  min-width: 0;
}

.gm-item-title {
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.gm-item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 10px;
  margin-bottom: 2px;
}

.gm-tag {
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 9.5px;
  font-weight: 600;
}

.gm-tag.gold {
  background: #4a3812;
  color: #ffd700;
  border: 1px solid #7a5f22;
}

.gm-tag.plat {
  background: #143542;
  color: #7fe3ff;
  border: 1px solid #28647a;
}

.gm-tag.horse {
  background: #3b280a;
  color: #ffbb33;
  border: 1px solid #7a5416;
}

.gm-tag-slot, .gm-tag-lvl, .gm-tag-series {
  color: #98a397;
}

.gm-item-fac-name {
  font-size: 10px;
  color: #d6caaa;
}

.gm-card-footer {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  padding-top: 4px;
  border-top: 1px solid #1a2520;
}

.gm-btn-act {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}

.gm-btn-take {
  border: 1px solid #ffd700;
  background: #3a2e12;
  color: #ffd700;
}

.gm-btn-take:hover {
  background: #5c481a;
  color: #fff;
  box-shadow: 0 0 6px rgba(255, 215, 0, 0.4);
}

.gm-btn-all {
  border: 1px solid #3c4f45;
  background: #15201b;
  color: #ccc;
}

.gm-btn-all:hover {
  border-color: #7fe3ff;
  color: #7fe3ff;
  background: #1c2b24;
}

.gm-btn-horse {
  width: 100%;
  border: 1px solid #ffaa00;
  background: linear-gradient(180deg, #38270e 0%, #1a1205 100%);
  color: #ffcc44;
  text-align: center;
}

.gm-btn-horse:hover {
  background: linear-gradient(180deg, #523912 0%, #2b1d07 100%);
  color: #fff;
  box-shadow: 0 0 8px rgba(255, 170, 0, 0.45);
}

/* Footer & Pagination */
.gm-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 14px;
  background: #131c18;
  border-top: 1px solid #283730;
  font-size: 11px;
  flex-shrink: 0;
}

.gm-page-info {
  color: #98a397;
}

.gm-pagination {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gm-page-nav-btn {
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid #3c4f45;
  background: #17231e;
  color: #e9e2d0;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.gm-page-nav-btn:hover {
  border-color: #ffd700;
  color: #ffd700;
}

.gm-page-cur {
  color: #ffd700;
  font-weight: bold;
}

.gm-empty {
  grid-column: 1 / -1;
  padding: 40px;
  text-align: center;
  color: #888;
  font-style: italic;
}

/* Header Quick GM Button */
.top-gm-btn {
  flex: none;
  min-width: 44px;
  height: 28px;
  padding: 0 6px;
  border-radius: 14px;
  border: 1px solid #e67e22;
  background: radial-gradient(#3a2010, #140905);
  color: #f39c12;
  font-family: var(--font, monospace);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  transition: all .15s ease;
  user-select: none;
}

.top-gm-btn:hover {
  filter: brightness(1.25);
  box-shadow: 0 0 8px rgba(243, 156, 18, 0.5);
}

/* Mobile responsive */
@media (max-width: 600px) {
  .gm-grid {
    grid-template-columns: 1fr;
  }
  .gm-box {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }
}

/* Bottom Control GM Chip (next to speedChip) */
.chip.gm-chip {
  font-weight: 700;
  color: #ffb830 !important;
  border-color: #d35400 !important;
  background: radial-gradient(#3d2010, #160a05) !important;
  box-shadow: 0 0 6px rgba(211, 84, 0, 0.45);
  cursor: pointer;
  touch-action: manipulation;
  transition: all .15s ease;
}
.chip.gm-chip:hover {
  filter: brightness(1.3);
  box-shadow: 0 0 10px rgba(243, 156, 18, 0.7);
  color: #fff !important;
}

/* Top-right round button in UI 2.0 (next to u20mkt / Chợ) */
#u20gm {
  color: #ffd700 !important;
  border-color: #e67e22 !important;
  background: radial-gradient(#3a2010, #140905) !important;
  font-weight: 700;
  box-shadow: 0 0 6px rgba(230, 126, 34, 0.4);
  line-height: 1.15;
  cursor: pointer;
}
#u20gm:hover {
  filter: brightness(1.25);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.7);
  color: #fff !important;
}

/* ==========================================================================
   GM HOVER TOOLTIP PREVIEW
   ========================================================================== */
.gm-tooltip {
  position: fixed;
  z-index: 10002;
  pointer-events: none;
  min-width: 250px;
  max-width: 320px;
  background: rgba(13, 20, 18, 0.96);
  border: 1px solid #c9a44c;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.9), 0 0 14px rgba(201, 164, 76, 0.35);
  padding: 12px 14px;
  color: #e6dac3;
  font-family: var(--font, 'IBM Plex Mono', monospace);
  font-size: 13px;
  line-height: 1.4;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-sizing: border-box;
}

.gm-tooltip.hidden {
  display: none !important;
}

.gm-tooltip .idet {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(201, 164, 76, 0.25);
}

.gm-tooltip .idet .pic {
  width: 50px;
  height: 50px;
  border: 1px solid #4a5f55;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: #090e0c;
  flex-shrink: 0;
}

.gm-tooltip .idet .pic.r2 {
  border-color: #ffd700;
  box-shadow: 0 0 6px rgba(255, 215, 0, 0.3);
}

.gm-tooltip .idet .pic.r4 {
  border-color: #e67e22;
  box-shadow: 0 0 8px rgba(230, 126, 34, 0.4);
}

.gm-tooltip .idet .pic img {
  max-width: 88%;
  max-height: 88%;
  object-fit: contain;
}

.gm-tooltip .idet h4 {
  margin: 0 0 2px 0;
  font-size: 14px;
  font-weight: 700;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
}

.gm-tooltip .idet small.dim {
  color: #8fa096;
  font-size: 11.5px;
}

.gm-tooltip .sl {
  margin: 4px 0;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gm-tooltip .sl .b { color: #f0eae1; }
.gm-tooltip .sl .m { color: #8fb8ff; }
.gm-tooltip .sl .h { color: #516b94; }
.gm-tooltip .sl .h.on { color: #8fb8ff; }
.gm-tooltip .sl .r { color: #a49479; font-size: 11.5px; }

