/* =========================================
   TECHPROIQ BLOCKCODER — FULL STYLE SHEET
   ========================================= */

/* --- Workspace (Vertical Code Layout) --- */
#tpiqbc-dropzone {
  min-height: 550px;
  width: 100%;
  border: 2px dashed #4b5563;
  padding: 20px 24px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;       /* vertical stacking */
  align-items: flex-start;      /* align to left */
  gap: 6px;
  font-family: monospace;
  overflow-y: auto;
  transition: all 0.2s ease-in-out;
}

/* --- Code Line Blocks (in Workspace) --- */
#tpiqbc-dropzone .block {
  display: inline-block;
  width: auto;
  background: #111827;
  border: none;
  border-left: 4px solid #3b82f6; /* blue vertical line */
  color: #f3f4f6;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.95rem;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
  transition: background 0.15s ease, transform 0.15s ease;
}

#tpiqbc-dropzone .block:hover {
  background: #1e293b;
  transform: translateX(4px);
}

/* --- Dragging Feedback --- */
.block.dragging {
  opacity: 0.6;
  transform: scale(1.05);
  cursor: grabbing;
}

/* --- Workspace Scrollbar Styling --- */
#tpiqbc-dropzone::-webkit-scrollbar {
  width: 8px;
}
#tpiqbc-dropzone::-webkit-scrollbar-thumb {
  background: #374151;
  border-radius: 6px;
}
#tpiqbc-dropzone::-webkit-scrollbar-thumb:hover {
  background: #4b5563;
}

/* =========================================
   PALETTE (Block Library)
   ========================================= */
#tpiqbc-palette-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 600px;
  overflow-y: auto;
  margin-bottom: 10px;
}

.tpiqbc-blocklist .block {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #13222a;
  border: 1px solid #29424a;
  border-radius: 10px;
  padding: 6px 10px;
  font-family: monospace;
  font-size: 0.92rem;
  color: #e6f1f0;
  cursor: grab;
  user-select: none;
  transition: transform 0.15s ease, background 0.2s ease;
}

.tpiqbc-blocklist .block:hover {
  background: #20323a;
  transform: scale(1.05);
}

/* --- Category Outlines (Visual Tag Types) --- */
.block[data-category="structure"] { outline: 1px dashed #285b68; }
.block[data-category="content"]   { outline: 1px dashed #5b284a; }
.block[data-category="meta"]      { outline: 1px dashed #4a5b28; }
.block[data-category="style"]     { outline: 1px dashed #285b2a; }
.block[data-category="script"]    { outline: 1px dashed #5b4f28; }

/* =========================================
   PREVIEW + OUTPUT  (UPDATED ✅)
   ========================================= */
.tpiqbc-preview iframe {
  width: 100%;
  height: 260px;
  border: 1px solid #2a3b44;
  border-radius: 10px;

  /* ✅ Changed: white background + black text */
  background: #ffffff !important;
  color: #000000 !important;
}

/* ✅ Ensure iframe content (student HTML) always appears readable */
.tpiqbc-preview iframe html,
.tpiqbc-preview iframe body {
  background: #ffffff !important;
  color: #000000 !important;
}

#tpiqbc-code {
  font-family: monospace;
  white-space: pre;
  line-height: 1.6;
  font-size: 0.9rem;
  color: #cbd5e1;
  background: #0b0f14;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #20323a;
  overflow-x: auto;
}

/* =========================================
   GENERAL UI
   ========================================= */
.tpiqbc * { box-sizing: border-box; }
.tpiqbc.container {
  font-family: ui-sans-serif, system-ui, Arial, sans-serif;
  color: #e6f1f0;
  background: #0b0f14;
  padding: 16px;
  border-radius: 14px;
}

.tpiqbc-header h1 {
  margin: 0 0 4px;
  font-size: 1.6rem;
}

.tpiqbc-header p {
  margin: 0 0 16px;
  color: #a9c1bf;
}

.tpiqbc-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.tpiqbc-select {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #20323a;
  background: #0f161d;
  color: #d7f2ef;
}

.tpiqbc-buttons {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.btn {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #1e2b33;
  background: #14202a;
  color: #e6f1f0;
  cursor: pointer;
}
.btn.primary {
  background: #0e7a69;
  border-color: #0b6a5c;
}
.btn.ghost {
  background: transparent;
  border-color: #30444e;
}
.btn:hover {
  filter: brightness(1.1);
}

/* Status messages */
.status {
  margin-top: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #0f161d;
  border: 1px solid #20323a;
  color: #bfe8e3;
}
.status.ok {
  border-color: #0e7a69;
  color: #9cf0e4;
}
.status.err {
  border-color: #8a2c2c;
  color: #ffb3b3;
}

/* Responsive */
@media (max-width: 980px) {
  .tpiqbc-stage {
    grid-template-columns: 1fr;
  }
}
