/**
 * Gauge Theory Visualization Styles
 * Scoped with .gauge-theory-container prefix to prevent global style pollution
 */

.gauge-theory-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
  background: linear-gradient(135deg, #0a0a1a 0%, #1a1a2e 50%, #0f0f23 100%);
  min-height: 100vh;
  color: #e4e4e7;
}

/* Header */
.gauge-theory-container header {
  text-align: center;
  margin-bottom: 30px;
  padding: 20px;
}

.gauge-theory-container h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
}

.gauge-theory-container .subtitle {
  font-size: 1.1rem;
  color: #a1a1aa;
  font-weight: 300;
}

/* Main Layout */
.gauge-theory-container main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
  gap: clamp(16px, 3vw, 32px);
  margin-bottom: 40px;
  align-items: start;
}

@media (max-width: 1100px) {
  .gauge-theory-container main {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
    gap: 20px;
  }
}

@media (max-width: 960px) {
  .gauge-theory-container main {
    grid-template-columns: 1fr;
  }
}

/* Canvas Container */
.gauge-theory-container .canvas-wrapper {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(102, 126, 234, 0.15);
  border: 1px solid rgba(102, 126, 234, 0.2);
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  min-width: 0;
  box-sizing: border-box;
}

.gauge-theory-container #gaugeCanvas {
  border-radius: 8px;
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.gauge-theory-container .canvas-overlay {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.gauge-theory-container .field-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gauge-theory-container .info-item {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  font-size: 0.9rem;
}

.gauge-theory-container .info-item .label {
  color: #a1a1aa;
}

.gauge-theory-container .info-item .value {
  color: #a5b4fc;
  font-family: "Courier New", monospace;
  font-weight: 600;
}

/* Controls Panel */
.gauge-theory-container .controls-panel {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  padding: 24px;
  border: 1px solid rgba(102, 126, 234, 0.15);
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: fit-content;
  max-height: 100%;
  overflow-y: auto;
  min-width: 0;
  box-sizing: border-box;
}

.gauge-theory-container .control-section h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #d4d4d8;
  margin-bottom: 12px;
}

/* Gauge Buttons */
.gauge-theory-container .gauge-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gauge-theory-container .gauge-btn {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #a1a1aa;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.gauge-theory-container .gauge-btn:hover {
  background: rgba(102, 126, 234, 0.1);
  border-color: rgba(102, 126, 234, 0.3);
}

.gauge-theory-container .gauge-btn.active {
  background: rgba(102, 126, 234, 0.2);
  border-color: rgba(102, 126, 234, 0.5);
  color: #a5b4fc;
}

/* Parameter Controls */
.gauge-theory-container .parameter-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gauge-theory-container .control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gauge-theory-container .control-group label {
  font-size: 0.9rem;
  font-weight: 500;
  color: #d4d4d8;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gauge-theory-container .control-group label span:last-child {
  background: rgba(102, 126, 234, 0.2);
  color: #a5b4fc;
  padding: 2px 10px;
  border-radius: 12px;
  font-family: "Courier New", monospace;
  font-weight: 600;
  min-width: 50px;
  text-align: center;
}

.gauge-theory-container input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.gauge-theory-container input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
  transition: transform 0.2s;
}

.gauge-theory-container input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

/* Toggle Controls */
.gauge-theory-container .toggle-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gauge-theory-container .toggle-btn {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #a1a1aa;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.gauge-theory-container .toggle-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.gauge-theory-container .toggle-btn.active {
  background: rgba(102, 126, 234, 0.15);
  border-color: rgba(102, 126, 234, 0.5);
  color: #a5b4fc;
}

.gauge-theory-container .toggle-btn.active::before {
  content: "✓ ";
  color: #667eea;
  font-weight: bold;
}

/* Formula Display */
.gauge-theory-container .formula-display {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid rgba(102, 126, 234, 0.2);
}

.gauge-theory-container .formula-display h3 {
  font-size: 0.9rem;
  color: #a5b4fc;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gauge-theory-container .formula-content {
  font-size: 0.85rem;
  line-height: 1.6;
  color: #d4d4d8;
}

.gauge-theory-container .formula-content .formula {
  margin: 8px 0;
  padding: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  font-family: "Times New Roman", Times, serif;
  font-style: italic;
}

/* Visualization Tabs */
.gauge-theory-container .visualization-tabs {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 16px;
  padding: 24px;
  border: 1px solid rgba(102, 126, 234, 0.1);
  margin-bottom: 40px;
}

