/* ===== COMPLEXITY CALCULATOR ===== */

.estimator-card {
  max-width: 600px;
  margin: 0 auto;
}

.estimate-result {
  margin-top: 20px;
  text-align: center;
}

.result-badge {
  display: inline-block;
  font-size: 2.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}

.result-details {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.result-details p {
  color: var(--text);
  margin-bottom: 8px;
}

.result-formula {
  font-family: 'Fira Code', monospace;
  font-size: 1rem;
  color: var(--primary);
  margin-bottom: 10px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-align: center;
}

.result-math {
  font-family: 'Fira Code', monospace;
  font-size: 0.9rem;
  color: var(--muted);
}

.complexity-scale {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 520px;
  margin: 0 auto;
}

.scale-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
}

.scale-label {
  width: 80px;
  font-family: 'Fira Code', monospace;
  font-weight: 600;
  text-align: right;
  flex-shrink: 0;
}

.scale-bar {
  flex: 1;
  min-width: 60px;
  height: 8px;
  border-radius: 4px;
  background: var(--border);
  position: relative;
  overflow: hidden;
}

.scale-value {
  font-family: 'Fira Code', monospace;
  font-size: 0.75rem;
  color: var(--muted);
  width: 72px;
  text-align: right;
  flex-shrink: 0;
}

.scale-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
  transition: width 0.5s ease;
}

.scale-item.active .scale-bar-fill {
  background: linear-gradient(90deg, var(--success) 0%, #059669 100%);
}

/* Comparator */
.comparator-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  align-items: start;
  margin-bottom: 20px;
}

.comparator-input {
  position: sticky;
  top: 20px;
}

.comparator-input .form-range {
  width: 100%;
}

.btn-block {
  width: 100%;
}

.range-display {
  text-align: center;
  font-family: 'Fira Code', monospace;
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 4px;
}

/* Range slider */
.form-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--border);
  outline: none;
  cursor: pointer;
  margin-top: 8px;
}

.form-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  cursor: pointer;
  border: 3px solid var(--surface);
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  transition: transform 0.15s ease;
}

.form-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.form-range::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  cursor: pointer;
  border: 3px solid var(--surface);
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.func-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.func-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.func-toggle {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.func-label {
  font-family: 'Fira Code', monospace;
  font-size: 0.85rem;
  color: var(--text);
}

.func-color {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  margin-left: auto;
}

#growthChart {
  width: 100%;
  max-width: 100%;
  height: 360px;
  aspect-ratio: 600 / 360;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

.chart-legend-color {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

/* Table */
.table-wrap {
  overflow-x: auto;
}

.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.ref-table th, .ref-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: center;
}

.ref-table th {
  background: var(--bg);
  font-weight: 600;
}

.ref-table code {
  font-family: 'Fira Code', monospace;
  font-size: 0.82rem;
  background: rgba(102,126,234,0.08);
  padding: 1px 5px;
  border-radius: 4px;
}

/* Pseudocode */
.pseudo-box {
  margin-bottom: 16px;
}

.pseudo-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.pseudo-code {
  font-family: 'Fira Code', monospace;
  font-size: 0.85rem;
  background: var(--bg-alt, #0f172a);
  color: var(--primary, #667eea);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
  margin: 0;
}

/* Info card */
.info-card {
  max-width: 600px;
  margin: 24px auto 0;
  background: var(--bg-alt);
  border-left: 4px solid var(--primary);
}

.info-card p {
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 12px;
}

.info-card .card-header {
  margin-bottom: 12px;
}

.info-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px 0;
}

.info-list li {
  padding: 6px 0 6px 20px;
  position: relative;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
}

.info-list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: 700;
}

.info-tip {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}

/* Reference note */
.ref-note {
  margin-top: 20px;
  background: var(--bg-alt);
  border-left: 4px solid var(--success);
}

.ref-note p {
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 12px;
}

.ref-note ol {
  padding-left: 20px;
  margin: 0;
}

.ref-note ol li {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 6px;
}

@media (max-width: 768px) {
  .comparator-layout {
    grid-template-columns: 1fr;
  }
  .comparator-input {
    position: static;
  }
}
