:root {
  --bg-1: #020617;
  --bg-2: #0b1220;
  --bg-3: #0f172a;
  --card-bg: rgba(15, 23, 42, 0.65);
  --card-border: rgba(255, 255, 255, 0.08);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --accent-1: #3b82f6;
  --accent-2: #2563eb;
  --hero-overlay: rgba(2, 6, 23, 0.75);
}

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

body {
  font-family: 'Source Sans Pro', sans-serif;
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 100vh;
}

/* LOADING SCREEN GLOBAL */
.loading-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--bg-1), var(--bg-2), var(--bg-3));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.8s ease;
}

.loading-screen.hide {
  opacity: 0;
  pointer-events: none;
}

.loader {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top: 4px solid var(--accent-1);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* SPLIT SCREEN CONTAINER */
.split-screen-body {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

.split-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

/* https://images.unsplash.com/photo-1550751827-4bd374c3f58b?w=1200&q=80 */ 

/* ============================================
   LEFT SIDE: HERO IMAGE
   ============================================ */
.split-hero {
  flex: 2;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  background: 
    linear-gradient(135deg, var(--accent-2), var(--accent-1)),
    url('https://images.unsplash.com/photo-1460925895917-afdab827c52f?w=1200&q=80') center/cover;
  background-blend-mode: overlay;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  opacity: 0;
  transform: translateX(-100%);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.split-hero.slide-in-left {
  opacity: 1;
  transform: translateX(0);
}

/* Hero Overlay */
.hero-overlay {
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(circle at 30% 50%, rgba(59, 130, 246, 0.3), transparent 60%),
    linear-gradient(135deg, rgba(2, 6, 23, 0.85), rgba(15, 23, 42, 0.7));
  z-index: 1;
}

/* Hero Pattern */
.hero-pattern {
  position: absolute;
  inset: 0;
  background-image: 
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.03) 0px,
      transparent 1px,
      transparent 40px,
      rgba(255, 255, 255, 0.03) 41px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.03) 0px,
      transparent 1px,
      transparent 40px,
      rgba(255, 255, 255, 0.03) 41px
    );
  z-index: 1;
  animation: patternMove 20s linear infinite;
}

/* Hero Content */
.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 3rem;
  max-width: 600px;
  animation: fadeInUp 1s ease 0.3s both;
}

.hero-icon {
  width: 100px;
  height: 100px;
  margin: 0 auto 2rem;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.hero-icon i {
  font-size: 3rem;
  color: white;
  animation: pulse 2s ease infinite;
}

.hero-title {
  font-size: 3rem;
  font-weight: 700;
  color: white;
  margin-bottom: 1rem;
  letter-spacing: 1px;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.hero-subtitle {
  font-size: 1.25rem;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 3rem;
  font-weight: 300;
  line-height: 1.6;
}

.hero-features {
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-wrap: wrap;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  border-radius: 50px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-weight: 500;
  transition: all 0.3s ease;
}

.feature-item:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.feature-item i {
  font-size: 1.25rem;
}

/* ============================================
   RIGHT SIDE: LOGIN FORM
   ============================================ */
.split-form {
  flex: 1;
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(135deg, var(--bg-1), var(--bg-2));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  position: relative;
  overflow-y: auto;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.split-form.slide-in-right {
  opacity: 1;
  transform: translateX(0);
}

/* Subtle gradient overlay */
.split-form::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 80% 20%,
    rgba(59, 130, 246, 0.08),
    transparent 50%
  );
  pointer-events: none;
}

.form-container {
  width: 100%;
  max-width: 480px;
  position: relative;
  z-index: 2;
  animation: fadeInUp 1s ease 0.5s both;
  margin: auto 0;
}

/* Form Header */
.form-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.form-logo {
  width: min(100%, 220px);
  min-height: 70px;
  margin: 0 auto 1.5rem;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
  box-shadow: 0 10px 40px rgba(59, 130, 246, 0.3);
}

.form-logo.has-image {
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0.1) 30%, rgba(15, 23, 42, 0) 54%),
    linear-gradient(180deg, rgba(51, 65, 85, 0.92), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(16px);
  box-shadow:
    0 12px 32px rgba(37, 99, 235, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.form-logo-image {
  display: block;
  width: 100%;
  max-width: 180px;
  max-height: 52px;
  object-fit: contain;
  filter:
    drop-shadow(0 1px 1px rgba(255, 255, 255, 0.12))
    drop-shadow(0 6px 18px rgba(15, 23, 42, 0.22));
}

.form-logo.logo-bg-dark {
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.06) 26%, rgba(15, 23, 42, 0) 48%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.96));
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow:
    0 12px 32px rgba(15, 23, 42, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.form-logo.logo-bg-light {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(232, 238, 248, 0.92));
  border-color: rgba(255, 255, 255, 0.7);
  box-shadow:
    0 12px 32px rgba(37, 99, 235, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.form-logo.logo-bg-light .form-logo-image {
  filter: drop-shadow(0 1px 1px rgba(15, 23, 42, 0.12));
}

.form-logo i {
  font-size: 2rem;
  color: white;
}

.form-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.form-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
}

/* Alert */
.custom-alert {
  padding: 1rem 1.25rem;
  border-radius: 12px;
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.3);
  color: #fca5a5;
  margin-bottom: 1.5rem;
  animation: shake 0.5s ease;
}

/* Form */
.login-form {
  margin-bottom: 2rem;
}

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

.form-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
  font-weight: 500;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.form-label i {
  color: var(--accent-1);
  font-size: 1rem;
}

