/* Chapter 7: Step-by-Step Construction Simulator */

.construct-sim {
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
    font-family: 'Poppins', sans-serif;
    overflow: hidden; box-sizing: border-box;
}

/* Header */
.cs7-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 14px; flex-shrink: 0;
    background: rgba(255,255,255,0.85); backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(67,97,238,0.08);
}

.cs7-mode-group { display: flex; gap: 4px; }

.cs7-mode-btn {
    padding: 6px 14px; border-radius: 8px; border: 1.5px solid rgba(0,0,0,0.08);
    font-size: 0.7rem; font-weight: 700; cursor: pointer;
    background: rgba(240,244,248,0.7); color: #374151;
    transition: all 0.25s; font-family: inherit;
}
.cs7-mode-btn:hover { background: #fff; }
.cs7-mode-btn.active-blue { background: #4361ee; color: #fff; border-color: #4361ee; }
.cs7-mode-btn.active-green { background: #059669; color: #fff; border-color: #059669; }

.cs7-instruction {
    flex: 1; text-align: center; font-size: 0.72rem; font-weight: 600;
    color: #374151; padding: 0 12px; line-height: 1.4;
}
.cs7-instruction .step-num {
    display: inline-block; background: #4361ee; color: #fff;
    border-radius: 4px; padding: 1px 6px; font-size: 0.6rem;
    margin-right: 4px; font-weight: 700;
}
.cs7-instruction .step-num.green { background: #059669; }

/* SVG Canvas */
.cs7-canvas-wrap {
    flex: 1; min-height: 0; display: flex;
    align-items: center; justify-content: center;
    padding: 6px; box-sizing: border-box;
}
.cs7-canvas-wrap svg {
    width: 100%; height: 100%; border-radius: 12px;
    background: linear-gradient(145deg, #fff, #f8faff);
    box-shadow: inset 0 0 16px rgba(67,97,238,0.02), 0 2px 6px rgba(0,0,0,0.03);
    border: 1px solid rgba(67,97,238,0.06);
}

/* Footer Controls */
.cs7-controls {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; padding: 8px 14px; flex-shrink: 0;
    background: rgba(255,255,255,0.85); backdrop-filter: blur(12px);
    border-top: 1px solid rgba(67,97,238,0.08);
}
.cs7-btn {
    padding: 6px 16px; border-radius: 8px; border: none;
    font-size: 0.72rem; font-weight: 700; cursor: pointer;
    font-family: inherit; transition: all 0.2s;
    display: flex; align-items: center; gap: 5px;
}
.cs7-btn-prev { background: #e5e7eb; color: #374151; }
.cs7-btn-prev:hover { background: #d1d5db; }
.cs7-btn-next { background: #4361ee; color: #fff; }
.cs7-btn-next:hover { background: #3553e0; }
.cs7-btn-next.green { background: #059669; }
.cs7-btn-next.green:hover { background: #047857; }
.cs7-btn-reset { background: rgba(239,71,111,0.08); color: #ef476f; }
.cs7-btn-reset:hover { background: rgba(239,71,111,0.15); }
.cs7-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.cs7-step-dots { display: flex; gap: 5px; margin: 0 8px; }
.cs7-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #d1d5db; transition: all 0.25s;
}
.cs7-dot.filled-blue { background: #4361ee; }
.cs7-dot.filled-green { background: #059669; }

/* SVG Elements */
.cs7-grid { stroke: #e5e7eb; stroke-width: 0.5; }
.cs7-grid-m { stroke: #d1d5db; stroke-width: 0.8; }
.cs7-tri-edge { fill: none; stroke: #1e293b; stroke-width: 2.5; stroke-linejoin: round; }
.cs7-tri-fill { fill: rgba(67,97,238,0.02); stroke: none; }
.cs7-arc { fill: none; stroke: #9ca3af; stroke-width: 1.2; }
.cs7-bisector-blue { fill: none; stroke: #4361ee; stroke-width: 1.5; stroke-dasharray: 6,4; opacity: 0.7; }
.cs7-bisector-green { fill: none; stroke: #059669; stroke-width: 1.5; stroke-dasharray: 6,4; opacity: 0.7; }
.cs7-circumcircle { fill: none; stroke: #4361ee; stroke-width: 2.5; opacity: 0.8; filter: drop-shadow(0 0 4px rgba(67,97,238,0.3)); }
.cs7-incircle { fill: rgba(5,150,105,0.04); stroke: #059669; stroke-width: 2.5; opacity: 0.8; filter: drop-shadow(0 0 4px rgba(5,150,105,0.3)); }
.cs7-anchor { fill: #ef476f; }
.cs7-center-dot { }
.cs7-label { font-family: 'Poppins',sans-serif; font-size: 14px; font-weight: 700; fill: #1e293b; pointer-events: none; }
.cs7-center-label { font-family: 'Poppins',sans-serif; font-size: 12px; font-weight: 700; pointer-events: none; }

/* Drawing animation */
.cs7-draw {
    animation: cs7DrawIn 1.5s ease-in-out forwards;
}
@keyframes cs7DrawIn {
    from { stroke-dashoffset: var(--len); }
    to { stroke-dashoffset: 0; }
}
.cs7-fade { animation: cs7FadeIn 0.8s ease forwards; }
@keyframes cs7FadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 768px) {
    .cs7-header { flex-wrap: wrap; gap: 6px; }
    .cs7-instruction { width: 100%; order: 3; }
}

/* ===== Gonit Ongon 2.0 de-slop (tokens from design-system.css) =====
   "blue" is the circumcircle category paired with "green" (incircle), so the
   slop #4361ee is remapped to the clean --sky-600 token, NOT emerald, to keep
   the two constructions visually distinct. */
.cs7-header, .cs7-controls { background: var(--color-surface); border-color: var(--color-border); }
.cs7-mode-btn { background: var(--color-surface-2); color: var(--color-ink-2); border: 1.5px solid var(--color-border); }
.cs7-mode-btn:hover { background: var(--color-surface); }
.cs7-mode-btn.active-blue { background: var(--sky-600); color: #fff; border-color: var(--sky-600); }
.cs7-mode-btn.active-green { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }
.cs7-instruction { color: var(--color-ink-2); }
.cs7-instruction .step-num { background: var(--sky-600); }
.cs7-instruction .step-num.green { background: var(--color-accent); }
.cs7-canvas-wrap svg { background: var(--color-surface); border: 1px solid var(--color-border); box-shadow: var(--shadow-sm); }
.cs7-tri-fill { fill: var(--color-accent-soft); }
.cs7-btn-prev { background: var(--color-surface-2); color: var(--color-ink-2); }
.cs7-btn-prev:hover { background: var(--color-border); }
.cs7-btn-next { background: var(--sky-600); }
.cs7-btn-next:hover { background: #0369a1; }
.cs7-btn-next.green { background: var(--color-accent); }
.cs7-btn-next.green:hover { background: var(--color-accent-hover); }
.cs7-btn-reset { background: var(--color-danger-soft); color: var(--color-danger); }
.cs7-btn-reset:hover { background: var(--color-danger); color: #fff; }
.cs7-dot.filled-blue { background: var(--sky-600); }
.cs7-dot.filled-green { background: var(--color-accent); }
.cs7-bisector-blue { stroke: var(--sky-600); }
.cs7-circumcircle { stroke: var(--sky-600); filter: none; }
.cs7-incircle { stroke: var(--color-accent); filter: none; }
.cs7-anchor { fill: var(--color-danger); }
