/* RunCalc ⚡ — Global Styles v3 */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=DM+Sans:ital,wght@0,400;0,500;0,700;1,400&display=swap');

:root {
  --dark: #0f172a;
  --dark-2: #1e293b;
  --blue: #2563eb;
  --blue-hover: #1d4ed8;
  --blue-light: #eff6ff;
  --cyan: #06b6d4;
  --cyan-light: #ecfeff;
  --green: #10b981;
  --green-light: #ecfdf5;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-900: #0f172a;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.03);
  --shadow-xl: 0 20px 40px -5px rgba(0,0,0,0.1);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  color: var(--gray-900);
  background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
}

/* ===== HEADER ===== */
header {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gray-200);
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
header nav {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  text-decoration: none;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 0.125rem;
  transition: opacity var(--transition);
}
.logo:hover { opacity: 0.8; }
.logo-accent { color: var(--blue); }

.lang-switcher {
  position: relative;
}
.lang-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.lang-btn:hover { background: white; border-color: var(--blue); color: var(--blue); }
.lang-btn svg { transition: transform var(--transition); }
.lang-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.lang-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 200;
  padding: 0.3rem;
}
.lang-dropdown.open { display: block; }
.lang-dropdown a {
  display: block;
  padding: 0.45rem 0.7rem;
  text-decoration: none;
  font-size: 0.8rem;
  color: var(--gray-700);
  border-radius: 6px;
  transition: all var(--transition);
  white-space: nowrap;
}
.lang-dropdown a:hover { background: var(--blue-light); color: var(--blue); }
.lang-dropdown a.active { background: var(--blue); color: white; }

@media (max-width: 480px) {
  .lang-btn span { display: none; }
  .lang-btn svg { display: none; }
  .lang-btn { padding: 0.4rem 0.5rem; font-size: 1rem; }
  .lang-dropdown { right: 0; }
}

/* ===== MAIN ===== */
main {
  max-width: 960px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  min-height: 60vh;
}

/* ===== HERO (homepage) ===== */
.hero {
  text-align: center;
  padding: 1.5rem 0 2.5rem;
}
.hero h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--dark);
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}
.hero p {
  color: var(--gray-500);
  font-size: 1.15rem;
  max-width: 540px;
  margin: 0 auto 1.5rem;
}
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}
.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hero-stat-num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--blue);
  line-height: 1.2;
}
.hero-stat-label {
  font-size: 0.8rem;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

/* ===== TYPOGRAPHY ===== */
h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--dark);
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
}
h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--dark);
  margin: 2rem 0 1rem;
}
h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--dark);
  margin: 1.5rem 0 0.5rem;
}
p { color: var(--gray-600); margin-bottom: 1rem; font-size: 1.05rem; }

/* ===== BREADCRUMBS ===== */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--gray-400);
  margin-bottom: 1.25rem;
}
.breadcrumbs a {
  color: var(--gray-500);
  text-decoration: none;
  transition: color var(--transition);
}
.breadcrumbs a:hover { color: var(--blue); }
.breadcrumbs span { color: var(--gray-300); }

/* ===== CALCULATOR CARD ===== */
.calculator {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  padding: 2rem;
  margin: 1.5rem 0;
  box-shadow: var(--shadow);
}

.calculator label {
  display: block;
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--gray-600);
  margin-top: 1.25rem;
  margin-bottom: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.calculator label:first-child { margin-top: 0; }

.calculator input,
.calculator select {
  padding: 0.8rem 1rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: 'DM Sans', sans-serif;
  width: 100%;
  background: var(--gray-50);
  color: var(--gray-900);
  transition: all var(--transition);
  outline: none;
}
.calculator input:focus,
.calculator select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
  background: white;
}
.calculator input::placeholder { color: var(--gray-400); }

.calculator button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--blue);
  color: white;
  padding: 0.9rem 2.5rem;
  border: none;
  border-radius: var(--radius);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 1.5rem;
  width: 100%;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(37,99,235,0.2);
  position: relative;
  overflow: hidden;
}
.calculator button:hover {
  background: var(--blue-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(37,99,235,0.3);
}
.calculator button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(37,99,235,0.2);
}

/* ===== RESULT ===== */
.result {
  background: linear-gradient(135deg, var(--blue-light), var(--cyan-light));
  border: 1.5px solid rgba(37,99,235,0.15);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1.5rem;
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1.7;
  color: var(--dark);
  animation: slideUp 0.3s ease-out;
}
.result strong {
  color: var(--blue);
  font-size: 1.35rem;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== HOMEPAGE CATEGORIES ===== */
.category { margin-bottom: 2.5rem; }
.category h2 {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-400);
  font-weight: 600;
  padding-bottom: 0.625rem;
  margin-bottom: 0.875rem;
  border-bottom: 2px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.category ul {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 0.625rem;
}
.category li {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.category li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--blue);
  opacity: 0;
  transition: opacity var(--transition);
}
.category li:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.category li:hover::before { opacity: 1; }

