/**
 * Debt Recovery Journal (DRJ) - Canonical Calculator Stylesheet
 *
 * Responsive styling, iframe sizing, and smooth loading shimmer for Ascend white-label calculators.
 * Matches the DRJ design system (colors, typography, rounded corners, soft shadows).
 */

.drj-calculator {
  margin: 2.5rem 0;
  width: 100%;
  max-width: 100%;
  position: relative;
  border-radius: 1.25rem;
  background: #ffffff;
  border: 1px solid #ded7cc;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
  overflow: hidden;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.drj-calculator:hover {
  border-color: #cfc6b8;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* Ensure Ascend iframes expand smoothly without horizontal overflow */
.drj-calculator iframe {
  width: 100% !important;
  max-width: 100% !important;
  border: none !important;
  display: block;
  min-height: 850px;
}

/* General Debt Relief calculator has a more compact default layout */
.drj-calculator[data-calculator="general-debt"] iframe,
.drj-calc-general-debt iframe {
  min-height: 600px;
}

/* Loading Shimmer State */
.drj-calculator-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 480px;
  width: 100%;
  padding: 2.5rem 1.5rem;
  box-sizing: border-box;
  background: #faf8f5;
  position: relative;
  overflow: hidden;
}

.drj-calc-shimmer {
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  animation: drjCalcShimmer 1.4s infinite ease-in-out;
}

@keyframes drjCalcShimmer {
  100% {
    transform: translateX(100%);
  }
}

.drj-calc-loading-text {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: #356b5b;
}

.drj-spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 3px solid #e0eae6;
  border-top-color: #356b5b;
  border-radius: 50%;
  animation: drjSpin 0.75s linear infinite;
}

@keyframes drjSpin {
  to {
    transform: rotate(360deg);
  }
}

/* Graceful Fallback / Error Box */
.drj-calc-fallback-box {
  padding: 2rem 1.5rem;
  text-align: center;
  color: #6b7280;
  font-size: 0.9rem;
  line-height: 1.5;
  background: #fffdf9;
  border: 1px dashed #ded7cc;
  border-radius: 1rem;
  margin: 1.5rem;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
  .drj-calculator {
    margin: 2rem 0;
    border-radius: 1rem;
  }

  .drj-calculator-loading-state {
    min-height: 380px;
    padding: 1.5rem 1rem;
  }
}
