/* ============================================================
   LENA Platform - Global Stylesheet
   Alercell Inc. © 2025
   
   Design System:
   - Primary: Deep navy (#0a1628) to midnight (#060d1a)
   - Accent: Cyan (#00d4ff) with teal variations
   - Secondary accent: Emerald (#00c9a7) for success states
   - Alert: Coral (#ff6b6b) for warnings
   - Typography: DM Sans (body) + Instrument Serif (display)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Instrument+Serif:ital@0;1&family=JetBrains+Mono:wght@400;500&display=swap');

/* ---------------------------------------------------------------------------
   CSS Custom Properties
   --------------------------------------------------------------------------- */
:root {
--color-bg-deep: #0c1524;
--color-bg-primary: #101d30;
  --color-bg-elevated: #0f1f38;
  --color-bg-card: #12243f;
  --color-bg-card-hover: #162a4a;
  --color-border: rgba(0, 212, 255, 0.12);
  --color-border-hover: rgba(0, 212, 255, 0.25);

  --color-accent: #00d4ff;
  --color-accent-dim: rgba(0, 212, 255, 0.15);
  --color-accent-glow: rgba(0, 212, 255, 0.4);
  --color-emerald: #00c9a7;
  --color-coral: #ff6b6b;
  --color-amber: #ffb74d;
  --color-violet: #b388ff;

 --color-text-primary: #f4f7fb;
--color-text-secondary: #b0c4de;
--color-text-tertiary: #8899b0;
  --color-text-accent: var(--color-accent);

  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(0, 212, 255, 0.15);

  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
}

/* ---------------------------------------------------------------------------
   Reset & Base
   --------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--color-bg-deep);
  color: var(--color-text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: #4de0ff;
}

img {
  max-width: 100%;
  height: auto;
}

/* ---------------------------------------------------------------------------
   Background Effects
   --------------------------------------------------------------------------- */
.bg-pattern {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(0, 212, 255, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(0, 201, 167, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(0, 0, 0, 0) 0%, var(--color-bg-deep) 100%);
}

/* Subtle grid overlay */
.bg-pattern::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 212, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* ---------------------------------------------------------------------------
   Navigation
   --------------------------------------------------------------------------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(6, 13, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition-base);
}

.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.nav-brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--color-accent), var(--color-emerald));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--color-bg-deep);
  letter-spacing: -0.5px;
}

.nav-brand-text {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--color-text-primary);
  letter-spacing: -0.3px;
}

.nav-brand-text span {
  color: var(--color-accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
}

.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--color-text-primary);
  background: var(--color-accent-dim);
}

.nav-link.active {
  color: var(--color-accent);
  background: var(--color-accent-dim);
}

.nav-logout {
  margin-left: 12px;
  padding: 8px 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-tertiary);
  transition: all var(--transition-fast);
}

.nav-logout:hover {
  color: var(--color-coral);
  border-color: rgba(255, 107, 107, 0.3);
  background: rgba(255, 107, 107, 0.08);
}

/* Mobile nav */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--color-text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 8px;
}

@media (max-width: 1024px) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    background: rgba(6, 13, 26, 0.97);
    backdrop-filter: blur(20px);
    flex-direction: column;
    padding: 1rem;
    border-bottom: 1px solid var(--color-border);
    gap: 4px;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-link {
    padding: 12px 16px;
    width: 100%;
  }

  .nav-logout {
    margin-left: 0;
    margin-top: 8px;
    width: 100%;
    text-align: center;
  }
}

/* ---------------------------------------------------------------------------
   Login Page
   --------------------------------------------------------------------------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  z-index: 1;
}

.login-container {
  width: 100%;
  max-width: 440px;
  animation: fadeInUp 0.6s ease;
}

.login-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.login-logo {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-accent), var(--color-emerald));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  color: var(--color-bg-deep);
  margin-bottom: 1.25rem;
}

.login-title {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--color-text-primary);
  margin-bottom: 0.5rem;
}

.login-subtitle {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
}

.login-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.login-form .form-group {
  margin-bottom: 1.5rem;
}

.login-form label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

.login-form input[type="password"] {
  width: 100%;
  padding: 14px 16px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-family: var(--font-mono);
  font-size: 1rem;
  letter-spacing: 0.15em;
  transition: all var(--transition-fast);
  outline: none;
}

.login-form input[type="password"]:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-dim);
}

.login-form input[type="password"]::placeholder {
  color: var(--color-text-tertiary);
  letter-spacing: 0.05em;
  font-family: var(--font-body);
}

.login-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--color-accent), #00b8d9);
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-bg-deep);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  letter-spacing: 0.02em;
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0, 212, 255, 0.3);
}

.login-btn:active {
  transform: translateY(0);
}

.login-error {
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.25);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  color: var(--color-coral);
}

.login-footer {
  text-align: center;
  margin-top: 2rem;
  font-size: 0.8125rem;
  color: var(--color-text-tertiary);
}

.login-footer a {
  color: var(--color-text-secondary);
}

/* ---------------------------------------------------------------------------
   Page Container (authenticated pages)
   --------------------------------------------------------------------------- */
