/**
 * graphing.css — Tata Letak & Komponen Kalkulator Grafik Bantukerjain.com
 * Standar Anti-AI-Slop: Task-first above the fold, zero nested card hell,
 * palet tenang kontras tinggi, tabular-nums, touch target >= 44px, zero overflow-x.
 */

.graph-page [hidden] {
  display: none !important;
}

.graph-page .wrap {
  max-width: 1180px;
  padding: 0 12px;
}

@media (min-width: 640px) {
  .graph-page .wrap {
    padding: 0 16px;
  }
}

.graph-page .breadcrumb {
  padding: 4px 0 0;
  font-size: 0.76rem;
}

.graph-page .hero {
  padding: 2px 0 8px;
}

.graph-page .hero h1 {
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 1px;
}

.graph-page .hero .lead {
  font-size: 0.82rem;
  line-height: 1.35;
  color: #475569;
  margin: 0;
}

/* ===== Task-First Workspace Grid ===== */
.graph-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin-bottom: 18px;
}

@media (min-width: 960px) {
  .graph-workspace {
    grid-template-columns: minmax(320px, 385px) minmax(0, 1fr);
    gap: 18px;
  }
}

.graph-sidebar,
.graph-stage,
.graph-table-section {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  min-width: 0;
}

.graph-sidebar {
  padding: 10px;
}

@media (min-width: 640px) {
  .graph-sidebar {
    padding: 12px 14px;
  }
}

.graph-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.graph-panel-head h2 {
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

/* ===== Multi-Function Input List ===== */
.graph-functions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.graph-fn-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.graph-fn-line {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 2px 4px;
  min-width: 0;
}

.graph-fn-row.has-error .graph-fn-line {
  border-color: #ef4444;
  background: #fef2f2;
}

.graph-fn-line:focus-within {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.14);
}

.graph-fn-swatch {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.graph-fn-swatch::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid var(--fn-color, #2563eb);
  background: transparent;
  transition: background-color 0.15s ease;
}

.graph-fn-swatch.is-visible::before {
  background: var(--fn-color, #2563eb);
}

.graph-fn-swatch:hover {
  background: #e2e8f0;
}

.graph-fn-tag {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
  flex-shrink: 0;
  user-select: none;
}

.graph-fn-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  border: none;
  background: transparent;
  color: #0f172a;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  padding: 4px 6px;
}

.graph-fn-input:focus {
  outline: none;
}

.graph-fn-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.graph-fn-remove:hover:not(:disabled) {
  background: #fee2e2;
  color: #b91c1c;
}

.graph-fn-remove:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.graph-fn-error {
  font-size: 0.78rem;
  color: #b91c1c;
  padding: 2px 4px;
  line-height: 1.3;
}

.graph-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  padding: 8px 12px;
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  background: #f8fafc;
  color: #0f172a;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.graph-add-btn:hover:not(:disabled) {
  background: #eff6ff;
  border-color: #2563eb;
  color: #1d4ed8;
}

.graph-add-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== Dynamic Parameter Sliders ===== */
.graph-params-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}

.graph-params-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.graph-param-card {
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  min-width: 0;
}

.graph-param-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.graph-play-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.graph-play-btn:hover {
  background: #eff6ff;
  border-color: #2563eb;
  color: #1d4ed8;
}

