/* Base reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
    sans-serif;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
}

/* HEADER & NAV */
.header {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.3);
}

.logo-text {
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
}

/* Desktop nav */
.main-nav-desktop {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-link {
  color: #ffffff;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.25s ease;
  display: inline-block;
}

.nav-link:hover {
  color: #e5e7eb;
  transform: scale(1.05);
}

/* Dropdown */
.dropdown {
  position: relative;
}

.dropdown-toggle {
  background: transparent;
  border: none;
  color: #ffffff;
  font-weight: 500;
  cursor: pointer;
}

/* Hidden by default, controlled via JS */
.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #ffffff;
  min-width: 220px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  margin-top: 8px;
  overflow: hidden;
  z-index: 999;
}

.dropdown-content a {
  color: #4a5568;
  padding: 12px 20px;
  text-decoration: none;
  display: block;
  font-size: 14px;
  transition: all 0.2s ease;
}

.dropdown-content a:hover {
  background: #2563eb;
  color: #ffffff;
}

/* when JS adds .open */
.dropdown-content.open {
  display: block;
}

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

/* Mobile menu (slide-down, green) */
.mobile-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #16a34a;
  display: none;
  flex-direction: column;
  padding: 12px 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  z-index: 998;
}

.mobile-menu.open {
  display: flex;
}

.mobile-menu-link {
  padding: 10px 20px;
  color: #ffffff;
  text-decoration: none;
  font-weight: 500;
}

.mobile-menu-link:hover {
  background: rgba(0, 0, 0, 0.18);
}

/* Dark overlay for mobile */
.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 900;
}

.mobile-menu-overlay.visible {
  opacity: 1;
  visibility: visible;
}

/* Mobile breakpoint – hide desktop nav on small screens */
@media (max-width: 768px) {
  .main-nav-desktop {
    display: none;
  }

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

/* HERO */
.page-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  color: #ffffff;
  padding: 80px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.page-header h1 {
  font-size: 2.75rem;
  font-weight: 900;
  margin-bottom: 12px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.25);
}

.page-header p {
  font-size: 1.2rem;
  opacity: 0.95;
}

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

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

/* MAIN LAYOUT */
.calculator-container {
  max-width: 1400px;
  margin: -60px auto 60px;
  padding: 0 20px;
  position: relative;
  z-index: 10;
}

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

.calculator-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 40px;
  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.75rem;
  font-weight: 800;
  color: #1e3a8a;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title-small {
  font-size: 1.35rem;
  margin-top: 24px;
}

/* Input fields */
.input-section {
  margin-bottom: 22px;
}

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

.input-wrapper {
  position: relative;
}

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

.input-field:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

/* Prefix / suffix */
.input-prefix {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #4a5568;
  font-weight: 600;
  pointer-events: none;
}

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

.input-suffix {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #4a5568;
  font-weight: 600;
  pointer-events: none;
}

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

/* Button */
.calculate-btn {
  width: 100%;
  padding: 18px;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}

.calculate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(30, 64, 175, 0.48);
}

.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: 20px;
  margin-bottom: 28px;
}

.result-box {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  padding: 24px;
  border-radius: 16px;
  border-left: 4px solid #3b82f6;
  transition: all 0.25s ease;
}

.result-box:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.18);
}

.result-box-main {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  border: none;
}

.result-label {
  font-weight: 600;
  color: #4a5568;
  font-size: 0.85rem;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.result-label-main {
  color: rgba(255, 255, 255, 0.9);
}

.result-value {
  font-weight: 800;
  color: #1e3a8a;
  font-size: 2rem;
}

.result-value-smaller {
  font-size: 1.5rem;
}

.result-value-main {
  color: #ffffff;
  font-size: 2.6rem;
}

.result-value-small {
  font-size: 1.6rem;
}

.result-value-warning {
  color: #ef4444;
}

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

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

/* Chart */
.chart-container {
  background: #ffffff;
  padding: 28px;
  border-radius: 16px;
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.16);
  margin-bottom: 28px;
}

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