.page {
  position: relative;
  z-index: 1;
  padding-top: 72px; /* nav height */
  min-height: 100vh;
}

.page-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
}

/* ---------------------------------------------------------------------------
   Home Page - Hero
   --------------------------------------------------------------------------- */
.hero {
  text-align: center;
  padding: 4rem 0 3rem;
  max-width: 900px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: var(--color-accent-dim);
  border: 1px solid var(--color-border);
  border-radius: 100px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-accent);
  letter-spacing: 0.04em;
  margin-bottom: 1.75rem;
  animation: fadeInUp 0.5s ease;
}

.hero-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-emerald);
  animation: pulse-dot 2s ease infinite;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  line-height: 1.15;
  margin-bottom: 1.25rem;
  animation: fadeInUp 0.6s ease 0.1s both;
}

.hero h1 .accent {
  color: var(--color-accent);
}

.hero-description {
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--color-text-secondary);
  max-width: 700px;
  margin: 0 auto 2.5rem;
  animation: fadeInUp 0.6s ease 0.2s both;
}

/* ---------------------------------------------------------------------------
   Pipeline Section
   --------------------------------------------------------------------------- */
.pipeline-section {
  margin-bottom: 3rem;
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-header h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.section-header p {
  color: var(--color-text-secondary);
  font-size: 0.9375rem;
}

/* Pipeline flow */
.pipeline {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin-bottom: 4rem;
  position: relative;
}

/* Connecting line behind cards */
.pipeline::before {
  content: '';
  position: absolute;
  top: 48px;
  left: 10%;
  right: 10%;
  height: 2px;
  background: linear-gradient(90deg,
    var(--color-accent) 0%,
    var(--color-emerald) 50%,
    var(--color-violet) 100%
  );
  opacity: 0.3;
  z-index: 0;
}

.pipeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  z-index: 1;
  text-decoration: none;
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
  border: 1px solid transparent;
}

.pipeline-step:hover {
  background: var(--color-bg-card);
  border-color: var(--color-border);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.step-number {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.125rem;
  margin-bottom: 1rem;
  border: 2px solid;
  transition: all var(--transition-base);
}

.step-1 .step-number { border-color: var(--color-accent); color: var(--color-accent); background: var(--color-accent-dim); }
.step-2 .step-number { border-color: #20b2ff; color: #20b2ff; background: rgba(32, 178, 255, 0.12); }
.step-3 .step-number { border-color: var(--color-emerald); color: var(--color-emerald); background: rgba(0, 201, 167, 0.12); }
.step-4 .step-number { border-color: var(--color-amber); color: var(--color-amber); background: rgba(255, 183, 77, 0.12); }
.step-5 .step-number { border-color: var(--color-violet); color: var(--color-violet); background: rgba(179, 136, 255, 0.12); }

.step-icon {
  font-size: 1.25rem;
}

.step-title {
  font-weight: 600;
  font-size: 0.9375rem;
  margin-bottom: 0.375rem;
  color: var(--color-text-primary);
}

.step-desc {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

@media (max-width: 900px) {
  .pipeline {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .pipeline::before {
    display: none;
  }
  .pipeline-step {
    flex-direction: row;
    text-align: left;
    gap: 1rem;
    padding: 1rem;
  }
  .step-number {
    margin-bottom: 0;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
  }
}

/* ---------------------------------------------------------------------------
   Feature Cards
   --------------------------------------------------------------------------- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 4rem;
}

.feature-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: all var(--transition-base);
}

.feature-card:hover {
  border-color: var(--color-border-hover);
  background: var(--color-bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 1.25rem;
}

.feature-icon.cyan { background: var(--color-accent-dim); color: var(--color-accent); }
.feature-icon.emerald { background: rgba(0, 201, 167, 0.12); color: var(--color-emerald); }
.feature-icon.amber { background: rgba(255, 183, 77, 0.12); color: var(--color-amber); }
.feature-icon.violet { background: rgba(179, 136, 255, 0.12); color: var(--color-violet); }

.feature-card h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  margin-bottom: 0.625rem;
}

.feature-card p {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  line-height: 1.65;
}

/* ---------------------------------------------------------------------------
   Dashboard Page
   --------------------------------------------------------------------------- */
.dashboard-header {
  margin-bottom: 2rem;
  animation: fadeInUp 0.5s ease;
}

.dashboard-header .step-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  background: var(--color-accent-dim);
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.dashboard-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  margin-bottom: 0.375rem;
}

.dashboard-header .subtitle {
  font-size: 1rem;
  color: var(--color-text-secondary);
  margin-bottom: 1rem;
}

.dashboard-header .description {
  font-size: 0.9375rem;
  color: var(--color-text-tertiary);
  line-height: 1.7;
  max-width: 800px;
}

.dashboard-frame-wrapper {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.6s ease 0.15s both;
}

.dashboard-frame-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--color-bg-elevated);
  border-bottom: 1px solid var(--color-border);
}

.frame-dots {
  display: flex;
  gap: 6px;
}

.frame-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-text-tertiary);
  opacity: 0.4;
}

