/* ================================================================
   Model Builder Tools — Shared Design System
   Version 2.0
   ================================================================ */

/* ── CSS Custom Properties ──────────────────────────────────── */
:root {
  /* Brand Colors */
  --navy-900: #0f1b3d;
  --navy-800: #162350;
  --navy-700: #1e3a8a;
  --navy-600: #1e40af;
  --blue-500: #3b82f6;
  --blue-400: #60a5fa;
  --blue-100: #dbeafe;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-100: #dcfce7;
  --amber-500: #f59e0b;
  --amber-100: #fef3c7;
  --red-500: #ef4444;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --white: #ffffff;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  /* Spacing */
  --container-max: 1200px;
  --container-wide: 1400px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);

  /* Borders */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--slate-50);
  color: var(--slate-800);
  line-height: 1.7;
  font-size: 16px;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── Navigation ─────────────────────────────────────────────── */
.top-nav {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--slate-200);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: box-shadow var(--transition-base);
}

.top-nav.scrolled {
  box-shadow: var(--shadow-md);
}

.nav-container {
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-decoration: none;
}

.logo-image {
  height: 44px;
  width: auto;
}

.nav-links {
  display: flex;
  gap: 8px;
  align-items: center;
}

.nav-link {
  color: var(--slate-600);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.nav-link:hover {
  color: var(--navy-700);
  background: var(--slate-100);
}

.nav-link.active {
  color: var(--navy-700);
  background: var(--blue-100);
}

.nav-cta {
  background: var(--navy-700);
  color: var(--white);
  padding: 10px 24px;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: all var(--transition-base);
  margin-left: 8px;
}

.nav-cta:hover {
  background: var(--navy-600);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(30, 58, 138, 0.25);
}

/* Mobile hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
}

.nav-toggle:hover {
  background: var(--slate-100);
}

.nav-toggle svg {
  width: 24px;
  height: 24px;
  color: var(--slate-700);
}

/* ── Tool Tabs (sub-nav on tool pages) ──────────────────────── */
.tool-tabs {
  background: var(--white);
  border-bottom: 1px solid var(--slate-200);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tool-tabs::-webkit-scrollbar {
  display: none;
}

.tool-tabs-inner {
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  gap: 4px;
}

.tool-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--slate-500);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
}

.tool-tab:hover {
  color: var(--navy-700);
  background: var(--slate-50);
}

.tool-tab.active {
  color: var(--navy-700);
  border-bottom-color: var(--navy-700);
  font-weight: 600;
}

.tool-tab svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ── Page Header (tool pages) ───────────────────────────────── */
.page-header {
  background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-700) 50%, var(--blue-500) 100%);
  color: var(--white);
  padding: 48px 32px 40px;
  text-align: center;
}

.page-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.page-header p {
  font-size: 1.05rem;
  opacity: 0.85;
  max-width: 600px;
  margin: 0 auto;
}

/* ── Main Content Area ──────────────────────────────────────── */
.main-content {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 40px 32px 80px;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  padding: 32px;
  transition: all var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-elevated {
  box-shadow: var(--shadow-md);
  border: none;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 15px;
  font-family: var(--font-sans);
  cursor: pointer;
  border: none;
  transition: all var(--transition-base);
  text-decoration: none;
}

.btn-primary {
  background: var(--navy-700);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--navy-600);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(30, 58, 138, 0.25);
}

.btn-green {
  background: var(--green-500);
  color: var(--white);
}

.btn-green:hover {
  background: var(--green-600);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.btn-outline {
  background: transparent;
  color: var(--navy-700);
  border: 2px solid var(--navy-700);
}

.btn-outline:hover {
  background: var(--navy-700);
  color: var(--white);
}

.btn-ghost {
  background: transparent;
  color: var(--slate-600);
}

.btn-ghost:hover {
  background: var(--slate-100);
  color: var(--slate-800);
}

.btn-lg {
  padding: 16px 32px;
  font-size: 16px;
  border-radius: var(--radius-md);
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn svg {
  width: 18px;
  height: 18px;
}

/* ── Form Elements ──────────────────────────────────────────── */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: var(--slate-700);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--slate-200);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--slate-800);
  background: var(--white);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
}

/* ── Info Box ───────────────────────────────────────────────── */
.info-box {
  background: var(--blue-100);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 14px;
  color: var(--navy-700);
  line-height: 1.6;
}

.info-box svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.info-box.warning {
  background: var(--amber-100);
  border-color: rgba(245, 158, 11, 0.3);
  color: #92400e;
}

.info-box.success {
  background: var(--green-100);
  border-color: rgba(34, 197, 94, 0.3);
  color: #166534;
}

