/* View transition */
@view-transition {
  navigation: auto;
}

/* Global layout & typography */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* HEADER */

/* HEADER */

.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 4px 20px rgba(5, 150, 105, 0.15);
  backdrop-filter: blur(10px);
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.header-logo {
  height: 40px;
  width: auto;
  display: block;
  border-radius: 8px;
}

.header-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: #ffffff;
}

/* Desktop nav: center */
.nav-links.desktop-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.desktop-main-nav {
  flex: 1;
  justify-content: center;
}

.nav-links.desktop-nav a {
  color: #f9fafb;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  position: relative;
  transition: all 0.25s ease;
}

.nav-links.desktop-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: #14b8a6;
  transition: width 0.25s ease;
}

.nav-links.desktop-nav a:hover {
  color: #e5e7eb;
}

.nav-links.desktop-nav a:hover::after {
  width: 100%;
}

/* Desktop "More" dropdown (right) */
.desktop-more-wrapper {
  position: relative;
}

.more-toggle {
  background: none;
  border: none;
  color: #f9fafb;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
}

.more-toggle:hover {
  color: #e5e7eb;
}

.dropdown-panel {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 12px);
  min-width: 230px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  padding: 8px 0;
  z-index: 1100;
}

.dropdown-panel a {
  display: block;
  padding: 10px 18px;
  font-size: 0.9rem;
  color: #374151;
  text-decoration: none;
  transition: all 0.2s ease;
}

.dropdown-panel a:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #ffffff;
  padding-left: 24px;
}

.desktop-more-wrapper.open .dropdown-panel {
  display: block;
}

/* Mobile nav */

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: #ffffff;
  font-size: 26px;
  cursor: pointer;
}

.mobile-nav {
  display: none;
  background: #065f46;
  padding: 10px 20px 16px;
}

.mobile-nav.open {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mobile-nav a {
  color: #e5e7eb;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
}

/* Header responsive behaviour */

@media (max-width: 768px) {
  .header-inner {
    padding: 10px 16px;
  }

  .nav-links.desktop-nav {
    display: none;      /* hide desktop links */
  }

  .desktop-more-wrapper {
    display: none;      /* hide "More" on mobile, it moves into the slide-down menu */
  }

  .mobile-menu-btn {
    display: block;
  }
}


/* PAGE HEADER / HERO */

.page-header {
  color: white;
  text-align: center;
  padding: 80px 20px 90px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.page-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120'><path d='M0,0 Q300,60 600,30 T1200,0 L1200,120 L0,120 Z' fill='rgba(255,255,255,0.05)'/></svg>")
    repeat-x bottom;
  background-size: 1200px 120px;
  opacity: 0.3;
}

.hero-emoji {
  font-size: 64px;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}

.page-header h1 {
  position: relative;
  z-index: 1;
  font-size: 3.3rem;
  font-weight: 900;
  margin: 0 0 12px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.page-header p {
  position: relative;
  z-index: 1;
  font-size: 1.2rem;
  max-width: 720px;
  margin: 0 auto;
}

/* Floating animation */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-18px); }
}

.float-animation {
  animation: float 3s ease-in-out infinite;
}

/* MAIN CALCULATOR LAYOUT */

.calculator-container {
  max-width: 1400px;
  margin: -60px auto 70px;
  padding: 0 20px;
  position: relative;
  z-index: 5;
}

.calculator-grid {
  display: grid;
  grid-template-columns: 1.05fr 1.1fr;
  gap: 24px;
}

.calculator-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 36px 34px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  animation: slideUp 0.6s ease;
}

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

.card-title {
  font-size: 1.7rem;
  font-weight: 800;
  color: #667eea;
  margin: 0 0 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* FORM INPUTS */

.input-section {
  margin-bottom: 22px;
}

.input-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 10px;
  font-size: 0.95rem;
}

.input-wrapper {
  position: relative;
}

.input-field {
  width: 100%;
  padding: 14px 18px;
  border-radius: 12px;
  border: 2px solid #cbd5e0;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.25s ease;
}

.input-field:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.16);
}

.input-prefix,
.input-suffix {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 600;
  font-size: 0.98rem;
  color: #4a5568;
  pointer-events: none;
}

