/* =========================================================
   Ethereum Bliss – Borrow & Calculators (borrow.css)
   Page-specific styling for index.html
   ========================================================= */

/* -------------------------
   Page overflow fix (this page only)
   ------------------------- */

body {
  overflow-x: hidden; /* remove horizontal scroll for this page */
}

.main {
  overflow-x: hidden; /* ensure inner content can't create side scroll */
}

/* -------------------------
   Step layout
   ------------------------- */

.loan-steps {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.steps-header {
  margin-bottom: 0.2rem;
}

.steps-header .panel-title {
  margin-bottom: 0.35rem;
}

.steps-header .panel-intro {
  margin-bottom: 0.4rem;
}

/* -------------------------
   Profile options
   ------------------------- */

.profile-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.4rem;
}

.profile-card {
  position: relative;
  border-radius: 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.95));
  padding: 0.7rem 0.75rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  text-align: left;
  color: #e5e7eb;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.9);
  transition:
    transform 0.16s ease-out,
    box-shadow 0.2s ease-out,
    border-color 0.18s ease-out,
    background 0.2s ease-out;
}

.profile-card::before {
  content: "";
  position: absolute;
  inset: -35%;
  background: radial-gradient(circle at top left, rgba(124, 58, 237, 0.25), transparent 65%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-out;
}

.profile-card:hover {
  transform: translateY(-1px);
  border-color: rgba(129, 140, 248, 0.9);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.95);
}

.profile-card:hover::before {
  opacity: 1;
}

.profile-card.is-active {
  border-color: rgba(250, 204, 21, 0.85);
  background: radial-gradient(circle at top left, rgba(30, 64, 175, 0.8), rgba(15, 23, 42, 0.98));
  box-shadow: 0 18px 46px rgba(37, 99, 235, 0.85);
}

.profile-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #f9fafb;
}

.profile-limit {
  font-size: 0.8rem;
  color: #e5e7eb;
}

.profile-term {
  font-size: 0.78rem;
  color: #cbd5f5;
}

.profile-hint {
  margin: 0.4rem 0 0.6rem;
  font-size: 0.8rem;
  color: #cbd5f5;
}

/* -------------------------
   ETH summary strip
   ------------------------- */

.eth-summary-strip {
  margin-top: 0.15rem;
  padding: 0.55rem 0.7rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.96));
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

.eth-summary-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.eth-summary-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #9ca3af;
}

.eth-summary-value {
  font-size: 0.86rem;
  color: #f9fafb;
}

/* -------------------------
   Desired loan amount input
   ------------------------- */

.shared-loan {
  margin-top: 0.8rem;
}

.step-subtitle {
  margin: 0 0 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #f9fafb;
}

.loan-input-row {
  display: flex;
  align-items: center;
  border-radius: 0.8rem;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.98);
  overflow: hidden;
  max-width: 320px;
}

.input-prefix {
  padding: 0.5rem 0.7rem;
  font-size: 0.9rem;
  color: #cbd5f5;
  border-right: 1px solid rgba(148, 163, 184, 0.45);
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.98), rgba(30, 64, 175, 0.75));
}

.loan-input-row input[type="number"] {
  border: none;
  background: transparent;
  padding-left: 0.6rem;
}

.field-hint-inline {
  margin-top: 0.3rem;
  font-size: 0.78rem;
  color: #cbd5f5;
}

/* -------------------------
   Results wrapper
   ------------------------- */

.loan-results-wrapper {
  margin-top: 1.1rem;
  padding-top: 0.4rem;
  border-top: 1px dashed rgba(148, 163, 184, 0.35);
}

.results-title {
  margin-bottom: 0.6rem;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

/* -------------------------
   Result cards
   ------------------------- */

.result-card {
  position: relative;
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.95));
  padding: 0.85rem 0.95rem 0.9rem;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.9);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  overflow: hidden;
  transition:
    transform 0.16s ease-out,
    box-shadow 0.22s ease-out,
    border-color 0.2s ease-out;
}

.result-card::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: radial-gradient(circle at top left, rgba(96, 165, 250, 0.28), transparent 65%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-out;
}

.result-card:hover {
  transform: translateY(-2px);
  border-color: rgba(129, 140, 248, 0.85);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.95);
}