.gauge-theory-container .tab-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 16px;
}

.gauge-theory-container .tab-btn {
  padding: 10px 20px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: #a1a1aa;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.gauge-theory-container .tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #d4d4d8;
}

.gauge-theory-container .tab-btn.active {
  background: rgba(102, 126, 234, 0.2);
  color: #a5b4fc;
}

.gauge-theory-container .tab-content {
  display: none;
}

.gauge-theory-container .tab-content.active {
  display: block;
}

/* Wilson Loop */
.gauge-theory-container .wilson-loop-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: center;
}

@media (max-width: 768px) {
  .gauge-theory-container .wilson-loop-container {
    grid-template-columns: 1fr;
  }
}

.gauge-theory-container #wilsonCanvas {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  border: 1px solid rgba(102, 126, 234, 0.2);
}

.gauge-theory-container .wilson-info {
  padding: 20px;
}

.gauge-theory-container .wilson-info h3 {
  font-size: 1.3rem;
  color: #a5b4fc;
  margin-bottom: 12px;
}

.gauge-theory-container .wilson-info p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #d4d4d8;
  margin-bottom: 20px;
}

.gauge-theory-container .wilson-value {
  font-size: 1.2rem;
  color: #f093fb;
  font-family: "Courier New", monospace;
  font-weight: 600;
}

/* Comparison Table */
.gauge-theory-container .comparison-table {
  overflow-x: auto;
}

.gauge-theory-container .comparison-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.gauge-theory-container .comparison-table th,
.gauge-theory-container .comparison-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.gauge-theory-container .comparison-table th {
  background: rgba(102, 126, 234, 0.1);
  color: #a5b4fc;
  font-weight: 600;
}

.gauge-theory-container .comparison-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* Explanation Section */
.gauge-theory-container .explanation-section {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 16px;
  padding: 32px;
  border: 1px solid rgba(102, 126, 234, 0.1);
  margin-bottom: 40px;
}

.gauge-theory-container .explanation-section h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gauge-theory-container .explanation-section > p {
  font-size: 1.05rem;
  line-height: 1.8;
  color: #d4d4d8;
  margin-bottom: 24px;
}

/* Concept Box */
.gauge-theory-container .concept-box {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  padding: 24px;
  margin: 24px 0;
  border: 1px solid rgba(102, 126, 234, 0.1);
}

.gauge-theory-container .concept-box h3 {
  font-size: 1.3rem;
  color: #f4f4f5;
  margin-bottom: 20px;
}

.gauge-theory-container .concept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.gauge-theory-container .concept-card {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  padding: 20px;
  border-left: 3px solid #667eea;
}

.gauge-theory-container .concept-card h4 {
  font-size: 1.05rem;
  color: #a5b4fc;
  margin-bottom: 10px;
}

.gauge-theory-container .concept-card p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #a1a1aa;
}

/* Formula Box */
.gauge-theory-container .formula-box {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  padding: 24px;
  margin: 24px 0;
  border: 1px solid rgba(102, 126, 234, 0.15);
}

.gauge-theory-container .formula-box h3 {
  font-size: 1.3rem;
  color: #f4f4f5;
  margin-bottom: 12px;
}

.gauge-theory-container .formula-box > p {
  font-size: 1rem;
  line-height: 1.7;
  color: #a1a1aa;
  margin-bottom: 16px;
}

.gauge-theory-container .formula-highlight {
  background: rgba(102, 126, 234, 0.1);
  border-radius: 10px;
  padding: 24px;
  margin: 20px 0;
  text-align: center;
  font-size: 1.3rem;
  color: #a5b4fc;
  border: 1px solid rgba(102, 126, 234, 0.2);
}

/* Standard Model Box */
.gauge-theory-container .standard-model-box {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  padding: 24px;
  margin: 24px 0;
  border: 1px solid rgba(102, 126, 234, 0.15);
}

.gauge-theory-container .standard-model-box h3 {
  font-size: 1.3rem;
  color: #f4f4f5;
  margin-bottom: 20px;
}

.gauge-theory-container .sm-structure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
}