.category li a {
  display: flex;
  flex-direction: column;
  padding: 0.875rem 1.125rem;
  text-decoration: none;
  color: var(--dark);
  font-weight: 600;
  font-size: 0.9rem;
}
.category li a strong {
  display: block;
  line-height: 1.3;
}
.card-desc {
  display: block;
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 0.2rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.category li a::after {
  content: '→';
  color: var(--blue);
  font-size: 0.85rem;
  opacity: 0;
  transition: all var(--transition);
  margin-top: 0.25rem;
  transform: translateX(-4px);
}
.category li:hover a::after {
  opacity: 1;
  transform: translateX(0);
}

/* ===== CONTENT SECTIONS ===== */
.content-section {
  margin-top: 2.5rem;
}
.content-section h2 {
  font-size: 1.35rem;
  margin-bottom: 0.75rem;
  color: var(--dark);
}
.content-section p {
  color: var(--gray-600);
  line-height: 1.75;
  margin-bottom: 0.75rem;
}
.content-section ul {
  padding-left: 1.5rem;
  margin: 0.75rem 0;
  list-style: disc;
}
.content-section ul li {
  color: var(--gray-600);
  line-height: 1.7;
  margin: 0.375rem 0;
}
.content-section ul li strong {
  color: var(--dark);
}

/* FAQ Accordion */
.faq-section details {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  overflow: hidden;
}
.faq-section details summary {
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--dark);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background var(--transition);
}
.faq-section details summary:hover {
  background: var(--gray-50);
}
.faq-section details summary::after {
  content: '+';
  font-size: 1.25rem;
  color: var(--blue);
  font-weight: 700;
  transition: transform var(--transition);
}
.faq-section details[open] summary::after {
  content: '−';
}
.faq-section details summary::-webkit-details-marker { display: none; }
.faq-section details p {
  padding: 0 1.25rem 1rem;
  color: var(--gray-600);
  line-height: 1.7;
  margin: 0;
}

/* ===== RELATED CALCS ===== */
.related-section {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--gray-200);
}
.related-section h2 {
  font-size: 1.125rem;
  margin-bottom: 0.75rem;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
  list-style: none;
}
.related-grid li a {
  display: block;
  padding: 0.625rem 0.875rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  color: var(--dark);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all var(--transition);
}
.related-grid li a:hover {
  background: var(--blue-light);
  border-color: var(--blue);
  color: var(--blue);
}

/* Fallback for non-grid related sections */
section ul {
  list-style: none;
  padding: 0;
}
section ul li {
  margin: 0.375rem 0;
}
section ul li a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color var(--transition);
}
section ul li a:hover {
  color: var(--blue-hover);
  text-decoration: underline;
}

/* ===== FOOTER ===== */
footer {
  max-width: 960px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  border-top: 1px solid var(--gray-200);
}
.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1.5rem;
}
.footer-brand {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--dark);
  margin-bottom: 0.25rem;
}
.footer-copy {
  font-size: 0.8rem;
  color: var(--gray-400);
}
.footer-links {
  display: flex;
  gap: 1.5rem;
}
.footer-links a {
  font-size: 0.8rem;
  color: var(--gray-400);
  text-decoration: none;
  transition: color var(--transition);
}
.footer-links a:hover { color: var(--blue); }

/* Simple footer fallback */
footer p {
  color: var(--gray-400);
  font-size: 0.8125rem;
  text-align: center;
  margin: 0;
}

/* ===== RTL ===== */
[dir="rtl"] .calculator label { text-align: right; }
[dir="rtl"] .category ul { direction: rtl; }
[dir="rtl"] .category li::before { left: auto; right: 0; }
[dir="rtl"] .breadcrumbs { direction: rtl; }

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .hero h1 { font-size: 2rem; }
  h1 { font-size: 1.75rem; }
  .calculator { padding: 1.5rem; border-radius: var(--radius-lg); }
  .category ul { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: 1fr; }
  main { padding: 1.5rem 1rem 2.5rem; }
  .hero-stats { gap: 1.25rem; }
  .hero-stat-num { font-size: 1.4rem; }
  .nav-links { display: none; }
  .footer-content { flex-direction: column; align-items: center; text-align: center; }
}

@media (min-width: 641px) and (max-width: 900px) {
  .category ul { grid-template-columns: repeat(2, 1fr); }
}
