/* HELOC Calculator Styles */

/* Hide utility class */
.is-hidden {
  display: none !important;
}

/* Main container override */
main.container {
  max-width: 1100px;
  margin: 1.2rem auto;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
}

/* Back link */
.back-link {
  align-self: flex-start;
  color: #7a5af8;
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 0.5rem;
}

.back-link:hover {
  text-decoration: underline;
}

/* HELOC layout - 2 column grid */
.heloc-layout {
  display: grid;
  grid-template-columns: 45fr 55fr;
  gap: 1.2rem;
  width: 100%;
}

@media (max-width: 900px) {
  .heloc-layout {
    grid-template-columns: 1fr;
  }

  section.calc-section {
    padding: 1.5rem;
  }

  section.calc-section h2 {
    font-size: 1.3rem;
  }
}

/* Calculator section */
section.calc-section {
  background: linear-gradient(135deg, rgba(248,245,255,0.95), rgba(233,229,255,0.92));
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
  padding: 2rem;
  border: 1px solid rgba(122,90,248,0.15);
  overflow: hidden;
}

section.calc-section form {
  width: 100%;
  max-width: 100%;
}

section.calc-section h2 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  color: #1f1f38;
  font-size: 1.5rem;
  font-weight: 700;
}

/* Form grid - 2 columns */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  width: 100%;
  max-width: 100%;
}

/* Keep 2 columns on mobile like other calculators */
@media (max-width: 640px) {
  .form-grid {
    gap: 0.75rem;
  }

  /* Reduce padding on mobile */
  section.calc-section {
    padding: 1.25rem;
  }

  .form-group label {
    font-size: 0.8rem;
  }

  .form-group input[type="number"] {
    padding: 0.6rem;
    font-size: 0.95rem;
  }

  .inline-help {
    font-size: 0.7rem;
  }
}

/* Form groups */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-weight: 600;
  color: #4a4a6a;
  font-size: 0.9rem;
}

.form-group input[type="number"] {
  padding: 0.75rem;
  border: 2px solid rgba(122,90,248,0.2);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s ease;
  background: rgba(255,255,255,0.95);
}

.form-group input[type="number"]:focus {
  outline: none;
  border-color: #7a5af8;
}

.checkbox-group {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.75rem;
  grid-column: 1 / -1 !important;
  margin: 0 !important;
  padding: 0.75rem !important;
  background: rgba(122, 90, 248, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(122, 90, 248, 0.15);
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow: visible !important;
}

.checkbox-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-width: 20px;
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: #7a5af8;
}

.checkbox-group label {
  margin: 0;
  cursor: pointer;
  font-weight: 600;
  color: #1f1f38 !important;
  font-size: 0.95rem;
  line-height: 1.4;
  flex: 1;
  white-space: normal;
  word-wrap: break-word;
  overflow: visible;
  display: block;
}

.inline-help {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.2rem;
  font-style: italic;
}

.error-message {
  margin-top: 0.5rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.05));
  border-left: 4px solid #ef4444;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #991b1b;
  animation: slideDown 0.3s ease-out;
}