/* Modern Input */
.modern-input {
  width: 100%;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--text-main);
  font-size: 1rem;
  transition: all 0.3s ease;
}

.modern-input::placeholder {
  color: var(--text-muted);
}

.modern-input:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.modern-input:focus {
  outline: none;
  border-color: var(--accent-1);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
  transform: translateY(-2px);
  color: var(--text-muted);
}

/* Password Wrapper */
.password-wrapper {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  transition: color 0.3s ease;
}

.password-toggle:hover {
  color: var(--accent-1);
}

/* Login Button */
.btn-login {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  border: none;
  border-radius: 12px;
  color: white;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 10px 30px rgba(59, 130, 246, 0.3);
  position: relative;
  overflow: hidden;
}

.btn-login::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 40px rgba(59, 130, 246, 0.4);
}

.btn-login:hover::before {
  transform: translateX(100%);
}

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

/* Loading State */
.btn-login.loading .btn-text {
  opacity: 0;
}

.btn-loader {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn-login.loading .btn-loader {
  display: block;
}

/* Form Footer */
.form-footer {
  text-align: center;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.connection-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.connection-status-secure {
  color: #cbd5e1 !important;
}

.connection-status-warning {
  color: #fcd34d !important;
}

.text-muted {
  color: var(--text-muted);
  font-size: 0.9rem;
}

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

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

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

@keyframes patternMove {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 40px 40px;
  }
}

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

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 1200px) {
  .split-hero {
    flex: 1.4;
  }

  .hero-content {
    padding: 2.5rem;
    max-width: 520px;
  }

  .hero-title {
    font-size: clamp(2.2rem, 3vw, 2.75rem);
  }

  .hero-subtitle {
    margin-bottom: 2.25rem;
  }

  .feature-item {
    padding: 0.85rem 1.2rem;
  }
}

@media (max-width: 991px) {
  .split-screen-body,
  .split-container {
    min-height: auto;
  }

  .split-container {
    flex-direction: column;
  }

  .split-hero {
    min-height: clamp(240px, 34vh, 360px);
    transform: translateY(-100%);
  }

  .split-hero.slide-in-left {
    transform: translateY(0);
  }

  .split-form {
    min-height: auto;
    padding: 2rem 1.5rem 2.5rem;
    transform: translateY(100%);
  }

  .split-form.slide-in-right {
    transform: translateY(0);
  }

  .form-container {
    max-width: 560px;
    margin: 0 auto;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .hero-features {
    gap: 1rem;
  }

  .feature-item {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 767px) {
  .split-hero {
    min-height: auto;
    padding: 2.25rem 1.25rem;
  }

  .hero-content {
    padding: 0;
    max-width: 100%;
  }

  .hero-icon {
    width: 74px;
    height: 74px;
    margin-bottom: 1.25rem;
  }

  .hero-icon i {
    font-size: 2rem;
  }

  .hero-title {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
  }

  .hero-subtitle {
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
  }

  .hero-features {
    gap: 0.65rem;
  }

  .feature-item {
    padding: 0.65rem 0.9rem;
    border-radius: 999px;
    font-size: 0.82rem;
  }

  .feature-item span {
    white-space: nowrap;
  }

  .split-form {
    padding: 1.5rem 1rem 2rem;
  }

  .form-container {
    max-width: 100%;
    padding: 1.4rem;
    background: rgba(15, 23, 42, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 24px;
    backdrop-filter: blur(14px);
    box-shadow: 0 20px 60px rgba(2, 6, 23, 0.28);
  }

  .form-header {
    margin-bottom: 1.9rem;
  }

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

  .form-group {
    margin-bottom: 1.15rem;
  }

  .modern-input {
    padding: 0.95rem 1rem;
    font-size: 0.98rem;
  }

  .btn-login {
    padding: 0.95rem 1rem;
  }

  .form-footer {
    padding-top: 1.1rem;
  }
}

@media (max-width: 576px) {
  .split-hero {
    padding: 1.9rem 1rem 1.5rem;
  }

  .split-form {
    padding: 1rem 0.85rem 1.5rem;
  }

  .hero-content {
    padding: 0;
  }

  .hero-icon {
    width: 64px;
    height: 64px;
  }

  .hero-icon i {
    font-size: 2rem;
  }

  .hero-title {
    font-size: 1.5rem;
  }

  .hero-subtitle {
    font-size: 0.9rem;
    margin-bottom: 1.2rem;
  }

  .form-title {
    font-size: 1.5rem;
  }

  .form-subtitle {
    font-size: 0.95rem;
  }

  .form-container {
    padding: 1.15rem;
    border-radius: 20px;
  }

  .form-logo {
    width: min(100%, 180px);
    min-height: 60px;
    padding: 0.65rem 0.85rem;
  }

  .form-logo-image {
    max-width: 150px;
    max-height: 44px;
  }

  .form-logo i {
    font-size: 1.5rem;
  }

  .feature-item {
    width: calc(50% - 0.35rem);
    justify-content: center;
  }
}

@media (max-width: 420px) {
  .split-hero {
    padding-top: 1.5rem;
  }

  .hero-title {
    font-size: 1.45rem;
  }

  .hero-features {
    flex-direction: column;
    align-items: stretch;
  }

  .feature-item {
    width: 100%;
  }

  .form-container {
    padding: 1rem 0.95rem;
  }

  .form-title {
    font-size: 1.35rem;
  }

  .modern-input,
  .btn-login {
    border-radius: 10px;
  }
}

/* ============================================
   UTILITIES
   ============================================ */
.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
