:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --border: #334155;
  --shadow: rgba(0, 0, 0, 0.3);
}

.ifs-container {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-primary) 0%, #0c1929 100%);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

/* Header */
.ifs-header {
  text-align: center;
  padding: 2rem 1rem;
  background: linear-gradient(
    180deg,
    rgba(15, 23, 42, 0.95) 0%,
    rgba(15, 23, 42, 0.8) 100%
  );
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.ifs-header h1 {
  margin: 0 0 0.5rem 0;
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  font-weight: 700;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ifs-subtitle {
  margin: 0.5rem 0 1rem 0;
  font-size: clamp(0.875rem, 1.5vw, 1.125rem);
  color: var(--text-secondary);
}

.ifs-breadcrumb {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.ifs-breadcrumb .separator {
  color: var(--text-secondary);
}

/* Main Layout */
.ifs-main {
  display: grid;
  grid-template-columns: 300px 1fr 320px;
  gap: 1.5rem;
  max-width: 1800px;
  margin: 0 auto;
  padding: 1.5rem;
}

@media (max-width: 1400px) {
  .ifs-main {
    grid-template-columns: 280px 1fr;
    grid-template-rows: auto auto;
  }

  .ifs-info-panel {
    grid-column: 1 / -1;
  }
}

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

/* Controls Panel */
.ifs-controls-panel,
.ifs-info-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 4px 6px var(--shadow);
  height: fit-content;
}

.ifs-controls-panel h2,
.ifs-info-panel h2,
.ifs-info-panel h3 {
  margin: 0 0 1rem 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
}

.ifs-control-group {
  margin-bottom: 1.25rem;
}

.ifs-control-group label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.ifs-control-group label span:last-child {
  color: var(--accent);
  font-weight: 600;
}

.ifs-control-group input[type="range"] {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.ifs-control-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s;
}

.ifs-control-group input[type="range"]::-webkit-slider-thumb:hover {
  background: var(--accent-hover);
}

.ifs-control-group input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s;
}

.ifs-control-group select {
  width: 100%;
  padding: 0.625rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color 0.2s;
}

.ifs-control-group select:focus {
  outline: none;
  border-color: var(--accent);
}

.ifs-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.ifs-actions button {
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.ifs-actions button:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.ifs-actions button:active {
  transform: translateY(0);
}

/* Canvas Panel */
.ifs-canvas-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 4px 6px var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
}

#ifsCanvas {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  background: #000;
}

.ifs-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border-radius: 8px;
  font-size: 0.875rem;
}

.ifs-stats span {
  color: var(--text-secondary);
}

.ifs-stats strong {
  color: var(--accent);
  font-weight: 600;
}

/* Info Panel */
.ifs-table-wrap {
  overflow-x: auto;
  margin: 1rem 0;
}

.ifs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.ifs-table th,
.ifs-table td {
  padding: 0.5rem;
  text-align: center;
  border: 1px solid var(--border);
}

.ifs-table th {
  background: var(--bg-tertiary);
  font-weight: 600;
  color: var(--text-secondary);
}

.ifs-table td {
  color: var(--text-primary);
}

.ifs-table input {
  width: 100%;
  min-width: 45px;
  padding: 0.25rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 0.75rem;
  text-align: center;
}

.ifs-table input:focus {
  outline: none;
  border-color: var(--accent);
}

#transformInfoContent {
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.ifs-math-info {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.ifs-formula {
  margin: 1rem 0;
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: 8px;
  overflow-x: auto;
}

/* Education Panel */
.ifs-education-panel {
  max-width: 1800px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.ifs-education-panel h2 {
  text-align: center;
  margin: 0 0 2rem 0;
  font-size: 1.75rem;
  font-weight: 700;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ifs-education-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.ifs-education-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 6px var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.ifs-education-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 12px var(--shadow);
}

.ifs-education-card h3 {
  margin: 0 0 1rem 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--accent);
}

.ifs-education-card p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.ifs-examples {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 6px var(--shadow);
}

.ifs-examples h3 {
  margin: 0 0 1rem 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--accent);
}

.ifs-examples ul {
  margin: 0;
  padding-left: 1.5rem;
  list-style-type: disc;
}

.ifs-examples li {
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.ifs-examples li strong {
  color: var(--text-primary);
}

/* Light Mode */
.ifs-container.light-mode {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --shadow: rgba(0, 0, 0, 0.1);
}

.ifs-container.light-mode .ifs-header {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(248, 250, 252, 0.8) 100%
  );
}

.ifs-container.light-mode .ifs-header h1 {
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ifs-container.light-mode #ifsCanvas {
  background: #fff;
}