.input-prefix {
  left: 18px;
}

.input-suffix {
  right: 18px;
}

.input-field.with-prefix {
  padding-left: 48px;
}

.input-field.with-suffix {
  padding-right: 80px;
}

.select-field {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid #cbd5e0;
  border-radius: 12px;
  font-size: 0.97rem;
  font-weight: 600;
  color: #2d3748;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.25s ease;
}

.select-field:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.16);
}

/* Sliders */

.slider-container {
  margin-top: 10px;
}

.slider {
  width: 100%;
  height: 8px;
  border-radius: 5px;
  background: linear-gradient(to right, #667eea 0%, #764ba2 100%);
  outline: none;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.slider:hover {
  opacity: 1;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.45);
}

.slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.45);
}

/* Calculate button */

.calculate-btn {
  width: 100%;
  margin-top: 26px;
  padding: 18px 20px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(102, 126, 234, 0.4);
  transition: all 0.2s ease;
}

.calculate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 22px rgba(102, 126, 234, 0.55);
}

.calculate-btn:active {
  transform: scale(0.98);
}

/* RESULTS */

.results-section {
  display: none;
}

.results-section.show {
  display: block;
}

.result-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}

.result-box {
  background: linear-gradient(135deg, #f0f4ff 0%, #e8edff 100%);
  padding: 20px 18px;
  border-radius: 16px;
  border-left: 4px solid #667eea;
  transition: all 0.2s ease;
}

.result-box:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 18px rgba(102, 126, 234, 0.2);
}

.result-box.highlight {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
}

.result-box.highlight .result-label {
  color: rgba(255, 255, 255, 0.92);
}

.result-box.highlight .result-value {
  color: #ffffff;
  font-size: 2.3rem;
}

.result-box.highlight .result-subtext {
  color: rgba(255, 255, 255, 0.85);
}

.result-label {
  font-weight: 600;
  font-size: 0.8rem;
  color: #4a5568;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.result-value {
  font-weight: 800;
  font-size: 1.6rem;
  color: #667eea;
}

.result-subtext {
  margin-top: 3px;
  font-size: 0.78rem;
  color: #64748b;
}

/* Donut chart */

.chart-container {
  background: #ffffff;
  padding: 26px 24px;
  border-radius: 16px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
  margin-bottom: 24px;
}

.chart-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.donut-chart {
  position: relative;
  width: 260px;
  height: 260px;
  margin: 0 auto;
}

.donut-chart svg {
  transform: rotate(-90deg);
}

.donut-center {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.donut-center-label {
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 4px;
}

.donut-center-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: #667eea;
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 26px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-color {
  width: 18px;
  height: 18px;
  border-radius: 4px;
}

.legend-principal {
  background: #667eea;
}

.legend-interest {
  background: #f59e0b;
}

.legend-text {
  font-size: 0.85rem;
  color: #4a5568;
  font-weight: 600;
}

.legend-value {
  font-size: 0.9rem;
  color: #667eea;
  font-weight: 700;
}

/* Stats */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.stat-item {
  background: #f8fafc;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
}

.stat-label {
  font-size: 0.8rem;
  color: #64748b;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: #667eea;
}

/* Payment schedule */

.payment-schedule {
  margin-top: 18px;
  max-height: 450px;
  overflow-y: auto;
}

.payment-item {
  background: #f8fafc;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
  padding: 14px 12px;
  margin-bottom: 10px;
  display: grid;
  grid-template-columns: 90px 1fr 1fr 1fr 1fr;
  gap: 12px;
  align-items: center;
  transition: all 0.2s ease;
}

.payment-item:hover {
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.16);
}

.payment-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #667eea;
}

.payment-value {
  text-align: center;
}

.payment-value-label {
  font-size: 0.76rem;
  color: #64748b;
  margin-bottom: 2px;
}

.payment-value-amount {
  font-size: 0.9rem;
  font-weight: 700;
  color: #2d3748;
}

/* Download buttons */

.download-buttons {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

.download-btn {
  flex: 1;
  padding: 13px 18px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 18px rgba(16, 185, 129, 0.45);
}

/* Info cards */

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 22px;
  margin-top: 40px;
}

.info-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 22px 20px;
  border-left: 4px solid #667eea;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
}

