/* ═══════════════════════════════════════════
   NirasCode — Enterprise Demo Portal
   Premium Dark Theme
═══════════════════════════════════════════ */

:root {
  --bg-primary: #060c1a;
  --bg-secondary: #0a1428;
  --accent-cyan: #22d3ee;
  --accent-blue: #3b82f6;
  --accent-indigo: #818cf8;
  --accent-glow: rgba(34, 211, 238, 0.28);
  --accent-glow-blue: rgba(59, 130, 246, 0.22);
  --text-primary: #f1f5f9;
  --text-secondary: #7e90a8;
  --border-color: rgba(255, 255, 255, 0.07);
  --glass-bg: rgba(8, 15, 32, 0.85);
  --glass-blur: blur(24px) saturate(160%);
  --header-height: 72px;
  --footer-height: 58px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  background-image:
    radial-gradient(ellipse 80% 55% at 50% -10%, rgba(34, 211, 238, 0.1) 0%, transparent 60%),
    radial-gradient(ellipse 45% 35% at 85% 35%, rgba(99, 102, 241, 0.06) 0%, transparent 55%),
    radial-gradient(ellipse 35% 25% at 10% 75%, rgba(59, 130, 246, 0.05) 0%, transparent 50%);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

/* Typography */
h1, h2, h3 { font-weight: 700; letter-spacing: -0.025em; line-height: 1.15; }

a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover { color: var(--text-primary); }

/* ─── Glass Utility ─── */
.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

/* ════════════════════════════════
   HEADER
════════════════════════════════ */
.portal-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  z-index: 100;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}

/* Client branding (shown after auth) */
.client-branding {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  animation: fadeSlideIn 0.5s ease-out;
}

.client-logo {
  max-height: 30px;
  max-width: 140px;
  object-fit: contain;
  opacity: 0.9;
}

.divider {
  height: 22px;
  width: 1px;
  background-color: var(--border-color);
}

.client-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* Portal logo badge */
.portal-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.portal-wordmark {
  display: flex;
  align-items: center;
  gap: 8px;
}

.portal-wordmark-icon {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.04em;
  box-shadow: 0 4px 12px rgba(34, 211, 238, 0.3);
  flex-shrink: 0;
}

.portal-wordmark-text {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}

.badge {
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.2);
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
}

/* ════════════════════════════════
   MAIN AREA
════════════════════════════════ */
.portal-main {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* State Containers */
.state-container {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 2rem;
}

.state-container p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ─── Spinner ─── */
.spinner-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 2px solid rgba(34, 211, 238, 0.12);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.85s cubic-bezier(0.4, 0.1, 0.6, 0.9) infinite;
  box-shadow: 0 0 20px var(--accent-glow);
}

.spinner-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  animation: pulseFade 1.5s ease-in-out infinite;
}

/* ─── Error Card ─── */
.error-card {
  padding: 3rem 2.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.04);
  text-align: center;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.4);
  animation: fadeSlideIn 0.4s ease-out;
}

.error-card h2 {
  color: #f87171;
  margin-bottom: 0.75rem;
  font-size: 1.4rem;
}

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

.error-retry {
  margin-top: 1.75rem;
  display: inline-block;
  padding: 10px 22px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.25s ease;
}

.error-retry:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
}

/* ─── IFrame Viewer ─── */
.demo-viewer {
  flex: 1;
  width: 100%;
  height: 100%;
  background-color: #fff;
  animation: fadeIn 0.7s ease-out;
  position: absolute;
  inset: 0;
}

.secure-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ════════════════════════════════
   ACCESS CARD
════════════════════════════════ */
.access-card {
  padding: 3.5rem 3rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  text-align: center;
  max-width: 480px;
  width: 90%;
  box-shadow:
    0 48px 96px -24px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 60px rgba(34, 211, 238, 0.05);
  animation: fadeSlideIn 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

/* Subtle top glow line */
.access-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 15%;
  right: 15%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), var(--accent-blue), transparent);
  opacity: 0.5;
}

