/* Base */
*,
*::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, #9333ea 0%, #7e22ce 100%);
}

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

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

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

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

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

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

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

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

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

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

/* Mobile slide-down menu */
.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 behind mobile menu */
.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 */
@media (max-width: 768px) {
  .main-nav-desktop {
    display: none;
  }

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

/* PAGE HEADER / HERO */
.page-header {
  background: linear-gradient(135deg, #9333ea 0%, #7e22ce 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: 3rem;
  font-weight: 900;
  margin-bottom: 12px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.page-header p {
  font-size: 1.25rem;
  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 CALCULATOR */
.calculator-container {
  max-width: 1400px;
  margin: -60px auto 60px;
  padding: 0 20px;
  position: relative;
  z-index: 10;
}

.calculator-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  margin-bottom: 24px;
  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: #9333ea;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Converter grid */
.converter-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 24px;
  align-items: center;
}

.input-box {
  background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
  padding: 28px;
  border-radius: 16px;
  border: 2px solid #9333ea;
}

.input-label {
  font-weight: 700;
  color: #6b21a8;
  margin-bottom: 10px;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-field {
  width: 100%;
  padding: 16px;
  border: 2px solid #9333ea;
  border-radius: 12px;
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  color: #1e293b;
  transition: all 0.3s ease;
}

.input-field:focus {
  outline: none;
  border-color: #7e22ce;
  box-shadow: 0 0 0 4px rgba(147, 51, 234, 0.15);
  transform: scale(1.02);
}

.unit-label {
  font-size: 1.25rem;
  font-weight: 700;
  color: #9333ea;
  margin-top: 10px;
  text-align: center;
}

/* Swap button */
.swap-button {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #9333ea 0%, #7e22ce 100%);
  color: #ffffff;
  font-size: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(147, 51, 234, 0.3);
  transition: all 0.3s ease;
}

.swap-button:hover {
  transform: rotate(180deg) scale(1.05);
}

/* Presets */
.presets-wrapper {
  text-align: center;
  margin-top: 24px;
}

.presets-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 8px;
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.preset-btn {
  padding: 10px 18px;
  background: #ffffff;
  border-radius: 999px;
  border: 2px solid #9333ea;
  color: #9333ea;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preset-btn:hover {
  background: linear-gradient(135deg, #9333ea 0%, #7e22ce 100%);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(147, 51, 234, 0.3);
}

/* Breakdown grid */
.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.result-box {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  padding: 24px;
  border-radius: 16px;
  border-left: 5px solid #10b981;
}

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

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

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

.formula-text {
  font-size: 1.1rem;
}

/* Colored result boxes */
.result-box-yellow {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-left-color: #f59e0b;
}

.result-label-yellow {
  color: #78350f;
}

.result-box-pink {
  background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%);
  border-left-color: #ec4899;
}

.result-label-pink {
  color: #831843;
}

.result-box-blue {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  border-left-color: #3b82f6;
}

.result-label-blue {
  color: #1e3a8a;
}

.result-box-indigo {
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
  border-left-color: #6366f1;
}

.result-label-indigo {
  color: #312e81;
}

.result-box-gold {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-left-color: #eab308;
}

.result-label-gold {
  color: #713f12;
}

/* Distance visual */
.distance-visual {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  padding: 24px;
  border-radius: 16px;
  margin: 24px 0 8px;
  position: relative;
  overflow: hidden;
}

.distance-visual-title {
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 12px;
}

.distance-bar {
  height: 40px;
  background: linear-gradient(90deg, #9333ea 0%, #7e22ce 100%);
  border-radius: 8px;
  min-width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.9rem;
  transition: width 0.5s ease;
}

.distance-marks {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 0.9rem;
  color: #1e40af;
  font-weight: 600;
}

/* History */
.history-empty {
  text-align: center;
  color: #94a3b8;
  padding: 40px 10px;
}

.history-item {
  background: #f8fafc;
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 4px solid #9333ea;
}

.history-main {
  font-weight: 700;
  color: #1e293b;
  font-size: 1.1rem;
}

.history-time {
  color: #64748b;
  font-size: 0.8rem;
  margin-top: 4px;
}

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

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

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(147, 51, 234, 0.3);
}

/* Table */
.table-wrapper {
  overflow-x: auto;
}

.conversion-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 0.9rem;
}

.conversion-table th {
  background: linear-gradient(135deg, #9333ea 0%, #7e22ce 100%);
  color: #ffffff;
  padding: 12px;
  text-align: left;
  font-weight: 600;
}

.conversion-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
}

.conversion-table tr:hover {
  background: #f8fafc;
}

/* 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(0, 0, 0, 0.1);
  line-height: 1.8;
}

.blog-content h2 {
  font-size: 2.6rem;
  font-weight: 900;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #9333ea 0%, #7e22ce 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

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

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

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

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

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

.highlight-box {
  background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
  padding: 24px;
  border-radius: 12px;
  border-left: 4px solid #9333ea;
  margin: 24px 0;
}

.example-box {
  background: #faf5ff;
  padding: 20px;
  border-radius: 12px;
  border-left: 4px solid #9333ea;
  margin: 24px 0;
}

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

.faq-container {
  background: #ffffff;
  border-radius: 24px;
  padding: 40px 32px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}

.faq-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 24px;
  color: #1f2933;
}

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

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

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

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

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

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

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

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

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

.footer-text {
  color: #cbd5e0;
  line-height: 1.7;
}

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

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

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

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

  .calculator-card {
    padding: 24px 18px;
  }

  .converter-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .swap-button {
    transform: rotate(90deg);
    margin: 0 auto;
  }

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

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

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

  .faq-container {
    padding: 28px 20px;
  }
}
