/* Fix and Flip 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: 1rem;
}

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

/* Flip layout - 2 column grid */
.flip-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  width: 100%;
}

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

/* Calculator card */
.calculator-card {
  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: 1.2rem;
  border: 1px solid rgba(122,90,248,0.15);
  transition: transform 0.25s ease;
}

.calculator-card h3 {
  margin-bottom: 0.4rem !important;
  margin-top: 0.8rem !important;
  font-size: 1rem;
}

.calculator-card h3:first-child {
  margin-top: 0 !important;
}

.calculator-card:hover {
  transform: translateY(-2px);
}

/* Form grid - 2 columns */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem 0.9rem;
}

@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    gap: 0.85rem;
  }
}

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

.form-group label {
  font-weight: 600;
  font-size: 0.85rem;
  color: #333;
}

.form-group input[type="number"] {
  border: 1px solid #ddd;
  padding: 0.42rem 0.6rem;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  background: #fff;
}

.form-group input[type="number"]:focus {
  outline: none;
  border-color: #7a5af8;
  box-shadow: 0 0 0 2px rgba(122,90,248,0.2);
}

.inline-help {
  font-size: 0.8rem;
  color: #6b7280;
}

/* Calculate button */
button#calcBtn {
  margin-top: 0.72rem;
  background: linear-gradient(120deg, #b68eff, #7a7df8);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 0.6rem;
  font-size: 0.95rem;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.25s ease;
  width: 100%;
}

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

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

#result.is-hidden {
  display: none;
}

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

.result-header-sub {
  width: 100%;
  padding-top: 0.75rem;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

/* Badge */
.badge {
  display: inline-block;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}

.badge.good {
  background: #10b981;
  color: #fff;
}

.badge.warn {
  background: #f59e0b;
  color: #fff;
}

.badge.bad {
  background: #ef4444;
  color: #fff;
}

/* Share UI */
.share-container {
  position: relative;
}

.share-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  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: white;
  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;
}

.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;
}

/* Toast */
.share-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #10b981;
  color: white;
  padding: 1rem 2rem;
  border-radius: 8px;
  font-weight: 600;
  box-shadow: 0 10px 40px rgba(16, 185, 129, 0.4);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 10000;
}

.share-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Next steps CTA */
.next-steps-cta {
  padding: 1rem 2rem;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-left: 4px solid #f59e0b;
  border-radius: 0;
  font-size: 0.95rem;
  color: #78350f;
}

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

.next-steps-cta a {
  color: #7a5af8;
  font-weight: 600;
  text-decoration: none;
}

.next-steps-cta a:hover {
  text-decoration: underline;
}

/* Result KPIs */
.result-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.6rem;
  padding: 1.2rem;
}

.result-kpi {
  padding: 0.9rem;
  border-radius: 12px;
  text-align: center;
  color: white;
}

.result-kpi.profit {
  background: linear-gradient(135deg, #10b981, #059669);
}

.result-kpi.profit.negative {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.result-kpi.roi {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.result-kpi.roi.negative {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.result-kpi.cash {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.result-kpi.mao {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.result-kpi.mao.negative {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.result-kpi-label {
  font-size: 0.8rem;
  margin-bottom: 0.3rem;
  opacity: 0.95;
}

.result-kpi-value {
  font-size: 1.35rem;
  font-weight: 700;
}

/* Breakdown table */
.breakdown-table {
  padding: 0 1.2rem 1.2rem;
}

.breakdown-table table {
  width: 100%;
  border-collapse: collapse;
}

.breakdown-table th,
.breakdown-table td {
  padding: 0.45rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.breakdown-table th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
}

.breakdown-table td {
  color: #1f2937;
}

.breakdown-table .total-row {
  font-weight: 700;
  background: #f3f4f6;
}

/* Sensitivity section */
.sensitivity-section {
  padding: 0 1.2rem 1.2rem;
}

.sensitivity-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
  color: #333;
}

.sensitivity-sliders {
  display: grid;
  gap: 0.6rem;
}

.slider-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.slider-group label {
  font-weight: 600;
  font-size: 0.8rem;
  color: #333;
  display: flex;
  justify-content: space-between;
}

.slider-group input[type="range"] {
  width: 100%;
}

/* Methodology Section */
#methodologySection {
  margin-top: 0 !important;
  clear: both;
}

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

@keyframes slideUp {
  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: white;
  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: 3000px;
  padding: 1.5rem 2rem 2rem 2rem;
}

/* Intent intro */
.intent-intro {
  background: linear-gradient(135deg, #fff5f1, #fff);
  border: 1px solid rgba(234, 88, 12, 0.15);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  box-shadow: 0 6px 15px rgba(234, 88, 12, 0.05);
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

.intent-intro h2 {
  font-size: 1.2rem;
  margin-bottom: 0.3rem;
  color: #8b2c05;
}

.intent-intro p {
  color: #5a2d17;
  line-height: 1.4;
  margin: 0;
  font-size: 0.85rem;
}

/* 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;
}

/* Mobile responsiveness */
@media (max-width: 640px) {
  .result-kpis {
    grid-template-columns: 1fr;
  }

  .calculator-card {
    padding: 0.9rem;
  }
}
