/*
 * 17-typing-hintblock.css
 * 힌트블럭(레고블럭) tab UI 스타일
 */

.typing-hintblock-container {
  padding: 16px;
  color: var(--color-text-primary);
  height: 100%;
  overflow-y: auto;
}

#pg-academy .typing-result-pane--hintblock.is-active,
body.typing-service-page .typing-result-pane--hintblock.is-active {
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
}

#pg-academy .typing-result-pane--hintblock .typing-hintblock-container,
body.typing-service-page .typing-result-pane--hintblock .typing-hintblock-container {
  flex: 1 1 auto;
  min-height: 0;
  padding-top: 16px !important;
  box-sizing: border-box;
}

.typing-hintblock-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.typing-hintblock-title {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text-primary);
}

.btn-reset {
  background: transparent;
  border: 1px solid var(--color-border-main);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: all 0.2s;
}
.btn-reset:hover {
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
}

.typing-hintblock-table {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hintblock-row {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  border-bottom: 1px dashed var(--color-border-main);
  padding-bottom: 16px;
}
.hintblock-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.hintblock-row-label {
  width: 94px;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-brand);
  padding-top: 6px;
  line-height: 1.35;
}

.hintblock-row-content {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  flex: 1;
}

/* ============================================================
   🧱 레고 큐브 블럭 — 입character용 직관 디자인
   - 높이 ~40px (기존 32px 대비 +25% 이내)
   - 좌측: 카테고리 큐브 이모지
   - 우측: 블럭 name(코드) + 한 줄 description
   - 상단 좌측: 레고 스터드(◦◦) 장식
   ============================================================ */
.typing-hintblock-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  min-width: 118px;
  max-width: 220px;
  padding: 5px 12px 5px 11px;
  border-radius: 8px;
  cursor: grab;
  user-select: none;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  user-drag: none;
  box-sizing: border-box;
  transition: transform 0.15s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;

  color: var(--hintblock-text-color, var(--color-text-primary));
  border: 1px solid rgba(var(--block-color, 34, 211, 238), 0.45);
  background:
    linear-gradient(135deg,
      rgba(var(--block-color, 34, 211, 238), 0.16) 0%,
      rgba(var(--block-color, 34, 211, 238), 0.06) 55%,
      rgba(var(--block-color, 34, 211, 238), 0.10) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 1px 0 rgba(0, 0, 0, 0.18),
    0 2px 5px rgba(0, 0, 0, 0.12);
}

/* 상단 좌측 레고 스터드 — 작은 두 점으로 "블럭" 정체성 부여 */
.typing-hintblock-item::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 9px;
  width: 18px;
  height: 4px;
  background:
    radial-gradient(circle at 3px 2px, rgba(var(--block-color, 34, 211, 238), 0.85) 0 1.6px, transparent 2px),
    radial-gradient(circle at 13px 2px, rgba(var(--block-color, 34, 211, 238), 0.85) 0 1.6px, transparent 2px);
  pointer-events: none;
  opacity: 0.65;
}

/* 우상단 미세한 광택 — 약간의 입체감 */
.typing-hintblock-item::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 38%;
  height: 50%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.10), transparent 70%);
  border-radius: 0 8px 0 12px;
  pointer-events: none;
}

.typing-hintblock-item:active {
  cursor: grabbing;
}

.typing-hintblock-item:hover {
  transform: translateY(-1px);
  border-color: rgba(var(--block-color, 34, 211, 238), 0.78);
  background:
    linear-gradient(135deg,
      rgba(var(--block-color, 34, 211, 238), 0.24) 0%,
      rgba(var(--block-color, 34, 211, 238), 0.10) 55%,
      rgba(var(--block-color, 34, 211, 238), 0.18) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 2px 0 rgba(0, 0, 0, 0.20),
    0 6px 14px rgba(var(--block-color, 34, 211, 238), 0.18);
}

/* 자식은 pointer 미점유 → mousedown은 부모가 받아 custom drag 동작 존 */
.typing-hintblock-item > .hintblock-cube,
.typing-hintblock-item > .hintblock-text,
.typing-hintblock-item .hintblock-name,
.typing-hintblock-item .hintblock-desc {
  pointer-events: none;
}

.hintblock-cube {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  font-size: 16px;
  line-height: 1;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}

.hintblock-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1 1 auto;
}

.hintblock-name {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--hintblock-text-color, var(--color-text-primary));
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hintblock-desc {
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.1;
  color: var(--hintblock-desc-color, var(--color-text-tertiary));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

[data-theme="dark"] .typing-hintblock-item {
  --hintblock-text-color: #f5f7fb;
  --hintblock-desc-color: rgba(226, 232, 240, 0.62);
}

[data-theme="light"] .typing-hintblock-item {
  --hintblock-text-color: #0f172a;
  --hintblock-desc-color: rgba(15, 23, 42, 0.58);
}

[data-theme="light"] .typing-hintblock-item {
  background:
    linear-gradient(135deg,
      rgba(var(--block-color, 34, 211, 238), 0.22) 0%,
      rgba(var(--block-color, 34, 211, 238), 0.08) 55%,
      rgba(var(--block-color, 34, 211, 238), 0.16) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 1px 0 rgba(15, 23, 42, 0.06),
    0 2px 5px rgba(15, 23, 42, 0.06);
}


/* drag 오버 Status 스타일 */
.typing-box--dragover-target {
  background-color: var(--color-bg-secondary) !important;
  box-shadow: inset 0 0 0 2px var(--color-brand) !important;
}

.typing-box--input.drag-over::after {
  content: "여기에 코드를 놓으세요";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--color-brand-rgb, 99, 102, 241), 0.1);
  color: var(--color-brand);
  font-size: 16px;
  font-weight: bold;
  border: 2px dashed var(--color-brand);
  z-index: 10;
  pointer-events: none;
}

.hintblock-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(17, 24, 39, 0.9);
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  z-index: 9999;
}

.hintblock-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
