/* ==========================================================================
   Modern Enterprise ERP Login Theme (SaaS Split-Screen Edition)
   Skins/Default/login-modern.css
   ========================================================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-active: #1e40af;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  
  --bg-page: #0b1120;
  --card-bg: #ffffff;
  
  --text-title: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;
  --ring-focus: rgba(59, 130, 246, 0.18);
  
  --radius-card: 20px;
  --radius-input: 10px;
  --radius-btn: 10px;
  
  --shadow-main: 0 25px 60px -15px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.08);
  --shadow-input: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-btn: 0 4px 14px rgba(37, 99, 235, 0.35);
  --shadow-btn-hover: 0 6px 20px rgba(37, 99, 235, 0.45);
}

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

body.modern-login-body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at 15% 20%, rgba(37, 99, 235, 0.15) 0%, transparent 45%),
              radial-gradient(circle at 85% 85%, rgba(99, 102, 241, 0.12) 0%, transparent 45%),
              var(--bg-page);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-body);
  position: relative;
  overflow-x: hidden;
  line-height: 1.5;
}

/* Background Subtle Grid Texture */
body.modern-login-body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

/* Main Split Wrapper */
.login-container {
  width: 100%;
  max-width: 1080px;
  min-height: 600px;
  margin: 24px;
  background: var(--card-bg);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-main);
  overflow: hidden;
  display: flex;
  position: relative;
  z-index: 10;
  animation: fadeInModal 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* -------------------------------------------------------------
   Left Column: Brand & Feature Showcase
   ------------------------------------------------------------- */
.login-brand-panel {
  flex: 1.05;
  background: linear-gradient(155deg, #0f172a 0%, #1e293b 55%, #0369a1 100%);
  color: #ffffff;
  padding: 48px 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

/* Ambient glow orb on left panel */
.login-brand-panel::after {
  content: "";
  position: absolute;
  bottom: -60px;
  right: -60px;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.22) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.brand-header {
  position: relative;
  z-index: 2;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  color: #7dd3fc;
  backdrop-filter: blur(4px);
  margin-bottom: 20px;
}

.brand-badge .dot {
  width: 6px;
  height: 6px;
  background: #38bdf8;
  border-radius: 50%;
  box-shadow: 0 0 8px #38bdf8;
}

.brand-logo-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.brand-logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #38bdf8 0%, #2563eb 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.35);
  flex-shrink: 0;
}

.brand-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #ffffff;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 14px;
  color: #94a3b8;
  line-height: 1.5;
  margin-top: 4px;
}

/* Feature Highlights */
.brand-features {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  z-index: 2;
  margin: 36px 0;
}

.feature-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  backdrop-filter: blur(8px);
  transition: all 0.25s ease;
}

.feature-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateX(4px);
}

.feature-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.feature-title {
  font-size: 14px;
  font-weight: 600;
  color: #f1f5f9;
  margin-bottom: 2px;
}

.feature-desc {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.4;
}

/* Brand Footer */
.brand-footer {
  font-size: 12px;
  color: #64748b;
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* -------------------------------------------------------------
   Right Column: Form Panel
   ------------------------------------------------------------- */
.login-form-panel {
  flex: 1.25;
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #ffffff;
}

.form-header {
  margin-bottom: 28px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.btn-toggle-company {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  margin-top: 4px;
}

.btn-toggle-company:hover {
  background: #eff6ff;
  border-color: var(--primary-border);
  color: var(--primary);
}

.btn-toggle-company.active {
  background: var(--primary-light);
  border-color: var(--border-focus);
  color: var(--primary);
}

.tenant-slug-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  flex-shrink: 0;
  margin-top: 4px;
}

.tenant-slug-badge .badge-dot {
  width: 7px;
  height: 7px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

.form-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-title);
  letter-spacing: -0.5px;
}

.form-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Inline Alert */
.login-alert {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: shakeAlert 0.3s ease;
}

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

/* Form Group Layout */
.form-group {
  margin-bottom: 18px;
  position: relative;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: color 0.2s;
  z-index: 2;
}

.form-control {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 42px;
  font-size: 14px;
  color: var(--text-title);
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-input);
  box-shadow: var(--shadow-input);
  outline: none;
  transition: all 0.2s ease;
}

.form-control:hover {
  border-color: #cbd5e1;
  background-color: #ffffff;
}

.form-control:focus {
  border-color: var(--border-focus);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px var(--ring-focus);
}

.input-wrapper:focus-within .input-icon {
  color: var(--primary);
}

/* Custom Select styling */
select.form-control {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px 16px;
  cursor: pointer;
  padding-right: 38px;
}

/* Password Eye Toggle */
.btn-toggle-pass {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.btn-toggle-pass:hover {
  color: var(--text-title);
}

/* Captcha Layout */
.captcha-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.captcha-input-wrap {
  flex: 1;
}

.captcha-img-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.captcha-img {
  height: 44px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-input);
  cursor: pointer;
  display: block;
  background: #f1f5f9;
  transition: opacity 0.2s;
}

.captcha-img:hover {
  opacity: 0.85;
}

.btn-refresh-captcha {
  background: none;
  border: 1px solid var(--border-color);
  background-color: #f8fafc;
  height: 44px;
  width: 44px;
  border-radius: var(--radius-input);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-refresh-captcha:hover {
  background-color: #f1f5f9;
  color: var(--primary);
  border-color: #cbd5e1;
}

.btn-refresh-captcha svg.spinning {
  animation: spinOnce 0.6s linear;
}

@keyframes spinOnce {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Remember me & Helper row */
.form-options-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px 0 24px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
  border-radius: 4px;
}

.key-hint {
  font-size: 12px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 4px;
}

.key-hint kbd {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  font-family: inherit;
  color: #475569;
  box-shadow: 0 1px 1px rgba(0,0,0,0.06);
}

/* Submit Button */
.btn-submit {
  width: 100%;
  height: 48px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-btn);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.btn-submit:hover {
  background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary-active) 100%);
  box-shadow: var(--shadow-btn-hover);
  transform: translateY(-1px);
}

.btn-submit:active {
  transform: translateY(1px);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-submit:disabled,
.btn-submit.loading {
  background: #94a3b8;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Spinner Icon */
.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}

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

/* Security Footer Notice */
.login-security-notice {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #f1f5f9;
  font-size: 12px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
}

/* -------------------------------------------------------------
   Responsive Breakpoints
   ------------------------------------------------------------- */
@media (max-width: 900px) {
  .login-container {
    flex-direction: column;
    max-width: 520px;
    min-height: auto;
  }
  
  .login-brand-panel {
    padding: 28px 24px;
  }
  
  .brand-features,
  .brand-footer {
    display: none;
  }
  
  .brand-logo-wrap {
    margin-bottom: 4px;
  }
  
  .brand-title {
    font-size: 20px;
  }
  
  .login-form-panel {
    padding: 32px 24px;
  }
  
  .form-title {
    font-size: 22px;
  }
}