/* Lock icon */
.lock-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.12), rgba(59, 130, 246, 0.08));
  border: 1px solid rgba(34, 211, 238, 0.2);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 2rem;
  font-size: 1.75rem;
  box-shadow: 0 8px 24px rgba(34, 211, 238, 0.15);
  animation: lockPulse 3s ease-in-out infinite;
}

.access-card h2 {
  font-size: 1.65rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  letter-spacing: -0.03em;
  background: linear-gradient(160deg, #fff 40%, rgba(241, 245, 249, 0.6) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.access-card p {
  margin-bottom: 2.25rem;
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* Input group */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

#access-key {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  color: var(--text-primary);
  font-size: 1.05rem;
  text-align: center;
  letter-spacing: 0.12em;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  transition: all 0.3s ease;
  width: 100%;
}

#access-key::placeholder { letter-spacing: 0.06em; color: rgba(126, 144, 168, 0.6); }

#access-key:focus {
  outline: none;
  border-color: var(--accent-cyan);
  background: rgba(34, 211, 238, 0.04);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.1), 0 0 20px rgba(34, 211, 238, 0.08);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-blue) 100%);
  color: white;
  border: none;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(34, 211, 238, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(34, 211, 238, 0.45), 0 0 0 1px rgba(34, 211, 238, 0.2);
}

.btn-primary:hover::after { opacity: 1; }
.btn-primary:active { transform: translateY(0); }

/* Error message */
.error-msg {
  margin-top: 1.25rem;
  color: #f87171;
  font-size: 0.85rem;
  background: rgba(239, 68, 68, 0.08);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(239, 68, 68, 0.2);
  line-height: 1.5;
}

/* ════════════════════════════════
   FOOTER
════════════════════════════════ */
.portal-footer {
  height: var(--footer-height);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  z-index: 100;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  font-size: 0.8rem;
}

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

.legal-nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.legal-nav a {
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

.legal-nav a:hover { color: var(--text-primary); }

.admin-link {
  color: rgba(126, 144, 168, 0.45) !important;
  font-size: 0.75rem !important;
  transition: color 0.3s ease !important;
}

.admin-link:hover { color: rgba(126, 144, 168, 0.75) !important; }

/* ════════════════════════════════
   STATIC PAGES
════════════════════════════════ */
.static-page {
  padding: 4rem 2rem;
  max-width: 760px;
  margin: 0 auto;
  color: var(--text-secondary);
  overflow-y: auto;
  height: 100%;
}

.static-page h1 {
  color: var(--text-primary);
  margin-bottom: 2.5rem;
  font-size: 2.25rem;
  letter-spacing: -0.03em;
}

.static-page h2 {
  color: var(--text-primary);
  margin: 2rem 0 0.75rem;
  font-size: 1.15rem;
}

.static-page p { margin-bottom: 1rem; line-height: 1.75; font-size: 0.95rem; }

/* ════════════════════════════════
   ANIMATIONS
════════════════════════════════ */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseFade {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

@keyframes lockPulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(34, 211, 238, 0.15); }
  50% { box-shadow: 0 8px 32px rgba(34, 211, 238, 0.28), 0 0 0 6px rgba(34, 211, 238, 0.04); }
}

/* ════════════════════════════════
   RESPONSIVE
════════════════════════════════ */
@media (max-width: 768px) {
  .portal-header { padding: 0 1.25rem; }

  .client-branding { gap: 0.75rem; }
  .client-logo { max-width: 100px; }
  .client-name { font-size: 0.9rem; }
  .badge { display: none; }

  .access-card { padding: 2.5rem 1.75rem; }
  .access-card h2 { font-size: 1.4rem; }

  .footer-content {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  .portal-footer { height: auto; padding: 0.875rem 1.25rem; }
}
