/* ==========================================================================
   Web Ustaad: Interactive Visual Simulators CSS
   Box Model Simulator & Flexbox Playground
   ========================================================================== */

/* Card Wrappers */
.box-model-widget-card,
.flexbox-widget-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin: 24px 0;
}

.bm-header, .fb-header {
  margin-bottom: 20px;
}

.bm-title, .fb-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bm-icon, .fb-icon {
  font-size: 24px;
}

.bm-title h4, .fb-title h4 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
}

.bm-subtitle, .fb-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ==========================================================================
   Box Model Visualizer Layout
   ========================================================================== */
.bm-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: center;
}

.bm-visual-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background-color: #f8fafc;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-medium);
  min-height: 320px;
}

/* Layers: Color coded for non-tech learning */
.bm-layer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

/* Layer 1: Margin (Yellow) */
.bm-margin-layer {
  background-color: #fef9c3;
  border: 2px dashed #eab308;
  border-radius: 8px;
}

/* Layer 2: Border (Orange) */
.bm-border-layer {
  background-color: #fed7aa;
  border: 4px solid #f97316;
  border-radius: 6px;
}

/* Layer 3: Padding (Green) */
.bm-padding-layer {
  background-color: #dcfce7;
  border: 2px dashed #22c55e;
  border-radius: 4px;
}

/* Layer 4: Content (Blue) */
.bm-content-layer {
  background-color: #dbeafe;
  border: 2px solid #3b82f6;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px;
  text-align: center;
}

.bm-content-label {
  font-size: 12px;
  font-weight: 700;
  color: #1e40af;
}

.bm-content-dim {
  font-size: 11px;
  font-family: var(--font-mono);
  color: #2563eb;
  margin-top: 2px;
}

.bm-layer-tag {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  pointer-events: none;
}

.bm-tag-margin { color: #854d0e; }
.bm-tag-border { color: #9a3412; }
.bm-tag-padding { color: #166534; }

/* Box Model Controls */
.bm-controls-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bm-controls-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bm-slider-group {
  background-color: var(--bg-subtle);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.bm-slider-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  margin-bottom: 8px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  display: inline-block;
  margin-right: 6px;
}
.dot-padding { background-color: #22c55e; }
.dot-border { background-color: #f97316; }
.dot-margin { background-color: #eab308; }

.slider-badge {
  background-color: white;
  border: 1px solid var(--border-medium);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}

.bm-range {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}

.bm-help {
  font-size: 11.5px;
  color: var(--text-muted);
  display: block;
  margin-top: 4px;
}

/* Code Snippet Box */
.bm-code-preview, .fb-code-box {
  background-color: #0f172a;
  border-radius: var(--radius-md);
  overflow: hidden;
  color: #e2e8f0;
}

.bm-code-header, .fb-code-header {
  background-color: #1e293b;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
}

.btn-copy-code {
  background-color: var(--primary);
  color: white;
  border: none;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.bm-code-preview pre, .fb-code-box pre {
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  margin: 0;
  overflow-x: auto;
}

/* ==========================================================================
   Flexbox Visualizer Layout
   ========================================================================== */
.fb-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.fb-control-row {
  background-color: var(--bg-subtle);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.fb-label-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 13.5px;
}

.fb-urdu-desc {
  font-size: 13px;
  color: #047857;
  font-weight: 600;
}

.fb-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fb-pill-btn {
  padding: 6px 14px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.fb-pill-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.fb-pill-btn.active {
  background-color: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Flexbox Stage */
.fb-stage-wrapper {
  background-color: #f8fafc;
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

.fb-stage {
  min-height: 200px;
  background-color: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 16px;
  transition: all 0.25s ease;
}

.fb-box {
  width: 90px;
  height: 90px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fb-box-num {
  font-size: 24px;
}

.fb-box-label {
  font-size: 11px;
  opacity: 0.9;
}

.fb-box-1 { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.fb-box-2 { background: linear-gradient(135deg, #10b981, #047857); }
.fb-box-3 { background: linear-gradient(135deg, #f59e0b, #d97706); }

@media (max-width: 900px) {
  .bm-body {
    grid-template-columns: 1fr;
  }
}
