/* Theory Article Common Styles */
.theory-article {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.65;
  color: var(--text);
}

.theory-hero {
  padding: 1rem 0 0;
}

.theory-hero h1 {
  line-height: 1.25;
  margin: 0.5rem 0 1rem;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 700;
}

.theory-intro {
  font-size: 1.06rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.theory-kpi {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.95rem;
  margin: 1rem 0;
}

.theory-kpi span {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 0.5rem;
  padding: 0.35rem 0.6rem;
  font-size: 0.9rem;
}

/* Theory Cards Grid */
.theory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.theory-card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 0.75rem;
  padding: 1.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.theory-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.theory-card h3 {
  margin: 0 0 0.75rem;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
}

.theory-card img {
  width: 100%;
  height: 400px;
  object-fit: contain;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  background: #000;
}

/* Theory Content Elements */
.theory-section {
  margin: 2.5rem 0 1.5rem;
}

.theory-section h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 1rem;
  color: var(--text);
  border-bottom: 2px solid var(--stroke);
  padding-bottom: 0.5rem;
}

.theory-section h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem;
  color: var(--text);
}

/* Enhanced Tip Boxes */
.theory-tip {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-left: 4px solid #3b82f6;
  border-radius: 0.5rem;
  padding: 1.25rem;
  margin: 1.5rem 0;
  box-shadow: var(--shadow);
}

.theory-tip.danger {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
}

.theory-tip.warning {
  border-left-color: #f59e0b;
  background: rgba(245, 158, 11, 0.05);
}

.theory-tip.success {
  border-left-color: #10b981;
  background: rgba(16, 185, 129, 0.05);
}

/* Tables */
.theory-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
  background: var(--card);
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.theory-table th,
.theory-table td {
  border-bottom: 1px solid var(--stroke);
  padding: 1rem 0.75rem;
  text-align: left;
}

.theory-table th {
  background: rgba(45, 124, 255, 0.1);
  font-weight: 600;
  color: var(--text);
}

.theory-table tr:last-child td {
  border-bottom: none;
}

/* Lists */
.theory-checklist {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.theory-checklist li {
  padding: 0.5rem 0 0.5rem 1.5rem;
  position: relative;
}

.theory-checklist li:before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #10b981;
  font-weight: bold;
}

.theory-checklist.danger li:before {
  content: "⚠";
  color: #ef4444;
}

/* Images and Media */
.theory-featured-img {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: 0.75rem;
  margin: 1.5rem 0;
  box-shadow: var(--shadow);
}

.theory-icon {
  width: 48px;
  height: 48px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

/* Formula Blocks */
.theory-formula {
  background: #0a1931;
  color: #fff;
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin: 1.5rem 0;
  box-shadow: var(--shadow-lg);
}

.theory-formula .label {
  display: block;
  font-size: 0.9rem;
  opacity: 0.8;
  margin-bottom: 0.5rem;
}

.theory-formula .eq {
  display: block;
  font-weight: 700;
  font-size: 1.3rem;
  font-family: monospace;
}

/* Video Containers */
.theory-video {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 0.75rem;
  margin: 1.5rem 0;
  box-shadow: var(--shadow);
}

.theory-video iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* TOC Navigation */
.theory-toc {
  background: var(--card);
  border: 1px dashed var(--stroke);
  border-radius: 0.5rem;
  padding: 1.25rem;
  margin: 1.5rem 0;
}

.theory-toc a {
  color: #2563eb;
  text-decoration: none;
  border-bottom: 1px dotted #2563eb;
}

.theory-toc a:hover {
  border-bottom-style: solid;
}

/* Practice CTA */
.theory-practice-cta {
  text-align: center;
  margin: 2.5rem 0;
  padding: 2rem;
  background: var(--card);
  border-radius: 1rem;
  border: 2px solid var(--stroke);
}

/* Dark Mode Adjustments */
html[data-theme="dark"] .theory-formula {
  background: #1e293b;
  color: #e2e8f0;
}

html[data-theme="dark"] .theory-toc a {
  color: #60a5fa;
  border-bottom-color: #60a5fa;
}

/* Responsive */
@media (max-width: 768px) {
  .theory-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .theory-card {
    padding: 1rem;
  }
  
  .theory-hero h1 {
    font-size: 1.8rem;
  }
  
  .theory-section h2 {
    font-size: 1.3rem;
  }
  
  .theory-table {
    font-size: 0.9rem;
  }
  
  .theory-table th,
  .theory-table td {
    padding: 0.75rem 0.5rem;
  }
}

@media (max-width: 480px) {
  .theory-article {
    padding: 0 15px;
  }
  
  .theory-kpi {
    flex-direction: column;
    align-items: flex-start;
  }
}

.theory-checklist a {
    text-decoration: underline;
}

.theory-article a {
  color: #1d6ef2;
  text-decoration: underline;
  text-decoration-color: rgba(29, 110, 242, 0.3);
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
  font-weight: 500;
}

.theory-article a:hover {
  color: #0a53be;
  text-decoration-color: rgba(29, 110, 242, 0.8);
}
