/* Regression Visualization CSS */

:root {
  --color-analytical: #1f77b4;
  --color-gradient: #d62728;
  --color-sklearn: #2ca02c;
  --color-poly2: #1f77b4;
  --color-poly3: #ff7f0e;
  --color-poly4: #d62728;
  --color-newton: #1f77b4;
  --color-logistic-gd: #d62728;
  --color-logistic-sk: #2ca02c;
  --color-cara: #2ca02c;
  --color-barata: #d62728;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --padding: 20px;
  --border-color: #e0e0e0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  background: #fafafa;
  color: #333;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--padding);
}

header {
  background: white;
  border-bottom: 1px solid var(--border-color);
  padding: 40px 0;
  margin-bottom: 40px;
}

header h1 {
  margin: 0;
  font-size: 2.5em;
  color: #222;
}

header p {
  margin: 10px 0 0;
  color: #666;
  font-size: 1.1em;
}

section {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: var(--padding);
  margin-bottom: 60px;
  scroll-margin-top: 20px;
}

section h2 {
  font-size: 1.8em;
  margin-top: 0;
  margin-bottom: 10px;
  color: #222;
}

.section-description {
  color: #666;
  font-size: 1em;
  margin-bottom: 20px;
  line-height: 1.6;
}

/* Controls */
.controls {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
  flex-wrap: wrap;
  align-items: center;
}

.controls button {
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  background: white;
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.95em;
  transition: all 0.2s;
}

.controls button:hover {
  background: #f5f5f5;
}

.controls button.active {
  background: #333;
  color: white;
  border-color: #333;
}

.control-group {
  display: flex;
  gap: 10px;
  align-items: center;
}

.control-group label {
  font-weight: 500;
  color: #555;
}

input[type="range"] {
  width: 200px;
}

input[type="checkbox"] {
  cursor: pointer;
  margin-right: 5px;
}

.method-toggle {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.toggle-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.toggle-item label {
  margin: 0;
  font-weight: 400;
  cursor: pointer;
}

.color-indicator {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  margin-right: 5px;
}

/* Panels Layout */
.panels {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 1400px) {
  .panels {
    grid-template-columns: 1fr 1fr;
  }

  .panels > :first-child {
    grid-column: span 2;
  }
}

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

  .panels > :first-child {
    grid-column: span 1;
  }
}

.panel {
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 15px;
  background: #fafafa;
}

.panel h3 {
  margin: 0 0 10px;
  font-size: 0.95em;
  font-weight: 600;
  color: #555;
}

svg {
  display: block;
  margin: 0 auto;
  background: white;
}

.tick line {
  stroke: #e0e0e0;
  stroke-width: 1;
}

.tick text {
  font-size: 11px;
  fill: #666;
}

.axis-label {
  font-size: 12px;
  fill: #666;
}

.scatter-point {
  opacity: 0.6;
  stroke-width: 0.5;
  stroke: white;
}

.scatter-point:hover {
  opacity: 0.9;
  stroke-width: 1;
}

.regression-line {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

.regression-line.analytical {
  stroke: var(--color-analytical);
}

.regression-line.gradient {
  stroke: var(--color-gradient);
  opacity: 0.8;
}

.regression-line.sklearn {
  stroke: var(--color-sklearn);
  opacity: 0.8;
}

.polynomial-curve {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

.polynomial-curve.poly1 {
  stroke: var(--color-poly2);
}

.polynomial-curve.poly2 {
  stroke: var(--color-poly2);
}

.polynomial-curve.poly3 {
  stroke: var(--color-poly3);
}

.polynomial-curve.poly4 {
  stroke: var(--color-poly4);
}

.decision-boundary {
  stroke-width: 2;
  stroke: #000;
  fill: none;
}

.legend {
  display: flex;
  gap: 20px;
  font-size: 0.9em;
  margin-top: 10px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-color {
  display: inline-block;
  width: 20px;
  height: 2px;
  border-radius: 1px;
}

.legend-color.analytical {
  background: var(--color-analytical);
}

.legend-color.gradient {
  background: var(--color-gradient);
}

.legend-color.sklearn {
  background: var(--color-sklearn);
}

.annotation {
  background: #fff3cd;
  border-left: 4px solid #ffc107;
  padding: 10px 15px;
  margin: 15px 0;
  border-radius: 4px;
  font-size: 0.95em;
}

.annotation.info {
  background: #d1ecf1;
  border-left-color: #17a2b8;
}

/* Bar chart styling */
.bar {
  stroke: none;
}

.bar.degree1 {
  fill: var(--color-poly2);
}

.bar.degree2 {
  fill: var(--color-poly2);
}

.bar.degree3 {
  fill: var(--color-poly3);
}

.bar.degree4 {
  fill: var(--color-poly4);
}

.bar-label {
  font-size: 10px;
  fill: #666;
  text-anchor: middle;
}

/* ROC curve styling */
.roc-line {
  fill: none;
  stroke: #1f77b4;
  stroke-width: 2;
}

.roc-diagonal {
  fill: none;
  stroke: #999;
  stroke-width: 1;
  stroke-dasharray: 4,4;
}

.roc-point {
  fill: #d62728;
  opacity: 0.7;
}

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  font-size: 0.95em;
}

table th {
  background: #f5f5f5;
  padding: 12px;
  text-align: left;
  border-bottom: 2px solid var(--border-color);
  font-weight: 600;
}

table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
}

table tr:hover {
  background: #fafafa;
}

/* Footer */
footer {
  border-top: 1px solid var(--border-color);
  padding: 40px 0;
  margin-top: 60px;
  text-align: center;
  color: #999;
  font-size: 0.9em;
}

/* Utilities */
.text-center {
  text-align: center;
}

.mt-20 {
  margin-top: 20px;
}

.mb-20 {
  margin-bottom: 20px;
}

/* Loading state */
.loading {
  text-align: center;
  padding: 40px;
  color: #999;
}

.loading::after {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #f0f0f0;
  border-top-color: #333;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }

  header {
    padding: 20px 0;
  }

  header h1 {
    font-size: 1.8em;
  }

  section {
    padding: 15px;
    margin-bottom: 30px;
  }

  .controls {
    gap: 10px;
  }

  .panels {
    gap: 15px;
  }

  .panel {
    padding: 10px;
  }
}
