:root {
  --primary: #2948c6;
  --primary-glow: rgba(41, 72, 198, 0.15);
  --secondary: #ff7057;
  --secondary-glow: rgba(255, 112, 87, 0.2);
  --bg-dark: #090b11;
  --bg-light: #f7f8fc;
  --text-dark: #0e111d;
  --text-light: #ffffff;
  --text-muted: #687086;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.4);
  --glass-shadow: 0 20px 50px rgba(9, 11, 17, 0.1);
  --font-main: 'Outfit', sans-serif;
  --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-light);
  color: var(--text-dark);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Particle / Ambient Mesh Background */
.particle-background {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: radial-gradient(circle at 10% 20%, rgba(41, 72, 198, 0.05) 0%, transparent 40%),
              radial-gradient(circle at 90% 80%, rgba(255, 112, 87, 0.06) 0%, transparent 40%);
  pointer-events: none;
  overflow: hidden;
}

.particle-background::before,
.particle-background::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  z-index: -1;
  opacity: 0.6;
  animation: floatAmbient 20s infinite alternate ease-in-out;
}

.particle-background::before {
  width: 400px;
  height: 400px;
  background: var(--primary);
  top: -100px;
  left: -100px;
}

.particle-background::after {
  width: 500px;
  height: 500px;
  background: var(--secondary);
  bottom: -150px;
  right: -150px;
  animation-delay: -5s;
}

@keyframes floatAmbient {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(80px, 50px) scale(1.2);
  }
}

.app-shell {
  position: relative;
  min-height: 100vh;
  z-index: 1;
}

/* Hidden Utility */
.is-hidden {
  display: none !important;
}

/* -------------------------------------------------------------------------- */
/* 1. Animated Intro Styles                                                  */
/* -------------------------------------------------------------------------- */
.intro {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-dark);
  color: var(--text-light);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.8s;
}

