/* =========================================================
   ERP RESEARCH PORTAL — MODERN DESIGN SYSTEM (REBUILT)
========================================================= */

/* =========================
   RESET
========================= */

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
}

/* =========================
   DESIGN TOKENS
========================= */

:root {
  /* BRAND */
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #7c3aed;

  /* STATUS */
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;

  /* BACKGROUND */
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;

  /* TEXT */
  --text: #0f172a;
  --text-light: #64748b;

  /* UI */
  --border: #e2e8f0;
  --shadow: 0 10px 25px rgba(0, 0, 0, 0.06);

  --radius: 14px;

  /* SPACING */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;
}

/* =========================
   DARK MODE
========================= */
/* Always light, even in dark mode */
.container .kpi-card,
.container .chart-card,
.container .form-container {
  background: #fff !important;
  color: #0f172a !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 10px 25px rgba(0,0,0,0.06) !important;
}

[data-theme="dark"] {
  /* Main background & surfaces */
  --bg: #0a0f1b;           /* very dark main background */
  --surface: #111827;      /* form sections, cards */
  --surface-2: #1f2937;    /* secondary surfaces like hover states, select dropdowns */

  /* Text */
  --text: #f0f4f8;         /* main readable text */
  --text-light: #94a3b8;   /* secondary/muted text */
  
  /* Borders and shadows */
  --border: rgba(255, 255, 255, 0.12);   /* subtle border for inputs & sections */
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.5); /* deeper shadow for floating elements */

  /* Brand / highlights */
  --primary: #2563eb;       /* blue (hero gradient & buttons) */
  --primary-dark: #1e40af;  /* hover for buttons */
  --secondary: #7c3aed;     /* purple accents */
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
}

/* ================= Dark form tweaks ================= */
[data-theme="dark"] .form-container,
[data-theme="dark"] .form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

[data-theme="dark"] label {
  color: var(--text-light);
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

[data-theme="dark"] button.btn {
  background: var(--primary);
  color: #fff;
}

[data-theme="dark"] button.btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

/* Footer */
[data-theme="dark"] .footer {
  background: var(--surface);
  color: var(--text-light);
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* Hero stays blue — untouched */
[data-theme="dark"] .hero {
  background: radial-gradient(circle at top, #2563eb, #1d4ed8 45%, var(--bg));
  color: white;
}

[data-theme="dark"] .footer {
  /* override dark mode variables specifically for footer */
  background: var(--surface) !important;
  color: var(--text) !important;
  border-top: 1px solid var(--border) !important;
}

[data-theme="dark"] .footer a {
  color: var(--primary) !important;
}

/* =========================
   LAYOUT
========================= */

.container {
  max-width: 1100px;
  margin: auto;
  padding: var(--s7) var(--s5);
  gap: var(--s5);
}

.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s6);
  margin-bottom: var(--s6);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}

/* =========================
   NAVBAR (MODERN CLEAN)
========================= */

.navbar {
  position: sticky;
  top: 0;
  z-index: 999;

  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 14px 32px;

  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);

  border-bottom: 1px solid var(--border);
  background: var(--surface);           /* use variable instead of fixed rgba */
  color: var(--text);                   /* use text variable */
}

.navbar .brand {
  font-weight: 800;
  font-size: 18px;
  color: var(--text);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 20px;
}

.navbar a {
  color: var(--text-light);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  position: relative;
  transition: 0.2s;
}

.navbar a:hover {
  color: var(--primary);
  transform: scale(1.2);
}

/* =========================
   HERO (CLEAN SaaS STYLE)
========================= */

.hero {
  padding: var(--s8) var(--s5);
  text-align: center;

  background: radial-gradient(circle at top, #2563eb, #1d4ed8 45%, #0b1220);

  color: white;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s4);
}

.hero h1 {
  font-size: 48px;
  max-width: 900px;
}

.hero p {
  font-size: 18px;
  max-width: 720px;
  opacity: 0.9;
}

/* =========================
   BUTTONS
========================= */

.btn,
button,
.dl-btn,
a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 12px 20px;
  border-radius: 10px;

  border: none;
  cursor: pointer;

  background: var(--primary);
  color: white;

  font-weight: 600;
  text-decoration: none;

  transition: 0.2s;
}

.btn:hover,
button:hover,
.dl-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

/* =========================
   CARDS
========================= */

.card,
.download-card,
.form-container,
.poster-frame,
.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: var(--s5);
}

/* =========================
   STATS
========================= */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--s5);
  margin-top: var(--s6);
}

.stats .card {
  padding: var(--s5);
  border-left: 4px solid var(--primary);
}

.stats h2 {
  font-size: 34px;
  color: var(--primary);
}

/* =========================
   TABLES (MODERNIZED)
========================= */

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 14px;
  background: var(--surface-2);
  font-size: 13px;
}

