/**
 * Calculator Content Styles - Astro Compatible
 */

/* Base styles */
.blog-content {
  max-width: 100%;
  padding: 1rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #1a1a1a;
}

/* Typography */
.blog-content h1,
.blog-content h2,
.blog-content h3,
.blog-content h4 {
  font-weight: 700;
  color: #1a1a1a;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.blog-content h2 {
  font-size: 2rem;
  margin-top: 3rem;
}

.blog-content h3 {
  font-size: 1.5rem;
}

.blog-content h4 {
  font-size: 1.25rem;
  margin-top: 1rem;
}

.blog-content p {
  font-size: 1.125rem;
  line-height: 1.8;
  color: #4a4a4a;
  margin-bottom: 1.5rem;
}

.blog-content p.lead {
  font-size: 1.375rem;
  line-height: 1.7;
  color: #4b5563;
  margin-bottom: 2rem;
  font-weight: 500;
}

/* BOXES - Direct content, no nested divs */
.blog-content .warning-box,
.blog-content .info-box,
.blog-content .success-box {
  margin: 2rem 0;
  border-radius: 8px;
  padding: 1.5rem;
  display: block;
}

/* Default styles - inline styles will override these */
.blog-content .warning-box:not([style]) {
  background-color: #fef3c7;
  border: 2px solid #f59e0b;
}

.blog-content .info-box:not([style]) {
  background-color: #dbeafe;
  border: 2px solid #3b82f6;
}

.blog-content .success-box:not([style]) {
  background-color: #d1fae5;
  border: 2px solid #10b981;
}

/* Direct children of boxes */
.blog-content .warning-box > h4,
.blog-content .info-box > h4,
.blog-content .success-box > h3 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  color: #1a1a1a;
}

.blog-content .warning-box > p,
.blog-content .info-box > p,
.blog-content .success-box > p {
  margin-bottom: 0.75rem;
  color: #374151;
  font-size: 1rem;
}

.blog-content .warning-box > p:last-child,
.blog-content .info-box > p:last-child,
.blog-content .success-box > p:last-child {
  margin-bottom: 0;
}

/* Lists in boxes */
.blog-content .success-box ol,
.blog-content .success-box ul {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.blog-content .success-box li {
  margin-bottom: 0.75rem;
  color: #065f46;
}

/* Tables */
.blog-content table {
  width: 100%;
  margin: 2rem 0;
  border-collapse: collapse;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border-radius: 8px;
  overflow: hidden;
}

.blog-content th {
  background: #4f46e5;
  color: white;
  font-weight: 600;
  text-align: left;
  padding: 0.75rem 1rem;
}

.blog-content td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e5e7eb;
  color: #374151;
}

/* Feature cards */
.blog-content .feature-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1.5rem;
  margin: 2rem 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Highlight sections */
.blog-content .highlight-section {
  background: #f8f9fa;
  border-left: 4px solid #4f46e5;
  padding: 1.5rem;
  margin: 2rem 0;
  border-radius: 0 8px 8px 0;
}

/* Benefits grid */
.blog-content .benefits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.blog-content .benefit-item {
  display: flex;
  gap: 1rem;
  padding: 1.5rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.blog-content .benefit-icon {
  font-size: 2rem;
  flex-shrink: 0;
  line-height: 1;
}

.blog-content .benefit-content {
  flex: 1;
}

.blog-content .benefit-content h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: #1e293b;
}

.blog-content .benefit-content p {
  margin: 0;
  color: #64748b;
  font-size: 1rem;
}

/* Utility */
.blog-content .mt-6 {
  margin-top: 2.5rem;
}

/* Mobile */
@media (max-width: 768px) {
  /* CRITICAL: Force ALL content to fit within containers */
  /* NOTE: Do NOT include span or div - breaks KaTeX formula rendering! */
  .content-section,
  .content-text,
  .educational-content,
  .calculator-wrapper,
  .calculator-container,
  .subsection-title,
  .section-title,
  .advanced-content,
  .topic-card,
  .concept-card,
  .example-card,
  .tip-card,
  .mistake-card,
  .feature-card,
  .industry-card,
  p, h1, h2, h3, h4, h5, h6, li {
    max-width: 100% !important;
    box-sizing: border-box !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }

  /* Ensure text containers respect width */
  .content-section {
    width: 100% !important;
    padding: 1rem !important;
  }

  .content-text {
    width: 100% !important;
  }
}

@media (max-width: 640px) {
  .blog-content {
    padding: 1rem;
  }
  
  .blog-content h2 {
    font-size: 1.75rem;
  }
  
  .blog-content h3 {
    font-size: 1.375rem;
  }
  
  .blog-content .benefits-grid {
    grid-template-columns: 1fr;
  }
  
  .blog-content table {
    font-size: 0.875rem;
  }
  
  .blog-content th,
  .blog-content td {
    padding: 0.5rem;
  }
}

/* NUCLEAR OPTION - Force all content in boxes to display */
.blog-content .warning-box,
.blog-content .info-box,
.blog-content .success-box {
  /* Force minimum height */
  min-height: 80px !important;
  
  /* Ensure it's a container */
  position: relative !important;
  overflow: visible !important;
}

/* Target direct children that might be hidden */
.blog-content .warning-box > *,
.blog-content .info-box > *,
.blog-content .success-box > * {
  position: relative !important;
  z-index: 1 !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Specifically target h4 and p elements */
.blog-content .warning-box h4,
.blog-content .info-box h4,
.blog-content .success-box h3,
.blog-content .warning-box p,
.blog-content .info-box p,
.blog-content .success-box p {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  color: inherit !important;
  margin-bottom: 0.5rem !important;
}

/* Fix list styling in success box */
.blog-content .success-box ol,
.blog-content .success-box ul {
  display: block !important;
  margin: 1rem 0 !important;
  padding-left: 2rem !important;
}

.blog-content .success-box li {
  display: list-item !important;
  margin-bottom: 0.5rem !important;
}

/* Debug - add border to all direct children */
.blog-content .warning-box > *,
.blog-content .info-box > *,
.blog-content .success-box > * {
  /* Uncomment to debug: */
  /* border: 1px solid red !important; */
}