.intro-section {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  max-width: 600px;
  padding: 20px;
  opacity: 0;
  transform: scale(0.92) translateY(20px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), 
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.intro-section.active {
  display: flex;
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* Stage 1: Brand Reveal */
.intro-logo-container {
  position: relative;
  width: min(580px, 85vw);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
  animation: logoEntrance 1.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.intro-logo {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 4px 15px rgba(41, 72, 198, 0.25)) 
          drop-shadow(0 15px 45px rgba(255, 112, 87, 0.35));
  animation: logoFloat 4s ease-in-out infinite alternate;
}

.glow-ring {
  position: absolute;
  width: min(680px, 95vw);
  height: min(680px, 95vw);
  border: 1.5px dashed rgba(255, 112, 87, 0.2);
  border-radius: 50%;
  animation: spinRing 2.0s linear infinite;
  pointer-events: none;
  z-index: 1;
}

.glow-ring::before {
  content: '';
  position: absolute;
  top: 15px;
  left: 50%;
  width: 12px;
  height: 12px;
  background: var(--secondary);
  border-radius: 50%;
  box-shadow: 0 0 20px var(--secondary), 0 0 40px var(--secondary);
}

@keyframes spinRing {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes logoEntrance {
  0% {
    opacity: 0;
    transform: scale(0.88) translateY(20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes logoFloat {
  0% {
    transform: translateY(0);
    filter: drop-shadow(0 4px 15px rgba(41, 72, 198, 0.25)) 
            drop-shadow(0 15px 45px rgba(255, 112, 87, 0.35));
  }
  100% {
    transform: translateY(-10px);
    filter: drop-shadow(0 8px 25px rgba(41, 72, 198, 0.3)) 
            drop-shadow(0 20px 55px rgba(255, 112, 87, 0.45));
  }
}

/* Stage 2: Tagline Reveal */
.tagline-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.tagline-item {
  overflow: hidden;
}

.tagline-item span {
  display: block;
  font-size: clamp(2.8rem, 8vw, 4.8rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -1px;
  line-height: 1.1;
  background: linear-gradient(90deg, #fff, rgba(255, 255, 255, 0.3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  transform: translateY(100%);
  animation: revealText 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#introTagline.active .tagline-item:nth-child(1) span { animation-delay: 0.1s; }
#introTagline.active .tagline-item:nth-child(2) span { animation-delay: 0.4s; }
#introTagline.active .tagline-item:nth-child(3) span { animation-delay: 0.7s; }

.tagline-sub {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--text-muted);
  margin-top: 30px;
  font-weight: 400;
  opacity: 0;
  animation: fadeIn 0.8s ease forwards 1.2s;
}

@keyframes revealText {
  to { transform: translateY(0); }
}

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

/* Stage 3: Initializing Loader */
.tech-loader {
  position: relative;
  width: 90px;
  height: 90px;
  margin-bottom: 24px;
}

.loader-circle {
  width: 100%;
  height: 100%;
  border: 3px solid rgba(255, 255, 255, 0.05);
  border-top-color: var(--secondary);
  border-bottom-color: var(--primary);
  border-radius: 50%;
  animation: spinLoader 1.5s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.loader-scanner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 50px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--secondary));
  transform-origin: left center;
  animation: spinScanner 2s linear infinite;
}

.loader-status {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-msg {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.5px;
}

.status-percent {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--secondary);
}

@keyframes spinLoader {
  to { transform: rotate(360deg); }
}

@keyframes spinScanner {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* -------------------------------------------------------------------------- */
/* 2. Beautiful Creative Login Page                                          */
/* -------------------------------------------------------------------------- */
.login-view {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  z-index: 2;
  position: relative;
}

.login-container {
  width: 100%;
  max-width: 480px;
}

.login-card-wrapper {
  position: relative;
}

.login-card-wrapper::before {
  content: '';
  position: absolute;
  inset: -15px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 36px;
  z-index: -1;
  filter: blur(25px);
  opacity: 0.15;
  transition: var(--transition-smooth);
}

.login-card-wrapper:hover::before {
  opacity: 0.22;
  filter: blur(30px);
}

.login-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: clamp(30px, 8vw, 48px) clamp(24px, 5vw, 40px);
  border-radius: 28px;
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-direction: column;
  gap: 20px;
  transform: translateY(0);
  transition: var(--transition-smooth);
}

.login-header {
  text-align: center;
  margin-bottom: 12px;
}

.login-logo {
  height: 58px;
  width: auto;
  margin-bottom: 20px;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(9, 11, 17, 0.05);
}

.login-eyebrow {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.login-header h1 {
  font-size: 1.85rem;
  font-weight: 900;
  color: var(--text-dark);
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.login-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Floating Input Styling */
.input-group {
  position: relative;
}

.input-field {
  position: relative;
  width: 100%;
}

.input-field input {
  width: 100%;
  min-height: 56px;
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(14, 17, 29, 0.08);
  border-radius: 12px;
  padding: 18px 16px 6px;
  outline: none;
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--text-dark);
  font-family: inherit;
  transition: var(--transition-smooth);
}

.input-field label {
  position: absolute;
  left: 16px;
  top: 18px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.96rem;
  pointer-events: none;
  transition: var(--transition-smooth);
  transform-origin: left top;
}

.input-highlight {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: var(--transition-smooth);
  transform: translateX(-50%);
  border-radius: 2px;
}

/* Handle floating label placement when input focused/not empty */
.input-field input:focus ~ label,
.input-field input:not(:placeholder-shown) ~ label {
  transform: translateY(-11px) scale(0.74);
  color: var(--primary);
  font-weight: 700;
}

.input-field input:focus {
  border-color: rgba(41, 72, 198, 0.25);
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(41, 72, 198, 0.04);
}

.input-field input:focus ~ .input-highlight {
  width: calc(100% - 24px);
}

/* Error text */
.login-error {
  font-size: 0.84rem;
  font-weight: 600;
  color: #d93838;
  margin-top: -4px;
  min-height: 18px;
  text-align: center;
  animation: shakeError 0.4s ease;
}

@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* Creative Login Button */
.btn-login {
  width: 100%;
  min-height: 56px;
  background: var(--text-dark);
  color: var(--text-light);
  border: 0;
  border-radius: 12px;
  font-size: 0.98rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(14, 17, 29, 0.15);
  transition: var(--transition-smooth);
}

.btn-login::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  opacity: 0;
  transition: var(--transition-smooth);
  z-index: 1;
}

.btn-login span, 
.btn-login svg {
  position: relative;
  z-index: 2;
}

.rocket-icon {
  width: 20px;
  height: 20px;
  transform: rotate(45deg);
  transition: var(--transition-smooth);
}

/* Login button hover effects */
.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(41, 72, 198, 0.25);
}

.btn-login:hover::before {
  opacity: 1;
}

.btn-login:hover .rocket-icon {
  transform: rotate(45deg) translate(2px, -2px);
}

/* Active submit animation */
.btn-login.is-loading .rocket-icon {
  animation: launchRocket 1.2s ease infinite;
}

@keyframes launchRocket {
  0% { transform: rotate(45deg) translate(0, 0); opacity: 1; }
  49% { transform: rotate(45deg) translate(20px, -20px); opacity: 0; }
  50% { transform: rotate(45deg) translate(-20px, 20px); opacity: 0; }
  100% { transform: rotate(45deg) translate(0, 0); opacity: 1; }
}

/* -------------------------------------------------------------------------- */
/* 3. Dashboard Styles                                                       */
/* -------------------------------------------------------------------------- */
.dashboard {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 2;
  opacity: 1;
  transition: var(--transition-smooth);
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px clamp(16px, 5vw, 56px);
  background: rgba(255, 255, 255, 0.7);
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-logo {
  height: 42px;
  width: auto;
  border-radius: 6px;
}

.badge-status {
  font-size: 0.68rem;
  font-weight: 800;
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  padding: 4px 10px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid rgba(16, 185, 129, 0.15);
}

.btn-logout {
  padding: 8px 18px;
  border: 1px solid rgba(14, 17, 29, 0.08);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text-dark);
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-logout:hover {
  background: var(--text-dark);
  color: #ffffff;
  border-color: var(--text-dark);
}

.dashboard-content {
  flex: 1;
  width: min(1080px, calc(100% - 36px));
  margin: 0 auto;
  padding: clamp(40px, 8vw, 80px) 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.dashboard-intro {
  margin-bottom: 40px;
  text-align: center;
}

.eyebrow {
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 10px;
}

.dashboard-intro h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 900;
  color: var(--text-dark);
  letter-spacing: -0.5px;
  margin-bottom: 12px;
}

.dashboard-intro .sub {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Dashboard Portal Cards Grid */
.portal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.portal-card {
  min-height: 280px;
  background: #ffffff;
  border: 1px solid rgba(14, 17, 29, 0.06);
  border-radius: 20px;
  padding: clamp(24px, 5vw, 38px);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 10px 30px rgba(9, 11, 17, 0.02);
  transition: var(--transition-smooth);
}

/* Card Glow Hover Overlay */
.card-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), transparent 0%, rgba(9, 11, 17, 0.02) 60%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.portal-card:hover .card-glow {
  opacity: 1;
}

.portal-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 45px rgba(9, 11, 17, 0.08);
}

.portal-card.pricing {
  border-left: 5px solid var(--primary);
}

.portal-card.billing {
  border-left: 5px solid var(--secondary);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  position: relative;
  transition: var(--transition-smooth);
}

.card-rocket-img {
  width: 92px;
  height: 92px;
  object-fit: contain;
  position: absolute;
  top: -18px;
  left: -18px;
  filter: drop-shadow(0 6px 12px rgba(9, 11, 17, 0.18));
  transition: var(--transition-smooth);
  pointer-events: none;
}

.portal-card:hover .card-rocket-img {
  transform: translateY(-8px) scale(1.12) rotate(-5deg);
  filter: drop-shadow(0 16px 32px rgba(9, 11, 17, 0.3));
}

.pricing .card-icon {
  background: var(--primary-glow);
  color: var(--primary);
}

.billing .card-icon {
  background: var(--secondary-glow);
  color: var(--secondary);
}

.card-badge {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: var(--transition-smooth);
}

.pricing .card-badge {
  background: rgba(41, 72, 198, 0.08);
  color: #5875e8;
  border: 1.5px solid rgba(41, 72, 198, 0.3);
  box-shadow: 0 0 12px rgba(41, 72, 198, 0.05);
}

.billing .card-badge {
  background: rgba(255, 112, 87, 0.08);
  color: #ff8b75;
  border: 1.5px solid rgba(255, 112, 87, 0.3);
  box-shadow: 0 0 12px rgba(255, 112, 87, 0.05);
}

.portal-card:hover .pricing .card-badge {
  background: rgba(41, 72, 198, 0.15);
  border-color: rgba(41, 72, 198, 0.6);
  box-shadow: 0 0 16px rgba(41, 72, 198, 0.2);
}

.portal-card:hover .billing .card-badge {
  background: rgba(255, 112, 87, 0.15);
  border-color: rgba(255, 112, 87, 0.6);
  box-shadow: 0 0 16px rgba(255, 112, 87, 0.2);
}

.card-body h2 {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 10px;
}

.card-body p {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.card-action {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 800;
  margin-top: 24px;
  transition: var(--transition-smooth);
}

.pricing .card-action { color: var(--primary); }
.billing .card-action { color: var(--secondary); }

.card-action .arrow {
  transition: var(--transition-smooth);
}

.portal-card:hover .card-action .arrow {
  transform: translateX(6px);
}

/* -------------------------------------------------------------------------- */
/* 4. Full screen Workspace Viewer                                           */
/* -------------------------------------------------------------------------- */
.workspace-view {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #ffffff;
  display: flex;
  flex-direction: column;
}

.workspace-header {
  height: 60px;
  background: #ffffff;
  border-bottom: 1px solid rgba(14, 17, 29, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(10px, 3vw, 24px);
  position: relative;
  z-index: 10;
  box-shadow: 0 2px 10px rgba(9, 11, 17, 0.02);
}

.ws-header-left {
  display: flex;
  align-items: center;
  gap: clamp(10px, 3vw, 20px);
}

.ws-header-title {
  font-weight: 800;
  font-size: 0.96rem;
  color: var(--text-dark);
  padding-left: clamp(10px, 3vw, 20px);
  border-left: 1px solid rgba(14, 17, 29, 0.1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.btn-ws-control {
  border: 1px solid rgba(14, 17, 29, 0.08);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text-dark);
  font-weight: 700;
  font-size: 0.8rem;
  padding: 7px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-smooth);
}

.btn-ws-control:hover {
  background: #f1f3f9;
  border-color: rgba(14, 17, 29, 0.15);
}

.btn-ws-control.btn-back {
  background: var(--text-dark);
  color: #ffffff;
  border-color: var(--text-dark);
}

.btn-ws-control.btn-back:hover {
  background: rgba(14, 17, 29, 0.85);
}

.ws-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-ws-logout {
  background: #ffffff;
  color: #d93838;
  border-color: rgba(217, 56, 56, 0.15);
}

.btn-ws-logout:hover {
  background: #fff5f5;
  border-color: #d93838;
}

/* Iframe and loading frame */
.iframe-container {
  flex: 1;
  position: relative;
  background: #f7f8fc;
  overflow: hidden;
}

#workspaceIframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.iframe-loader {
  position: absolute;
  inset: 0;
  background: rgba(247, 248, 252, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 5;
  transition: opacity 0.4s ease, visibility 0.4s;
}

.iframe-loader.is-loaded {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.iframe-loader .spin {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(41, 72, 198, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spinLoader 0.8s linear infinite;
}

.iframe-loader span {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* -------------------------------------------------------------------------- */
/* 5. Responsive Design                                                      */
/* -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .portal-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .dashboard-content {
    padding: 30px 0;
  }
  
  .ws-header-title {
    display: none;
  }
}