td {
  padding: 14px;
  border-top: 1px solid var(--border);
}

tr:hover {
  background: var(--surface-2);
}

/* =========================
   FORMS (ANALYZER FIXED UX)
========================= */

.form-container {
  max-width: 900px;
  margin: auto;
  padding: var(--s6);
}

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

.form-section {
  grid-column: span 2;

  display: flex;
  flex-direction: column;
  gap: 14px;

  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
}

input,
select,
textarea {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

button {
  grid-column: span 2;
}

/* =========================
   TAGS
========================= */

.tag {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;

  background: #dbeafe;
  color: #1d4ed8;

  font-size: 12px;
  font-weight: 600;
}

/* =========================
   INFO BOX
========================= */

.info {
  padding: 16px;
  border-radius: 12px;

  background: #eff6ff;
  border-left: 4px solid var(--primary);
}

/* =========================
   DOWNLOAD CARDS
========================= */

.download-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  gap: 20px;
}

/* =========================
   RESULT PAGE
========================= */

.result-page,
.error-page {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg);
}

.result-card,
.error-card {
  max-width: 520px;
  padding: 40px;
  text-align: center;
  border-radius: 16px;
}

/* =========================
   BADGES
========================= */

.badge {
  display: inline-block;
  padding: 14px 26px;
  border-radius: 999px;
  font-weight: 800;
  color: white;
}

.badge-gap {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.badge-no-gap {
  background: linear-gradient(135deg, #10b981, #059669);
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 768px) {
  .hero h1 {
    font-size: 34px;
  }

  form {
    grid-template-columns: 1fr;
  }

  button {
    grid-column: span 1;
  }

  .navbar {
    flex-direction: column;
    gap: 10px;
  }

  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
  }

  .download-card {
    flex-direction: column;
    align-items: flex-start;
  }
}

.card img {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.error-card {
  max-width: 600px;
  margin: auto;
  text-align: center;
}

/* =========================
   MOTION SYSTEM (NEW)
========================= */

/* Base animation state */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: all 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform, opacity;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* HERO DRAMATIC ENTRY */
.hero h1 {
  animation: heroTitle 1s ease-out both;
}

.hero p {
  animation: heroText 1.2s ease-out both;
  animation-delay: 0.2s;
}

.hero .btn {
  animation: heroButton 1.4s ease-out both;
  animation-delay: 0.4s;
}

@keyframes heroTitle {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes heroText {
  from {
    opacity: 0;
    transform: translateY(25px);
  }
  to {
    opacity: 0.9;
    transform: translateY(0);
  }
}

@keyframes heroButton {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* CARD FLOAT EFFECT (hover interaction upgrade) */
.card,
.section,
.download-card {
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.card:hover,
.section:hover,
.download-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
}

/* STAGGER ANIMATION HELP */
.stagger > * {
  opacity: 0;
  transform: translateY(18px);
  animation: staggerIn 0.6s ease forwards;
}

.stagger > *:nth-child(1) {
  animation-delay: 0.05s;
}
.stagger > *:nth-child(2) {
  animation-delay: 0.1s;
}
.stagger > *:nth-child(3) {
  animation-delay: 0.15s;
}
.stagger > *:nth-child(4) {
  animation-delay: 0.2s;
}

@keyframes staggerIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* SMOOTH PAGE ENTRY */
body {
  animation: pageIn 0.6s ease-out;
}

@keyframes pageIn {
  from {
    opacity: 0;
    filter: blur(6px);
  }
  to {
    opacity: 1;
    filter: blur(0);
  }
}

/* =========================
   PROFILE STYLE (UNIFIED LOOK)
========================= */

.profile-card {
  display: flex;
  align-items: center;
  gap: 18px;

  padding: 16px;
  border-radius: 14px;

  background: var(--surface);
  border: 1px solid var(--border);

  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.profile-card:hover {
  transform: translateY(-8px) scale(1.01);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.14);
}

/* SMALL AVATAR STYLE (like personal photo) */
.profile-avatar {
  width: 64px;
  height: 64px;

  object-fit: cover;

  border-radius: 14px;
  background: white;
  padding: 6px;

  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

/* TEXT ALIGNMENT */
.profile-info p {
  margin: 0;
  color: var(--text-light);
  line-height: 1.6;
}

@media (max-width: 600px) {
  .profile-card {
    flex-direction: column;
    text-align: center;
  }
}

.footer {
  background: var(--surface);       /* consistent surface color */
  padding: var(--s6);               /* spacing consistent with sections */
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-light);         /* matches secondary text */
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow);        /* consistent shadow effect */
  border-radius: var(--radius) var(--radius) 0 0; /* round top corners only */
  margin-top: var(--s6);
}