/**
 * WMS ROI Calculator - Educational Content Styles
 * Modals, help buttons, accordions, glossary, and FAQ
 */

/* ========================================
   Help Button System
   ======================================== */

.calc-help-button {
  margin-left: 0.5rem;
  padding: 0.25rem 0.5rem;
  background: transparent;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  color: #64748b;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  vertical-align: middle;
}

.calc-help-button:hover {
  background: #f1f5f9;
  border-color: #667eea;
  color: #667eea;
}

.calc-help-button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.calc-help-button svg {
  width: 14px;
  height: 14px;
}

/* ========================================
   Modal System
   ======================================== */

.calc-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.calc-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.calc-modal-content {
  position: relative;
  background: white;
  padding: 2rem;
  width: 100%;
  max-width: 600px;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.calc-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e5e7eb;
}

.calc-modal-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.3;
}

.calc-modal-close {
  font-size: 2rem;
  font-weight: 300;
  color: #6b7280;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
  line-height: 1;
  flex-shrink: 0;
}

.calc-modal-close:hover {
  background: #f3f4f6;
  color: #374151;
}

.calc-modal-close:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.calc-modal-section {
  margin-bottom: 1.5rem;
}

.calc-modal-section:last-child {
  margin-bottom: 0;
}

.calc-modal-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.75rem;
}

.calc-modal-section-title svg {
  width: 20px;
  height: 20px;
  color: #667eea;
  flex-shrink: 0;
}

.calc-modal-section-content {
  color: #4b5563;
  line-height: 1.7;
  font-size: 0.9375rem;
}

.calc-modal-section-content p {
  margin: 0 0 0.75rem 0;
}

.calc-modal-section-content p:last-child {
  margin-bottom: 0;
}

.calc-modal-benchmarks {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem;
  margin-top: 0.75rem;
}

.calc-modal-benchmark-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #e5e7eb;
}

.calc-modal-benchmark-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.calc-modal-benchmark-item:first-child {
  padding-top: 0;
}

.calc-modal-benchmark-label {
  font-weight: 500;
  color: #374151;
}

.calc-modal-benchmark-value {
  font-weight: 600;
  color: #667eea;
}

.calc-modal-list {
  margin: 0.75rem 0 0 0;
  padding-left: 1.5rem;
}

.calc-modal-list li {
  margin-bottom: 0.5rem;
  color: #4b5563;
  line-height: 1.6;
}

.calc-modal-list li:last-child {
  margin-bottom: 0;
}

/* ========================================
   Metric Explanations
   ======================================== */

.calc-metric-explanation {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #e5e7eb;
  font-size: 0.875rem;
  color: #6b7280;
  line-height: 1.5;
}

