/* ==========================================================================
   Geometry Step-by-Step Drawing Animation System (Edu-Plus)
   ========================================================================== */

.ga-card {
  margin: 18px 0;
  border: 1px solid var(--line, #e3e6f0);
  border-radius: 16px;
  background: var(--surface, #fff);
  box-shadow: 0 2px 12px rgba(20, 20, 60, 0.05);
  overflow: hidden;
  font-family: inherit;
}

.ga-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 18px;
  background: linear-gradient(135deg, rgba(76, 42, 154, 0.08), rgba(28, 126, 214, 0.08));
  border-bottom: 1px solid var(--line, #e3e6f0);
}

.ga-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ga-hint-pill {
  font-size: 12px;
  color: #4c2a9a;
  font-weight: 600;
  background: rgba(76, 42, 154, 0.08);
  padding: 3px 10px;
  border-radius: 12px;
  pointer-events: none;
}

[data-theme="dark"] .ga-hint-pill {
  background: rgba(177, 151, 252, 0.15);
  color: #d0bfff;
}

.ga-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: #4c2a9a;
}

.ga-title svg {
  flex-shrink: 0;
}

.ga-step-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px;
  border-radius: 20px;
  background: #4c2a9a;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.ga-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 580px;
  margin: 0 auto;
  padding: 8px 10px 4px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  border-radius: 12px;
  transition: background 0.2s ease;
  user-select: none;
}

.ga-canvas-wrap:hover {
  background: rgba(76, 42, 154, 0.02);
}

.ga-canvas-wrap:focus-visible {
  outline: 2px solid #4c2a9a;
  outline-offset: 2px;
}

.ga-svg {
  width: 100%;
  height: auto;
  max-height: 420px;
  display: block;
  user-select: none;
  touch-action: none;
}

/* SVG Elements Styling */
.ga-svg text {
  font-family: 'Kantumruy Pro', 'Segoe UI', system-ui, sans-serif;
  user-select: none;
  paint-order: stroke fill;
  stroke: #ffffff;
  stroke-width: 3.5px;
  stroke-linejoin: round;
  stroke-linecap: round;
}

[data-theme="dark"] .ga-svg text {
  stroke: #1e222d;
}

.ga-circle-base {
  fill: none;
  stroke: #495057;
  stroke-width: 2.2;
}

.ga-square-base {
  fill: rgba(76, 42, 154, 0.03);
  stroke: #102a43;
  stroke-width: 2.5;
  stroke-linejoin: round;
}

.ga-diag {
  stroke: #868e96;
  stroke-width: 1.8;
  stroke-dasharray: 5 4;
}

.ga-diag-solid {
  stroke: #4c2a9a;
  stroke-width: 2;
}

.ga-chord-ac {
  stroke: #1c7ed6;
  stroke-width: 2.8;
  stroke-linecap: round;
}

.ga-chord-bd {
  stroke: #e03131;
  stroke-width: 2.8;
  stroke-linecap: round;
}

.ga-tri-acm {
  fill: rgba(28, 126, 214, 0.12);
  stroke: #1c7ed6;
  stroke-width: 2.2;
}

.ga-tri-bmd {
  fill: rgba(224, 49, 49, 0.12);
  stroke: #e03131;
  stroke-width: 2.2;
}

.ga-pt {
  fill: #102a43;
  transition: r 0.2s ease;
}

.ga-pt-m {
  fill: #d6336c;
  stroke: #fff;
  stroke-width: 2.5;
  cursor: grab;
  filter: drop-shadow(0 2px 4px rgba(214, 51, 108, 0.4));
}

.ga-pt-m:hover {
  r: 8.5;
}

.ga-pt-m:active {
  cursor: grabbing;
}

.ga-right-angle {
  fill: none;
  stroke: #495057;
  stroke-width: 1.8;
}

.ga-label {
  font-size: 16px;
  font-weight: 700;
  fill: #102a43;
}

.ga-label-m {
  font-size: 18px;
  font-weight: 800;
  fill: #d6336c;
}

.ga-label-side {
  font-size: 15px;
  font-style: italic;
  font-weight: 700;
  fill: #4c2a9a;
}