.result-card:hover::before {
  opacity: 1;
}

.result-collateral::before {
  background: radial-gradient(circle at top left, rgba(59, 130, 246, 0.32), transparent 65%);
}

.result-noncollateral::before {
  background: radial-gradient(circle at top left, rgba(239, 68, 68, 0.32), transparent 65%);
}

.result-header h3 {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #f9fafb;
}

.result-header p {
  margin: 0;
  font-size: 0.8rem;
  color: #cbd5f5;
}

/* -------------------------
   Result numbers
   ------------------------- */

.result-numbers {
  display: grid;
  gap: 0.4rem;
}

.number-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.45rem;
}

.number-label {
  font-size: 0.8rem;
  color: #d1d5db;
}

.number-value-group {
  text-align: right;
}

.number-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: #f9fafb;
}

.number-subvalue {
  font-size: 0.74rem;
  color: #bfdbfe;
}

.number-value.highlight {
  color: #facc15;
}

.number-value.accent {
  color: #4ade80;
}

/* -------------------------
   Visual breakdown – bars
   ------------------------- */

.visual-breakdown {
  margin-top: 0.2rem;
}

.visual-title {
  margin: 0 0 0.3rem;
  font-size: 0.82rem;
  color: #e5e7eb;
}

.bar-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.bar-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(148, 163, 184, 0.45);
  overflow: hidden;
  position: relative;
}

/* segments: JS sets width (%).
   Green grows from LEFT, purple grows from RIGHT. */
.bar-segment {
  position: absolute;
  top: 0;
  bottom: 0;
  transition: width 0.25s ease-out;
}

/* Holdings = green, anchored left */
.bar-holdings {
  left: 0;
  transform-origin: left center;
  background: linear-gradient(90deg, #16a34a, #22c55e);
  box-shadow: 0 0 14px rgba(34, 197, 94, 0.7);
}

/* Loan = purple, anchored right */
.bar-loan {
  right: 0;
  transform-origin: right center;
  background: linear-gradient(90deg, #7c3aed, #a855f7);
  box-shadow: 0 0 14px rgba(124, 58, 237, 0.8);
}

.bar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  font-size: 0.78rem;
  color: #cbd5f5;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

/* Match legend colours to the bars */
.legend-holdings {
  background: linear-gradient(135deg, #16a34a, #22c55e);
}

.legend-loan {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
}

/* -------------------------
   Interact button
   ------------------------- */

.result-footer {
  margin-top: 0.3rem;
}

.interact-button {
  border-radius: 999px;
  border: 1px solid transparent;
  background: radial-gradient(circle at top left, #a855f7, #7c3aed);
  color: #f9fafb;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  box-shadow: 0 16px 40px rgba(124, 58, 237, 0.8);
  transition:
    transform 0.16s ease-out,
    box-shadow 0.22s ease-out,
    background-position 0.2s ease-out,
    opacity 0.15s ease-out;
  background-size: 140% 140%;
  background-position: 0% 50%;
}

/* Make sure the span text looks good even without Tailwind */
.interact-button span {
  font-size: 1.125rem;
  line-height: 1.4;
}

.interact-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 22px 60px rgba(124, 58, 237, 0.95);
  background-position: 100% 50%;
}

/* Fallback flex utilities in case Tailwind isn't loaded */
.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.w-full {
  width: 100%;
}

.h-full {
  height: 100%;
}

/* -------------------------
   After calculators section
   ------------------------- */

#after-calculators .columns {
  margin-top: 0.4rem;
}

#after-calculators .column h3 {
  font-size: 0.9rem;
}

#after-calculators .column p {
  font-size: 0.8rem;
}

/* -------------------------
   Responsive
   ------------------------- */

@media (max-width: 1024px) {
  .profile-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
  }

  .eth-summary-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .results-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  .profile-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .eth-summary-strip {
    grid-template-columns: minmax(0, 1fr);
  }

  .loan-input-row {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .profile-options {
    grid-template-columns: minmax(0, 1fr);
  }

  .loan-results-wrapper {
    margin-top: 0.9rem;
  }

  .result-card {
    padding: 0.8rem 0.85rem 0.85rem;
  }

  .interact-button span {
    font-size: 1rem;
  }
}