.calc-explain-button {
  margin-top: 0.5rem;
  padding: 0.375rem 0.75rem;
  background: transparent;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  color: #667eea;
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.calc-explain-button:hover {
  background: #f9fafb;
  border-color: #667eea;
}

.calc-explain-button svg {
  width: 14px;
  height: 14px;
}

/* ========================================
   Calculation Breakdown Accordions
   ======================================== */

.calc-breakdown {
  margin-top: 2rem;
  padding: 2rem;
  background: #f9fafb;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

.calc-breakdown-title {
  margin: 0 0 1.5rem 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
}

.calc-accordion {
  margin-bottom: 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.calc-accordion:last-child {
  margin-bottom: 0;
}

.calc-accordion summary {
  padding: 1rem 1.5rem;
  cursor: pointer;
  font-weight: 600;
  color: #374151;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  transition: background 0.2s ease;
  list-style: none;
}

.calc-accordion summary::-webkit-details-marker {
  display: none;
}

.calc-accordion summary::after {
  content: '▼';
  font-size: 0.75rem;
  color: #6b7280;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-left: 1rem;
}

.calc-accordion[open] summary::after {
  transform: rotate(180deg);
}

.calc-accordion summary:hover {
  background: #f9fafb;
}

.calc-accordion-content {
  padding: 1.5rem;
  border-top: 1px solid #e5e7eb;
  line-height: 1.7;
  color: #4b5563;
}

.calc-accordion-content p {
  margin: 0 0 1rem 0;
}

.calc-accordion-content p:last-child {
  margin-bottom: 0;
}

.calc-accordion-formula {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 1rem;
  margin: 1rem 0;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', monospace;
  font-size: 0.875rem;
  color: #374151;
  overflow-x: auto;
}

.calc-accordion-breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid #e5e7eb;
}

.calc-accordion-breakdown-item:last-child {
  border-bottom: none;
}

.calc-accordion-breakdown-label {
  font-weight: 500;
  color: #4b5563;
}

.calc-accordion-breakdown-value {
  font-weight: 600;
  color: #111827;
  font-variant-numeric: tabular-nums;
}

/* ========================================
   Glossary Section
   ======================================== */

.calc-glossary {
  margin-top: 3rem;
  padding: 2rem;
  background: white;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

.calc-glossary-title {
  margin: 0 0 1.5rem 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #111827;
}

.calc-glossary-intro {
  color: #6b7280;
  line-height: 1.6;
  margin-bottom: 2rem;
  font-size: 0.9375rem;
}

.calc-glossary-list {
  display: grid;
  gap: 2rem;
}

.calc-glossary-term {
  display: grid;
  gap: 0.5rem;
}

.calc-glossary-term dt {
  font-weight: 700;
  color: #111827;
  font-size: 1.0625rem;
  margin: 0;
}

.calc-glossary-term dd {
  margin: 0;
  color: #4b5563;
  line-height: 1.7;
  padding-left: 1rem;
  border-left: 3px solid #667eea;
  font-size: 0.9375rem;
}

.calc-glossary-meta {
  margin-top: 0.5rem;
  padding-left: 1rem;
  font-size: 0.8125rem;
  color: #6b7280;
}

/* ========================================
   FAQ Section
   ======================================== */

.calc-faq {
  margin-top: 2rem;
  padding: 2rem;
  background: #f9fafb;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

.calc-faq-title {
  margin: 0 0 1.5rem 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #111827;
}

.calc-faq-item {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #e5e7eb;
}

.calc-faq-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.calc-faq-question {
  font-weight: 700;
  color: #111827;
  font-size: 1.0625rem;
  margin: 0 0 0.75rem 0;
  line-height: 1.4;
}

.calc-faq-answer {
  color: #4b5563;
  line-height: 1.7;
  font-size: 0.9375rem;
  margin: 0;
}

.calc-faq-answer p {
  margin: 0 0 0.75rem 0;
}

.calc-faq-answer p:last-child {
  margin-bottom: 0;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
  .calc-modal-content {
    width: 95%;
    margin: 10% auto;
    padding: 1.5rem;
    max-height: 85vh;
  }

  .calc-modal-title {
    font-size: 1.25rem;
  }

  .calc-breakdown {
    padding: 1.5rem;
  }

  .calc-accordion summary {
    padding: 0.875rem 1rem;
    font-size: 0.9375rem;
  }

  .calc-accordion-content {
    padding: 1rem;
    font-size: 0.875rem;
  }

  .calc-glossary {
    padding: 1.5rem;
  }

  .calc-glossary-title,
  .calc-faq-title {
    font-size: 1.25rem;
  }

  .calc-faq {
    padding: 1.5rem;
  }

  .calc-help-button {
    margin-left: 0.25rem;
    padding: 0.25rem 0.375rem;
    font-size: 0.8125rem;
  }
}

/* ========================================
   Utility Classes
   ======================================== */

.calc-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  background: #f3f4f6;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #374151;
  margin-left: 0.5rem;
}

.calc-badge-success {
  background: #d1fae5;
  color: #065f46;
}

.calc-badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.calc-badge-info {
  background: #dbeafe;
  color: #1e40af;
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
  .calc-modal,
  .calc-help-button,
  .calc-explain-button {
    display: none !important;
  }

  .calc-accordion[open] summary::after {
    display: none;
  }

  .calc-accordion-content {
    display: block !important;
  }
}