/* Step Caption */
.ga-caption-box {
  padding: 14px 18px;
  background: var(--surface-alt, #fbf9ff);
  border-top: 1px solid var(--line, #e3e6f0);
  border-bottom: 1px solid var(--line, #e3e6f0);
  min-height: 58px;
}

.ga-caption-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-1, #102a43);
  font-weight: 500;
}

.ga-caption-text b {
  color: #4c2a9a;
}

/* Live Dynamic Math Box */
.ga-live-math {
  margin-top: 10px;
  padding: 8px 10px;
  background: rgba(76, 42, 154, 0.04);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.ga-math-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(76, 42, 154, 0.15);
  border-radius: 6px;
  font-size: 13px;
  color: #3b1d75;
}

.ga-math-pill b {
  font-weight: 700;
  color: #1c7ed6;
}

.ga-math-pill.ga-pill-result {
  background: rgba(43, 138, 62, 0.1);
  border-color: rgba(43, 138, 62, 0.3);
  color: #2b8a3e;
}

.ga-math-pill.ga-pill-result b {
  color: #2b8a3e;
}

[data-theme="dark"] .ga-live-math {
  background: rgba(177, 151, 252, 0.06);
}

[data-theme="dark"] .ga-math-pill {
  background: rgba(26, 29, 36, 0.8);
  border-color: rgba(177, 151, 252, 0.25);
  color: #d0bfff;
}

[data-theme="dark"] .ga-math-pill.ga-pill-result {
  background: rgba(43, 138, 62, 0.2);
  border-color: rgba(81, 207, 102, 0.4);
  color: #8ce99a;
}

.ga-live-val {
  font-weight: 700;
  font-family: monospace, sans-serif;
  color: #d6336c;
}

/* Controls Toolbar (Placed directly beneath drawing canvas) */
.ga-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 18px;
  background: #f8f9fa;
  border-top: 1px solid var(--line, #e9ecef);
  border-bottom: 1px solid var(--line, #e9ecef);
}

[data-theme="dark"] .ga-controls {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(255, 255, 255, 0.08);
}

.ga-btn-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.ga-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--line, #cfc3ec);
  background: #fff;
  color: var(--ink-1, #102a43);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

[data-theme="dark"] .ga-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: #f1f3f5;
}

.ga-btn:hover:not(:disabled) {
  border-color: #4c2a9a;
  color: #4c2a9a;
  background: #f5f0ff;
}

[data-theme="dark"] .ga-btn:hover:not(:disabled) {
  background: rgba(177, 151, 252, 0.15);
  color: #d0bfff;
  border-color: #b197fc;
}

.ga-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.ga-btn-primary {
  background: #4c2a9a !important;
  color: #fff !important;
  border-color: #4c2a9a !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(76, 42, 154, 0.3);
}

.ga-btn-primary:hover:not(:disabled) {
  background: #3b1d75 !important;
  border-color: #3b1d75 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(76, 42, 154, 0.4);
}

.ga-btn-restart {
  background: #2b8a3e !important;
  border-color: #2b8a3e !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(43, 138, 62, 0.3);
}

.ga-btn-restart:hover {
  background: #237032 !important;
  border-color: #237032 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(43, 138, 62, 0.4);
}

.ga-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ga-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #dee2e6;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s ease;
}

.ga-dot.active {
  background: #4c2a9a;
  transform: scale(1.3);
}

.ga-dot.done {
  background: #9775fa;
}

/* Drawing stroke animation */
.ga-anim-stroke {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: gaDash 0.85s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes gaDash {
  to {
    stroke-dashoffset: 0;
  }
}

.ga-anim-fade {
  opacity: 0;
  animation: gaFade 0.45s ease forwards;
}

@keyframes gaFade {
  to {
    opacity: 1;
  }
}

.ga-anim-pop {
  transform-origin: center;
  animation: gaPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes gaPop {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Dark mode overrides */
[data-theme="dark"] .ga-card {
  background: var(--surface, #1e222d);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .ga-header {
  background: rgba(76, 42, 154, 0.2);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .ga-title {
  color: #b197fc;
}

[data-theme="dark"] .ga-caption-box {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .ga-caption-text {
  color: #e9ecef;
}

[data-theme="dark"] .ga-controls {
  background: var(--surface, #1e222d);
}

[data-theme="dark"] .ga-btn {
  background: #2b3040;
  border-color: rgba(255, 255, 255, 0.15);
  color: #e9ecef;
}

[data-theme="dark"] .ga-circle-base {
  stroke: #adb5bd;
}

[data-theme="dark"] .ga-square-base {
  stroke: #f8f9fa;
  fill: rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .ga-pt {
  fill: #f8f9fa;
}

[data-theme="dark"] .ga-label {
  fill: #f8f9fa;
}

.ga-dash-circle {
  fill: none;
  stroke: #495057;
  stroke-width: 2;
  stroke-dasharray: 6 5;
}

.ga-dash-line {
  stroke: #495057;
  stroke-width: 1.8;
  stroke-dasharray: 5 4;
}

.ga-alt-line {
  stroke: #4c2a9a;
  stroke-width: 2.2;
}

.ga-sec-tri {
  fill: rgba(245, 159, 0, 0.16);
  stroke: #f59f00;
  stroke-width: 2.2;
}

.ga-angle-arc {
  fill: rgba(76, 42, 154, 0.15);
  stroke: #4c2a9a;
  stroke-width: 1.6;
}

.ga-tick {
  stroke: #d6336c;
  stroke-width: 2.5;
  stroke-linecap: round;
}

[data-theme="dark"] .ga-dash-circle {
  stroke: #adb5bd;
}

[data-theme="dark"] .ga-dash-line {
  stroke: #adb5bd;
}

[data-theme="dark"] .ga-alt-line {
  stroke: #b197fc;
}