.gauge-theory-container .sm-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.gauge-theory-container .group-badge {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: white;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.gauge-theory-container .group-badge.u1 {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.gauge-theory-container .group-badge.su2 {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.gauge-theory-container .group-badge.su3 {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.gauge-theory-container .group-info {
  text-align: center;
}

.gauge-theory-container .group-info strong {
  display: block;
  color: #d4d4d8;
  font-size: 0.9rem;
}

.gauge-theory-container .group-info span {
  font-size: 0.8rem;
  color: #a1a1aa;
}

.gauge-theory-container .sm-connector {
  font-size: 1.5rem;
  color: #667eea;
  font-weight: 300;
}

/* History Timeline */
.gauge-theory-container .history-box {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  padding: 24px;
  margin: 24px 0;
  border: 1px solid rgba(102, 126, 234, 0.1);
}

.gauge-theory-container .history-box h3 {
  font-size: 1.3rem;
  color: #f4f4f5;
  margin-bottom: 20px;
}

.gauge-theory-container .timeline {
  position: relative;
  padding-left: 30px;
}

.gauge-theory-container .timeline::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
}

.gauge-theory-container .timeline-item {
  position: relative;
  margin-bottom: 24px;
}

.gauge-theory-container .timeline-item::before {
  content: "";
  position: absolute;
  left: -26px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #667eea;
  border: 2px solid #1a1a2e;
}

.gauge-theory-container .timeline-item .year {
  font-size: 0.85rem;
  color: #a5b4fc;
  font-weight: 600;
  margin-bottom: 4px;
}

.gauge-theory-container .timeline-item .event {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #d4d4d8;
}

/* Applications Box */
.gauge-theory-container .applications-box {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  padding: 24px;
  margin: 24px 0;
  border: 1px solid rgba(102, 126, 234, 0.1);
}

.gauge-theory-container .applications-box h3 {
  font-size: 1.3rem;
  color: #f4f4f5;
  margin-bottom: 16px;
}

.gauge-theory-container .applications-box ul {
  list-style: none;
  padding: 0;
}

.gauge-theory-container .applications-box li {
  padding: 14px 16px;
  margin: 10px 0;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  line-height: 1.7;
  border-left: 3px solid #667eea;
  font-size: 0.95rem;
  color: #d4d4d8;
}

.gauge-theory-container .applications-box li strong {
  color: #a5b4fc;
}

/* Explanation Box */
.gauge-theory-container .explanation-box {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}

.gauge-theory-container .explanation-box h3 {
  font-size: 1.1rem;
  color: #a5b4fc;
  margin-bottom: 10px;
}

.gauge-theory-container .explanation-box p {
  font-size: 0.9rem;
  line-height: 1.7;
  color: #a1a1aa;
}

/* KaTeX overrides */
.gauge-theory-container .katex {
  font-size: 1.1em;
}

/* Responsive Design */
@media (max-width: 768px) {
  .gauge-theory-container {
    padding: 12px;
  }

  .gauge-theory-container h1 {
    font-size: 1.8rem;
  }

  .gauge-theory-container .subtitle {
    font-size: 0.95rem;
  }

  .gauge-theory-container .canvas-wrapper {
    padding: 12px;
    max-height: 400px;
  }

  .gauge-theory-container .canvas-overlay {
    top: 12px;
    left: 12px;
    padding: 12px;
  }

  .gauge-theory-container .controls-panel {
    padding: 16px;
    max-height: none;
  }

  .gauge-theory-container .explanation-section {
    padding: 20px;
  }

  .gauge-theory-container .explanation-section h2 {
    font-size: 1.4rem;
  }

  .gauge-theory-container .concept-grid {
    grid-template-columns: 1fr;
  }

  .gauge-theory-container .sm-structure {
    flex-direction: column;
    gap: 12px;
  }

  .gauge-theory-container .sm-connector {
    transform: rotate(90deg);
  }

  .gauge-theory-container .tab-buttons {
    flex-wrap: wrap;
  }

  .gauge-theory-container .tab-btn {
    padding: 8px 14px;
    font-size: 0.85rem;
  }

  .gauge-theory-container .formula-highlight {
    font-size: 1rem;
    padding: 16px;
  }
}

/* Touch-friendly controls for mobile */
@media (max-width: 768px) {
  .gauge-theory-container input[type="range"] {
    height: 8px;
  }

  .gauge-theory-container input[type="range"]::-webkit-slider-thumb {
    width: 22px;
    height: 22px;
  }

  .gauge-theory-container .gauge-btn,
  .gauge-theory-container .toggle-btn {
    padding: 14px 16px;
    font-size: 0.95rem;
  }
}