/* ── Result Cards ───────────────────────────────────────────── */
.result-card {
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 16px;
  border-left: 4px solid;
}

.result-card.success {
  background: #f0fdf4;
  border-color: var(--green-500);
}

.result-card.warning {
  background: #fffbeb;
  border-color: var(--amber-500);
}

.result-card.error {
  background: #fef2f2;
  border-color: var(--red-500);
}

.result-card h4 {
  font-size: 15px;
  margin-bottom: 8px;
}

.result-card p {
  font-size: 14px;
  color: var(--slate-600);
  line-height: 1.6;
}

/* ── Code Blocks ────────────────────────────────────────────── */
.code-block {
  background: var(--slate-900);
  color: #e2e8f0;
  padding: 20px 24px;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.7;
  overflow-x: auto;
  position: relative;
}

.code-block .copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--slate-700);
  color: var(--slate-300);
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.code-block .copy-btn:hover {
  background: var(--slate-600);
  color: var(--white);
}

/* ── Badge ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-green {
  background: var(--green-100);
  color: #166534;
}

.badge-blue {
  background: var(--blue-100);
  color: var(--navy-700);
}

.badge-amber {
  background: var(--amber-100);
  color: #92400e;
}

.badge-premium {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #78350f;
}

/* ── Section Utilities ──────────────────────────────────────── */
.section {
  padding: 80px 32px;
}

.section-dark {
  background: var(--slate-900);
  color: var(--white);
}

.section-alt {
  background: var(--white);
}

.container {
  max-width: var(--container-max);
  margin: 0 auto;
}

.container-wide {
  max-width: var(--container-wide);
  margin: 0 auto;
}

.text-center {
  text-align: center;
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue-500);
  margin-bottom: 16px;
}

.section-title {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 16px;
}

.section-subtitle {
  font-size: 1.1rem;
  color: var(--slate-500);
  max-width: 640px;
  line-height: 1.7;
}

.section-subtitle.centered {
  margin-left: auto;
  margin-right: auto;
}

/* ── Footer ─────────────────────────────────────────────────── */
.footer {
  background: var(--slate-900);
  color: var(--slate-400);
  padding: 48px 32px 32px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.footer-inner {
  max-width: var(--container-wide);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 40px;
  flex-wrap: wrap;
}

.footer-brand {
  max-width: 320px;
}

.footer-brand .logo-image {
  height: 36px;
  margin-bottom: 12px;
  filter: brightness(0) invert(1) opacity(0.8);
}

.footer-brand p {
  font-size: 14px;
  line-height: 1.7;
}

.footer-links {
  display: flex;
  gap: 48px;
}

.footer-col h4 {
  color: var(--white);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  letter-spacing: 0.02em;
}

.footer-col a {
  display: block;
  color: var(--slate-400);
  font-size: 14px;
  padding: 4px 0;
  transition: color var(--transition-fast);
}

.footer-col a:hover {
  color: var(--white);
}

.footer-bottom {
  max-width: var(--container-wide);
  margin: 32px auto 0;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-bottom a {
  color: var(--slate-400);
  transition: color var(--transition-fast);
}

.footer-bottom a:hover {
  color: var(--white);
}

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.animate-in {
  animation: fadeInUp 0.5s ease-out forwards;
  opacity: 0;
}

.animate-in:nth-child(2) { animation-delay: 0.1s; }
.animate-in:nth-child(3) { animation-delay: 0.2s; }
.animate-in:nth-child(4) { animation-delay: 0.3s; }
.animate-in:nth-child(5) { animation-delay: 0.4s; }
.animate-in:nth-child(6) { animation-delay: 0.5s; }
.animate-in:nth-child(7) { animation-delay: 0.6s; }
.animate-in:nth-child(8) { animation-delay: 0.7s; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .footer-inner {
    flex-direction: column;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--slate-200);
    flex-direction: column;
    padding: 16px;
    gap: 4px;
    box-shadow: var(--shadow-lg);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-link {
    width: 100%;
    padding: 12px 16px;
  }

  .nav-cta {
    width: 100%;
    text-align: center;
    margin-left: 0;
    margin-top: 8px;
  }

  .nav-toggle {
    display: block;
  }

  .section {
    padding: 48px 20px;
  }

  .section-title {
    font-size: 1.75rem;
  }

  .page-header {
    padding: 32px 20px 28px;
  }

  .page-header h1 {
    font-size: 1.5rem;
  }

  .main-content {
    padding: 24px 16px 60px;
  }

  .card {
    padding: 20px;
  }

  .tool-tabs-inner {
    padding: 0 16px;
  }

  .footer-links {
    flex-direction: column;
    gap: 24px;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .nav-container {
    padding: 12px 16px;
  }

  .logo-image {
    height: 36px;
  }
}
