/* ========================================
   Modern Enterprise Login - ElementStudio
   Split-layout with hero section + dark mode
   ======================================== */

:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --bg-dark: #0f172a;
  --surface: #1e293b;
  --surface-light: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #475569;
  --success: #22c55e;
  --radius: 12px;
}

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

html, body, #root {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  background: var(--bg-dark);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---- Split Layout Container ---- */
#root {
  display: flex !important;
  align-items: stretch !important;
  justify-content: stretch !important;
}

/* ---- Left: Hero / Feature Section ---- */
.hero-section {
  flex: 1 1 50%;
  background: linear-gradient(135deg, rgba(15,23,42,0.92), rgba(30,41,59,0.95)),
              url('https://images.unsplash.com/photo-1519389950473-47ba0277781c?w=1200&q=80') center/cover no-repeat;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem;
  position: relative;
  overflow: hidden;
}

.hero-section::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: linear-gradient(transparent, var(--bg-dark));
  pointer-events: none;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 3rem;
  position: relative;
  z-index: 1;
}

.hero-brand-icon {
  width: 40px;
  height: 40px;
  background: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-brand-icon svg {
  width: 22px;
  height: 22px;
  fill: white;
}

.hero-brand span {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.feature-carousel {
  position: relative;
  height: 200px;
  z-index: 1;
}

.feature-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
}

.feature-slide.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.feature-slide h2 {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 1rem;
  letter-spacing: -0.03em;
  color: #fff;
}

.feature-slide p {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 440px;
}

.carousel-dots {
  display: flex;
  gap: 8px;
  margin-top: 2rem;
  position: relative;
  z-index: 1;
}

.carousel-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  transition: all 0.3s;
  cursor: pointer;
}

.carousel-dots span.active {
  background: var(--primary);
  width: 24px;
  border-radius: 4px;
}

/* ---- Right: Login Panel ---- */
.login-panel {
  flex: 1 1 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  background: var(--bg-dark);
}

.login-card {
  width: 100%;
  max-width: 400px;
  animation: fadeInUp 0.4s ease-out;
}

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

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

.login-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.login-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ---- Form ---- */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.field-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.field-group input[type="text"],
.field-group input[type="password"],
.field-group input[type="email"] {
  width: 100%;
  padding: 14px 16px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.field-group input:hover {
  border-color: #64748b;
}

.field-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.25);
}

.field-group input::placeholder {
  color: #64748b;
}

/* ---- Submit Button ---- */
.login-form button[type="submit"],
.login-form button.btn-primary,
button[type="submit"] {
  width: 100%;
  padding: 14px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  margin-top: 0.5rem;
}

.login-form button[type="submit"]:hover,
button[type="submit"]:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.login-form button[type="submit"]:active,
button[type="submit"]:active {
  transform: translateY(0);
}

/* ---- Links / Secondary ---- */
.forgot-link,
.reset-link,
a[href*="reset"] {
  color: var(--primary) !important;
  font-size: 0.875rem;
  text-decoration: none;
  transition: color 0.2s;
}

.forgot-link:hover,
.reset-link:hover,
a[href*="reset"]:hover {
  color: #60a5fa !important;
  text-decoration: underline;
}

/* ---- Error/Alert Boxes ---- */
.alert-error,
div[role="alert"],
.error-message {
  background: rgba(239,68,68,0.12) !important;
  border: 1px solid rgba(239,68,68,0.3) !important;
  border-radius: var(--radius) !important;
  color: #fca5a5 !important;
  padding: 12px 16px !important;
  font-size: 0.875rem !important;
}

.alert-success,
.success-message {
  background: rgba(34,197,94,0.12) !important;
  border: 1px solid rgba(34,197,94,0.3) !important;
  border-radius: var(--radius) !important;
  color: #86efac !important;
  padding: 12px 16px !important;
  font-size: 0.875rem !important;
}

/* ---- MFA / TOTP Inputs ---- */
.otp-input,
input[maxlength="1"],
input[class*="totp"],
input[class*="otp"] {
  text-align: center !important;
  font-size: 1.5rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.5em !important;
  padding: 16px !important;
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  color: var(--text) !important;
  width: 100% !important;
}

/* ---- Checkbox / Remember Me ---- */
.remember-me,
div[class*="remember"],
label[class*="remember"] {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  color: var(--text-muted) !important;
  font-size: 0.875rem !important;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ---- Divider ---- */
.divider,
hr,
.separator {
  border: none !important;
  border-top: 1px solid var(--border) !important;
  margin: 1.5rem 0 !important;
}

/* ---- Powered by Authelia - Hide ---- */
footer,
[class*="footer" i],
[class*="powered" i],
[class*="branding" i] {
  display: none !important;
}

div:has(> a[href*="authelia"]),
span:has(> a[href*="authelia"]),
p:has(> a[href*="authelia"]),
small:has(> a[href*="authelia"]) {
  display: none !important;
}

/* ---- User Icon - Hide ---- */
svg.fa-user,
.fa-user,
[class*="avatar" i],
[class*="icon-user" i] {
  display: none !important;
}

/* ---- Theme Toggle - Hide (we use dark by default) ---- */
.theme-toggle,
[class*="theme-toggle" i],
[class*="ThemeToggle" i] {
  display: none !important;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .hero-section { display: none !important; }
  .login-panel { flex: 1 1 100%; padding: 2rem; }
  .login-card { max-width: 100%; }
}

@media (max-width: 480px) {
  .login-panel { padding: 1.5rem; }
  .login-header h1 { font-size: 1.5rem; }
}

/* ---- Dark Mode Support via Authelia data-theme ---- */
body[data-theme="light"] {
  --bg-dark: #f8fafc;
  --surface: #ffffff;
  --surface-light: #f1f5f9;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
}

body[data-theme="light"] .hero-section {
  background: linear-gradient(135deg, rgba(248,250,252,0.92), rgba(241,245,249,0.95)),
              url('https://images.unsplash.com/photo-1519389950473-47ba0277781c?w=1200&q=80') center/cover no-repeat;
}

body[data-theme="light"] .feature-slide h2 { color: #0f172a; }
body[data-theme="light"] .feature-slide p { color: #64748b; }
body[data-theme="light"] .hero-brand span { color: #0f172a; }
body[data-theme="light"] .carousel-dots span { background: rgba(0,0,0,0.15); }
body[data-theme="light"] .carousel-dots span.active { background: var(--primary); }
body[data-theme="light"] .login-header h1 { color: #0f172a; }
body[data-theme="light"] .login-header p { color: #64748b; }
body[data-theme="light"] .field-group input { background: #f8fafc; border-color: #e2e8f0; color: #0f172a; }
body[data-theme="light"] .field-group input::placeholder { color: #94a3b8; }
body[data-theme="light"] .otp-input,
body[data-theme="light"] input[maxlength="1"] { background: #f8fafc !important; border-color: #e2e8f0 !important; color: #0f172a !important; }
body[data-theme="light"] .alert-error { background: rgba(239,68,68,0.08) !important; color: #dc2626 !important; border-color: rgba(239,68,68,0.2) !important; }
body[data-theme="light"] .alert-success { background: rgba(34,197,94,0.08) !important; color: #16a34a !important; border-color: rgba(34,197,94,0.2) !important; }
body[data-theme="light"] ::-webkit-scrollbar-thumb { background: #cbd5e1; }