.error-message strong {
  color: #7f1d1d;
  font-weight: 700;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Calculate button */
button#calcBtn {
  background: linear-gradient(120deg, #8d7ee8, #7a5af8);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(122,90,248,0.35);
  transition: all 0.25s ease;
  width: 100%;
}

button#calcBtn:hover {
  transform: scale(1.02);
  background: linear-gradient(120deg, #a471ff, #6d68f6);
}

/* Scroll Indicator */
.scroll-indicator {
  display: none;
  text-align: center;
  padding: 1.5rem 0;
  margin-top: 1rem;
  animation: fadeIn 0.5s ease-in;
}

.scroll-indicator.visible {
  display: block;
}

.scroll-arrow {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
  border-top: 20px solid #7a5af8;
  animation: bounce 2s infinite;
  filter: drop-shadow(0 0 8px rgba(122, 90, 248, 0.6));
}

.scroll-text {
  margin-top: 0.5rem;
  color: #7a5af8;
  font-weight: 600;
  font-size: 0.9rem;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(10px);
  }
  60% {
    transform: translateY(5px);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Result Section */
#result {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
  padding: 0;
  overflow: hidden;
  display: none;
}

.result-header {
  background: linear-gradient(135deg, #9b6bff, #7a5af8);
  color: #fff;
  padding: 1.5rem 2rem;
  font-size: 1.15rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.result-header-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Share Button */
.share-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.share-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.share-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  padding: 0.5rem;
  z-index: 1000;
  display: none;
  min-width: 200px;
  max-width: calc(100vw - 2.5rem);
}

.share-menu.show {
  display: block;
}

.share-option {
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #333;
  font-size: 0.95rem;
}

.share-option:hover {
  background: #f3f4f6;
}

.share-option svg {
  width: 20px;
  height: 20px;
}

.share-container {
  position: relative;
  margin-left: auto;
}

@media (max-width: 640px) {
  .result-header {
    align-items: flex-start;
  }
  .share-container {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    margin-top: 0.75rem;
  }
  .share-menu {
    left: auto;
    right: 0;
    min-width: 0;
    width: calc(100vw - 2.5rem);
    max-width: 280px;
  }
}

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: #10b981;
  color: #fff;
  padding: 1rem 2rem;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  display: none;
  z-index: 10000;
}

.toast.show {
  display: block;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translate(-50%, 20px);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

/* Result Body */
.result-body {
  padding: 2rem;
}

.price-display {
  text-align: center;
  padding: 2rem;
  background: linear-gradient(135deg, rgba(155,107,255,0.1), rgba(122,90,248,0.05));
  border-radius: 12px;
  margin-bottom: 2rem;
}

.price-display h3 {
  color: #6b7280;
  font-size: 0.95rem;
  margin: 0 0 0.5rem 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.price-display .price {
  font-size: 3rem;
  font-weight: 800;
  color: #7a5af8;
  margin: 0;
}

/* Payment Cards */
.payment-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

/* Keep 2 columns on mobile for payment cards */

.payment-card {
  padding: 1.25rem;
  border-radius: 10px;
  text-align: center;
  border: 2px solid;
  position: relative;
  overflow: hidden;
}

.payment-card.draw-period {
  background: linear-gradient(135deg, rgba(59,130,246,0.15), rgba(96,165,250,0.1));
  border-color: rgba(59,130,246,0.4);
}

.payment-card.repay-period {
  background: linear-gradient(135deg, rgba(168,85,247,0.15), rgba(192,132,252,0.1));
  border-color: rgba(168,85,247,0.4);
}

.payment-card h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.75rem 0;
  color: #6b7280;
}

.payment-card .amount {
  font-size: 2rem;
  font-weight: 800;
  margin: 0 0 0.5rem 0;
  color: #1f2937;
}

/* Result Grid */
.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

@media (max-width: 640px) {
  .result-grid {
    gap: 0.75rem;
  }

  /* Optimize results for mobile */
  .result-body {
    padding: 1rem;
  }

  .price-display {
    padding: 1.25rem;
  }

  .price-display .price {
    font-size: 2.25rem;
  }

  .payment-card {
    padding: 1rem;
  }

  .payment-card h4 {
    font-size: 0.75rem;
  }

  .payment-card .amount {
    font-size: 1.5rem;
  }

  .result-section {
    padding: 1rem;
  }

  .result-section h3 {
    font-size: 0.95rem;
  }

  .metric-row {
    padding: 0.6rem 0;
  }

  .metric-label {
    font-size: 0.8rem;
  }

  .metric-value {
    font-size: 0.85rem;
  }

  /* Reduce large emphasized values */
  .metric-value[style*="font-size: 1.2rem"] {
    font-size: 1rem !important;
  }
}

.result-section {
  background: #f9fafb;
  padding: 1.5rem;
  border-radius: 10px;
}

.result-section h3 {
  font-size: 1.1rem;
  margin: 0 0 1rem 0;
  color: #1f2937;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.metric-row:last-child {
  border-bottom: none;
}

.metric-label {
  color: #6b7280;
  font-weight: 500;
}

.metric-value {
  font-weight: 700;
  color: #1f2937;
}

/* Next Steps CTA */
.next-steps-cta {
  margin-top: 2rem;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-radius: 10px;
  text-align: center;
  font-size: 0.95rem;
  color: #92400e;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.next-steps-cta strong {
  color: #78350f;
  margin-right: 0.5rem;
}

.next-steps-cta a {
  color: #7a5af8;
  text-decoration: underline;
  font-weight: 600;
  margin: 0 0.25rem;
}

.next-steps-cta a:hover {
  color: #6d68f6;
}

/* Chart Container */
.left-payment-composition {
  margin-top: 1.5rem;
}

.left-payment-composition h3 {
  text-align: left !important;
  margin: 1rem 0;
}

.chart-container-sm {
  position: relative;
  height: 320px;
  margin: 0;
  max-width: 100%;
}

/* Methodology Section */
.methodology-scroll-indicator {
  display: none;
  text-align: center;
  padding: 0;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  animation: fadeIn 0.5s ease-in;
}

.methodology-scroll-indicator.visible {
  display: block;
}

.methodology-scroll-arrow {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
  border-top: 20px solid #7a5af8;
  animation: bounce 2s infinite, pulse 2s infinite;
  filter: drop-shadow(0 0 8px rgba(122, 90, 248, 0.6));
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.methodology-scroll-text {
  margin-top: 0.5rem;
  color: #7a5af8;
  font-weight: 600;
  font-size: 0.9rem;
}

.methodology-wrapper {
  width: 100%;
  margin-top: 2rem;
  position: relative;
  animation: slideUpMethodology 0.6s ease-out;
}

@keyframes slideUpMethodology {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.methodology-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
  padding: 0;
  border: 2px solid #e5e7eb;
}

.methodology-banner {
  background: linear-gradient(135deg, #7a5af8, #9b6bff);
  color: #fff;
  padding: 1rem 2rem;
  text-align: center;
  font-weight: 600;
  font-size: 1.05rem;
  border-radius: 14px 14px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.methodology-toggle {
  background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
  border: none;
  border-radius: 0;
  padding: 1rem 2rem;
  width: 100%;
  font-size: 1rem;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.3s ease;
}

.methodology-toggle:hover {
  background: linear-gradient(135deg, #e5e7eb, #d1d5db);
}

.methodology-toggle .icon {
  font-size: 1.2rem;
  transition: transform 0.3s ease;
}

.methodology-toggle.active .icon {
  transform: rotate(180deg);
}

.methodology-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s ease;
  padding: 0 2rem;
}

.methodology-content.expanded {
  max-height: 5000px;
  padding: 1.5rem 2rem 2rem 2rem;
}

.methodology-content h3 {
  color: #7a5af8;
  font-size: 1.1rem;
  margin: 1.5rem 0 0.75rem 0;
}

.methodology-content h3:first-child {
  margin-top: 0;
}

.methodology-content p {
  color: #555;
  line-height: 1.7;
  margin: 0.75rem 0;
}

.methodology-content ul {
  margin: 0.75rem 0;
  padding-left: 1.5rem;
}

.methodology-content li {
  color: #555;
  line-height: 1.7;
  margin: 0.5rem 0;
}

.methodology-content strong {
  color: #333;
  font-weight: 600;
}

/* Legal Disclaimer */
.legal-disclaimer {
  width: 100%;
  max-width: 920px;
  margin: 0 auto 3rem;
  background: #fef7f1;
  border: 1px solid rgba(249,115,22,0.3);
  border-radius: 16px;
  padding: 1.75rem 2rem;
  box-shadow: 0 15px 40px rgba(120,53,15,0.1);
  color: #7a3412;
}

.legal-disclaimer h3 {
  margin: 0 0 1.5rem 0;
  font-size: 1.4rem;
  color: #92400e;
}

.disclaimer-content {
  display: grid;
  gap: 1.25rem;
}

.disclaimer-section h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  color: #92400e;
  font-weight: 600;
}

.disclaimer-section p {
  margin: 0;
  line-height: 1.6;
  font-size: 0.95rem;
  color: #7a3412;
}

@media (max-width: 768px) {
  .legal-disclaimer {
    padding: 1.5rem;
  }

  .legal-disclaimer h3 {
    font-size: 1.2rem;
  }

  .disclaimer-section h4 {
    font-size: 0.95rem;
  }
}

/* FAQ Section */
.faq-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.faq-item {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1rem 1.5rem;
  transition: all 0.2s ease;
}

.faq-item:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.faq-item summary {
  font-weight: 600;
  cursor: pointer;
  color: #1f2937;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: '+';
  font-size: 1.5rem;
  color: #7a5af8;
  transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-item p {
  margin-top: 0.75rem;
  color: #6b7280;
  line-height: 1.7;
}

/* SEO Content */
.seo-content {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
  padding: 2rem;
  margin-bottom: 2rem;
  line-height: 1.8;
  color: #4b4b63;
}

.seo-content h2 {
  color: #1f1f38;
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: 1.8rem;
}

.seo-content h3 {
  color: #1f1f38;
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

.seo-content ul,
.seo-content ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.seo-content li {
  margin-bottom: 0.75rem;
}

.seo-content strong {
  color: #7a5af8;
}

.seo-content a {
  color: #2196F3;
  text-decoration: underline;
}

.seo-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.seo-content table th,
.seo-content table td {
  padding: 0.75rem;
  text-align: left;
  border: 1px solid #e5e7eb;
}

.seo-content table th {
  background: #f3f4f6;
  font-weight: 600;
}

.seo-content table tr:nth-child(even) {
  background: #f9fafb;
}

/* Calculator Overview */
.calculator-overview {
  background: linear-gradient(135deg, rgba(219,234,254,0.3), rgba(243,232,255,0.3));
  border-radius: 14px;
  padding: 2rem;
  margin-bottom: 2rem;
  border: 1px solid rgba(122,90,248,0.15);
}

.calculator-overview h2 {
  color: #1f1f38;
  margin-top: 0;
}

.how-to-steps ol {
  margin: 1.5rem 0;
  padding-left: 1.5rem;
}

.how-to-steps li {
  margin-bottom: 1rem;
  line-height: 1.7;
}

/* Intent Intro */
.intent-intro {
  background: linear-gradient(135deg, rgba(219,234,254,0.3), rgba(243,232,255,0.3));
  border-radius: 14px;
  padding: 2rem;
  margin-bottom: 2rem;
  border: 1px solid rgba(122,90,248,0.15);
}

.intent-intro h2 {
  color: #1f1f38;
  margin-top: 0;
}

.intent-intro p {
  line-height: 1.7;
  color: #4b4b63;
}

.intent-intro a {
  color: #7a5af8;
  text-decoration: underline;
}