.pie-chart {
  width: 300px;
  height: 300px;
  margin: 0 auto;
}

.chart-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
}

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

.legend-color {
  width: 20px;
  height: 20px;
  border-radius: 6px;
}

.legend-text {
  flex: 1;
  font-weight: 500;
  color: #4b5563;
}

.legend-value {
  font-weight: 700;
  color: #1f2937;
  font-size: 0.95rem;
}

/* APR vs Interest comparison */
.comparison-card {
  margin-top: 12px;
}

.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
  background: #f8fafc;
  padding: 16px;
  border-radius: 12px;
}

.comparison-label {
  font-weight: 600;
  color: #4b5563;
  margin-bottom: 6px;
}

.comparison-value {
  font-size: 1.4rem;
  font-weight: 800;
}

.comparison-value-base {
  color: #2563eb;
}

.comparison-value-apr {
  color: #ef4444;
}

.comparison-subtext {
  font-size: 0.85rem;
  color: #6b7280;
}

.additional-cost-box {
  background: #ffffff;
  padding: 16px;
  border-radius: 10px;
  border-left: 4px solid #10b981;
}

.additional-cost-label {
  font-weight: 600;
  color: #065f46;
  margin-bottom: 4px;
}

.additional-cost-value {
  font-size: 1.7rem;
  font-weight: 800;
  color: #10b981;
}

/* Download buttons */
.download-buttons {
  display: flex;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.download-btn {
  flex: 1;
  min-width: 180px;
  padding: 14px 20px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

/* Info cards */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin-top: 36px;
}

.info-card {
  background: #ffffff;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.18);
  border-left: 4px solid #3b82f6;
  transition: all 0.25s ease;
}

.info-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 28px rgba(37, 99, 235, 0.35);
}

.info-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-card p {
  color: #4b5563;
  font-size: 0.95rem;
  line-height: 1.7;
}

.info-card a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}

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

/* BLOG SECTION */
.blog-section {
  max-width: 900px;
  margin: 80px auto;
  padding: 0 20px;
}

.blog-content {
  background: #ffffff;
  border-radius: 24px;
  padding: 60px;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.25);
  line-height: 1.8;
}

.blog-content h2 {
  font-size: 2.4rem;
  font-weight: 900;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.blog-content h3 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #111827;
  margin-top: 32px;
  margin-bottom: 10px;
}

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

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

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

.blog-content strong {
  color: #1e3a8a;
}

.blog-content a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}

.blog-content a:hover {
  text-decoration: underline;
}

.highlight-box {
  background: #eff6ff;
  padding: 22px;
  border-radius: 12px;
  border-left: 4px solid #2563eb;
  margin: 24px 0;
}

.example-box {
  background: #f0fdf4;
  padding: 22px;
  border-radius: 12px;
  border-left: 4px solid #10b981;
  margin: 24px 0;
}

/* FAQ */
.faq-section {
  max-width: 900px;
  margin: 0 auto 80px;
  padding: 0 20px;
}

.faq-container {
  background: #ffffff;
  border-radius: 24px;
  padding: 40px 30px;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.2);
}

.faq-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 20px;
  color: #111827;
}

.faq-item + .faq-item {
  margin-top: 14px;
  border-top: 1px solid #e5e7eb;
  padding-top: 14px;
}

.faq-item h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 6px;
}

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

.faq-item a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}

.faq-item a:hover {
  text-decoration: underline;
}

/* FOOTER */
.footer {
  background: linear-gradient(135deg, #2d3748 0%, #111827 100%);
  color: #ffffff;
  padding: 60px 0 24px;
  margin-top: 40px;
}

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

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

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

.footer-column a {
  color: #cbd5e0;
  text-decoration: none;
  transition: all 0.2s ease;
  display: inline-block;
}

.footer-column a:hover {
  color: #38bdf8;
  transform: translateX(4px);
}

.footer-text {
  color: #cbd5e0;
  line-height: 1.7;
  font-size: 0.95rem;
}

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

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

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

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

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

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

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

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

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

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

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