.info-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.25);
}

.info-card h3 {
  font-size: 1.1rem;
  margin: 0 0 10px;
  color: #1f2933;
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-card p {
  margin: 0;
  color: #4a5568;
  font-size: 0.92rem;
  line-height: 1.65;
}

.info-card p a {
  color: #4f46e5;
  text-decoration: none;
  font-weight: 600;
}

.info-card p a:hover {
  text-decoration: underline;
}

.info-badge {
  display: inline-block;
  margin-top: 10px;
  padding: 5px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
}

/* BLOG SECTION */

.blog-section {
  max-width: 960px;
  margin: 70px auto;
  padding: 0 20px;
}

.blog-content {
  background: #ffffff;
  border-radius: 24px;
  padding: 52px 50px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  line-height: 1.8;
}

.blog-content h2 {
  font-size: 2.4rem;
  margin-top: 0;
  margin-bottom: 26px;
  font-weight: 900;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.blog-content h3 {
  font-size: 1.6rem;
  margin-top: 32px;
  margin-bottom: 16px;
  color: #2d3748;
}

.blog-content h4 {
  font-size: 1.25rem;
  margin-top: 24px;
  margin-bottom: 12px;
  color: #4a5568;
}

.blog-content p {
  font-size: 0.98rem;
  color: #4a5568;
  margin-bottom: 18px;
}

.blog-content ul,
.blog-content ol {
  margin-left: 28px;
  margin-bottom: 18px;
  color: #4a5568;
}

.blog-content li {
  margin-bottom: 8px;
}

.blog-content strong {
  color: #667eea;
  font-weight: 700;
}

/* FAQ SECTION */

.faq-section {
  padding: 60px 20px 50px;
  background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
}

.faq-inner {
  max-width: 960px;
  margin: 0 auto;
}

.faq-inner h2 {
  font-size: 2rem;
  margin: 0 0 24px;
  text-align: center;
  color: #1f2933;
}

.faq-item {
  background: #ffffff;
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 12px;
  border: 1px solid #e2e8f0;
}

.faq-item summary {
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  color: #111827;
}

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

.faq-item[open] {
  border-color: #667eea;
  box-shadow: 0 6px 18px rgba(102, 126, 234, 0.18);
}

.faq-item p {
  margin-top: 10px;
  font-size: 0.95rem;
  color: #4b5563;
}

/* FOOTER */

.footer {
  margin-top: 60px;
  background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
  color: #ffffff;
  padding: 50px 0 20px;
}

.footer-column h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #a0aec0;
}

.footer-column ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-column ul li {
  margin-bottom: 10px;
}

.footer-column ul li a {
  color: #cbd5e0;
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.footer-column ul li a:hover {
  color: #14b8a6;
  transform: translateX(4px);
}

.footer-bottom {
  margin-top: 30px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 18px;
  text-align: center;
  color: #a0aec0;
  font-size: 0.85rem;
}

/* RESPONSIVE BREAKPOINTS */

@media (max-width: 1024px) {
  .calculator-grid {
    grid-template-columns: 1fr;
  }

  .result-summary {
    grid-template-columns: 1fr 1fr;
  }

  .payment-item {
    grid-template-columns: 1fr 1fr;
    row-gap: 10px;
  }
}

@media (max-width: 768px) {
  .header-logo {
    height: 32px;
  }

  .nav-links.desktop-nav {
    display: none;
  }

  .mobile-menu-btn {
    display: block;
  }

  .mobile-nav {
    display: block;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: max-height 0.3s ease, opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
  }

  .mobile-nav.open {
    max-height: 400px;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .page-header {
    padding: 60px 16px 72px;
  }

  .page-header h1 {
    font-size: 2.4rem;
  }

  .page-header p {
    font-size: 0.98rem;
  }

  .calculator-card {
    padding: 26px 20px;
  }

  .result-summary {
    grid-template-columns: 1fr;
  }

  .download-buttons {
    flex-direction: column;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .payment-item {
    grid-template-columns: 1fr;
  }

  .blog-content {
    padding: 32px 22px;
  }

  .blog-content h2 {
    font-size: 2rem;
  }

  .blog-content h3 {
    font-size: 1.35rem;
  }
}