.graph-play-btn.is-playing {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.graph-param-label {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  margin-right: auto;
}

.graph-param-bounds {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.graph-bound-input {
  width: 58px;
  min-height: 44px;
  padding: 4px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #0f172a;
  font-family: var(--font-mono);
  font-size: 1rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.graph-bound-sep {
  font-size: 0.76rem;
  color: #64748b;
}

.graph-param-slider {
  width: 100%;
  min-height: 44px;
  margin: 0;
  accent-color: #2563eb;
  cursor: pointer;
}

/* ===== Canvas Stage & Controls ===== */
.graph-stage {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.graph-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 10px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.graph-coord-readout {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  color: #334155;
  font-variant-numeric: tabular-nums;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 180px;
}

.graph-toolbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.graph-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 6px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.graph-tool-btn:hover {
  background: #eff6ff;
  border-color: #2563eb;
  color: #1d4ed8;
}

.graph-tool-btn[aria-pressed="true"] {
  background: #0f172a;
  border-color: #0f172a;
  color: #ffffff;
}

.graph-canvas-wrap {
  position: relative;
  width: 100%;
  height: 290px;
  background: #ffffff;
}

@media (min-width: 640px) {
  .graph-canvas-wrap {
    height: 380px;
  }
}

@media (min-width: 960px) {
  .graph-canvas-wrap {
    height: 480px;
  }
}

.graph-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

.graph-canvas.is-dragging {
  cursor: grabbing;
}

/* ===== Table of Values (x vs y) ===== */
.graph-table-section {
  padding: 12px 14px;
  margin-bottom: 18px;
}

.graph-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.graph-table-head h2 {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.graph-table-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.graph-table-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  font-weight: 600;
  color: #334155;
}

.graph-table-input {
  width: 78px;
  min-height: 44px;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #0f172a;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.graph-table-note {
  margin: 0 0 8px;
  font-size: 0.8rem;
  color: #475569;
}

.graph-table-scroll {
  width: 100%;
  max-height: 320px;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.graph-value-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
}

.graph-value-table th,
.graph-value-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #e2e8f0;
  text-align: right;
  white-space: nowrap;
}

.graph-value-table th:first-child,
.graph-value-table td:first-child {
  text-align: left;
  font-weight: 700;
  background: #f8fafc;
}

.graph-value-table thead th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  color: #0f172a;
  font-family: var(--font-mono);
  font-weight: 700;
  z-index: 1;
}

.graph-table-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  margin-right: 6px;
  vertical-align: middle;
}

.graph-num-cell {
  font-family: var(--font-mono);
  color: #0f172a;
}

.graph-undef-cell {
  font-size: 0.78rem;
  font-style: italic;
  color: #b91c1c;
}

/* ===== Below-the-Fold Presets & FAQ ===== */
.graph-guide-section {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 18px;
}

.graph-guide-section h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 10px;
}

.graph-examples-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.graph-example-chip {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #0f172a;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.graph-example-chip:hover {
  background: #eff6ff;
  border-color: #2563eb;
  color: #1d4ed8;
}

.graph-ref-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

@media (min-width: 720px) {
  .graph-ref-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.graph-ref-list {
  margin: 0;
  padding-left: 18px;
  font-size: 0.88rem;
  color: #334155;
  line-height: 1.6;
}

.graph-guide-section details {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 8px;
  background: #ffffff;
}

.graph-guide-section summary {
  padding: 12px 14px;
  font-weight: 600;
  font-size: 0.92rem;
  color: #0f172a;
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.graph-guide-section .faq-body {
  padding: 0 14px 12px;
  font-size: 0.88rem;
  color: #475569;
  line-height: 1.6;
}

/* ==========================================================================
   B2B Sponsorship & Partnership Slot (Strategic Placement)
   ========================================================================== */
.b2b-sponsor-slot {
  margin: 28px 0 20px;
  padding: 16px 20px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #2563eb;
  border-radius: 8px;
}

.sponsor-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.sponsor-copy {
  flex: 1 1 280px;
}

.sponsor-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #2563eb;
  margin-bottom: 4px;
}

.sponsor-text {
  margin: 0;
  font-size: 0.88rem;
  color: #475569;
  line-height: 1.5;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: #0f172a;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-secondary:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.sponsor-cta {
  white-space: nowrap;
}

/* ==========================================================================
   Dual Visitor Feedback System (Two Distinct Channels)
   ========================================================================== */
.feedback-strip {
  margin: 20px 0 28px;
}

.feedback-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.feedback-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 18px;
  display: flex;
  flex-direction: column;
}

.feedback-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: #0f172a;
}

.feedback-card p {
  font-size: 0.85rem;
  color: #475569;
  margin: 0 0 14px;
  line-height: 1.5;
  flex: 1;
}

.feedback-btn {
  align-self: flex-start;
}

@media (max-width: 640px) {
  .feedback-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
