/* ============================================================
   Contextual Help System — ระบบช่วยเหลือแบบกดอ่าน
   ============================================================ */

.ctx-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
  color: #67e8f9;
  font-size: .65rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  margin-left: 5px;
  vertical-align: middle;
  transition: all .2s ease;
  position: relative;
  flex-shrink: 0;
  line-height: 1;
  font-style: normal;
}

.ctx-help:hover {
  background: #333;
  border-color: #67e8f9;
  color: #fff;
  transform: scale(1.15);
}

.ctx-help.active {
  background: #67e8f9;
  color: #121212;
  border-color: #67e8f9;
}

/* Popup */
.ctx-popup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 9998;
  animation: ctxFadeIn .15s ease;
}

.ctx-popup-overlay.show { display: block; }

.ctx-popup {
  display: none;
  position: fixed;
  z-index: 9999;
  width: 320px;
  max-width: 92vw;
  max-height: 70vh;
  background: #1e1e1e;
  border: 1px solid #3a3a3a;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,.6);
  overflow: hidden;
  animation: ctxSlideIn .2s ease;
}

.ctx-popup.show { display: flex; flex-direction: column; }

.ctx-popup-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: #252525;
  border-bottom: 1px solid #3a3a3a;
  flex-shrink: 0;
}

.ctx-popup-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.ctx-popup-title {
  font-size: .85rem;
  font-weight: 600;
  color: #67e8f9;
  flex: 1;
  line-height: 1.3;
}

.ctx-popup-close {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #3a3a3a;
  border: none;
  color: #9ca3af;
  font-size: .8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .15s;
}

.ctx-popup-close:hover {
  background: #ef4444;
  color: #fff;
}

.ctx-popup-body {
  padding: 14px;
  overflow-y: auto;
  flex: 1;
}

.ctx-popup-desc {
  font-size: .78rem;
  color: #e0e0e0;
  line-height: 1.6;
  margin-bottom: 10px;
}

.ctx-popup-section {
  margin-bottom: 10px;
}

.ctx-popup-section-title {
  font-size: .7rem;
  font-weight: 600;
  color: #a78bfa;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.ctx-popup-related {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ctx-popup-related li {
  font-size: .75rem;
  color: #d1d5db;
  padding: 3px 0 3px 16px;
  position: relative;
  line-height: 1.5;
}

.ctx-popup-related li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: #facc15;
}

.ctx-popup-warning {
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(250,204,21,.08);
  border: 1px solid rgba(250,204,21,.2);
  border-radius: 6px;
  font-size: .72rem;
  color: #facc15;
  line-height: 1.5;
}

.ctx-popup-warning::before {
  content: '⚠️ ';
}

/* Animations */
@keyframes ctxFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ctxSlideIn {
  from { opacity: 0; transform: translateY(-8px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Responsive */
@media (max-width: 480px) {
  .ctx-popup {
    width: 92vw;
    left: 4vw !important;
    right: 4vw !important;
  }
  .ctx-help {
    width: 20px;
    height: 20px;
    font-size: .7rem;
  }
}