.frame-dot:first-child { background: var(--color-coral); opacity: 0.7; }
.frame-dot:nth-child(2) { background: var(--color-amber); opacity: 0.7; }
.frame-dot:nth-child(3) { background: var(--color-emerald); opacity: 0.7; }

.frame-url {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-tertiary);
  background: var(--color-bg-primary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.frame-fullscreen-btn {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-tertiary);
  padding: 6px 12px;
  font-size: 0.75rem;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all var(--transition-fast);
}

.frame-fullscreen-btn:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: var(--color-accent-dim);
}

.dashboard-iframe {
  width: 100%;
  height: calc(100vh - 240px);
  min-height: 600px;
  border: none;
  display: block;
  background: #fff;
}

.dashboard-frame-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 400px;
  color: var(--color-text-tertiary);
  font-size: 0.9375rem;
}

/* ---------------------------------------------------------------------------
   Stats Bar
   --------------------------------------------------------------------------- */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 3rem;
  animation: fadeInUp 0.5s ease 0.3s both;
}

.stat-item {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  text-align: center;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--color-accent);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--color-text-tertiary);
  margin-top: 0.25rem;
}

/* ---------------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------------- */
.footer {
  border-top: 1px solid var(--color-border);
  padding: 2rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--color-text-tertiary);
  position: relative;
  z-index: 1;
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer a {
  color: var(--color-text-secondary);
}

/* ---------------------------------------------------------------------------
   Error Page
   --------------------------------------------------------------------------- */
.error-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  position: relative;
  z-index: 1;
}

.error-code {
  font-family: var(--font-display);
  font-size: 6rem;
  color: var(--color-accent);
  line-height: 1;
  margin-bottom: 1rem;
  opacity: 0.6;
}

.error-message {
  font-size: 1.125rem;
  color: var(--color-text-secondary);
  margin-bottom: 2rem;
}

.error-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--color-accent-dim);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-accent);
  font-weight: 600;
  font-size: 0.9375rem;
  transition: all var(--transition-fast);
}

.error-link:hover {
  background: rgba(0, 212, 255, 0.2);
  border-color: var(--color-accent);
}

/* ---------------------------------------------------------------------------
   Animations
   --------------------------------------------------------------------------- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

/* Staggered animation for children */
.animate-children > * {
  animation: fadeInUp 0.5s ease both;
}
.animate-children > *:nth-child(1) { animation-delay: 0s; }
.animate-children > *:nth-child(2) { animation-delay: 0.08s; }
.animate-children > *:nth-child(3) { animation-delay: 0.16s; }
.animate-children > *:nth-child(4) { animation-delay: 0.24s; }
.animate-children > *:nth-child(5) { animation-delay: 0.32s; }

/* ---------------------------------------------------------------------------
   Utility
   --------------------------------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.text-accent { color: var(--color-accent); }
.text-emerald { color: var(--color-emerald); }
.text-secondary { color: var(--color-text-secondary); }
