/* ═══════════════════════════════════════════════
   Xloon Login — Design Tokens
═══════════════════════════════════════════════ */
:root {
  --xl-blue:        #1565C0;
  --xl-blue-dark:   #0D47A1;
  --xl-blue-light:  #1976D2;
  --xl-blue-hover:  #1248A0;
  --xl-blue-10:     #E3F2FD;
  --xl-text:        #1A1A2E;
  --xl-muted:       #5F6368;
  --xl-border:      #DADCE0;
  --xl-border-focus:#1565C0;
  --xl-error:       #D32F2F;
  --xl-error-bg:    #FFF0F0;
  --xl-success:     #2E7D32;
  --xl-white:       #FFFFFF;
  --xl-radius:      10px;
  --xl-radius-lg:   16px;
  --xl-shadow:      0 4px 24px rgba(21,101,192,0.10), 0 1px 4px rgba(0,0,0,0.06);
  --xl-font:        'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ─── Reset ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: var(--xl-font); }
body { background: #0A1628; }

/* ═══════════════════════════════════════════════
   SPLIT LAYOUT
═══════════════════════════════════════════════ */
.xl-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── Left brand panel ───────────────────────── */
.xl-brand {
  flex: 0 0 42%;
  background: linear-gradient(150deg, #0D47A1 0%, #1565C0 50%, #1976D2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  position: relative;
  overflow: hidden;
}
.xl-brand::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.xl-brand-inner { position: relative; z-index: 1; text-align: center; max-width: 340px; }

.xl-logo {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  margin-bottom: 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.24);
}
.xl-brand-name {
  font-size: 36px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}
.xl-brand-tag {
  font-size: 16px;
  font-weight: 500;
  color: rgba(255,255,255,0.80);
  margin-bottom: 24px;
}
.xl-brand-desc {
  font-size: 14px;
  color: rgba(255,255,255,0.65);
  line-height: 1.7;
  margin-bottom: 32px;
}
.xl-brand-features { text-align: left; display: inline-block; }
.xl-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: rgba(255,255,255,0.80);
  margin-bottom: 10px;
}
.xl-feature-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.55);
  flex-shrink: 0;
}

/* ─── Right form panel ───────────────────────── */
.xl-form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F4F6FB;
  padding: 40px 24px;
  overflow-y: auto;
}

/* ─── Login card ─────────────────────────────── */
.xl-card {
  background: var(--xl-white);
  border-radius: var(--xl-radius-lg);
  box-shadow: var(--xl-shadow);
  padding: 40px 40px 36px;
  width: 100%;
  max-width: 420px;
}
.xl-card-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--xl-text);
  margin-bottom: 4px;
}
.xl-card-sub {
  font-size: 14px;
  color: var(--xl-muted);
  margin-bottom: 24px;
}

/* ─── Error banner (Spring ?error=true) ───────── */
.xl-error-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--xl-error-bg);
  border: 1px solid #FFCDD2;
  border-left: 4px solid var(--xl-error);
  border-radius: var(--xl-radius);
  padding: 12px 14px;
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--xl-error);
  font-weight: 500;
}

.xl-info-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(21, 101, 192, 0.08);
  border: 1px solid #BBDEFB;
  border-left: 4px solid #1565C0;
  border-radius: var(--xl-radius);
  padding: 12px 14px;
  margin-bottom: 20px;
  font-size: 14px;
  color: #1565C0;
  font-weight: 500;
}

/* ─── OAuth button ───────────────────────────── */
.xl-oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  height: 46px;
  background: var(--xl-white);
  border: 1.5px solid var(--xl-border);
  border-radius: var(--xl-radius);
  text-decoration: none;
  color: var(--xl-text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .18s, box-shadow .18s;
  margin-bottom: 20px;
}
.xl-oauth-btn:hover {
  border-color: var(--xl-blue-light);
  box-shadow: 0 0 0 3px rgba(21,101,192,0.10);
  color: var(--xl-text);
  text-decoration: none;
}
.xl-oauth-icon { width: 22px; height: 22px; object-fit: contain; }
.xl-recommended { font-size: 11px; color: var(--xl-muted); font-style: normal; }
.xl-oauth-btn--facebook {
  background: #1877F2;
  border-color: #1877F2;
  color: #fff;
  margin-bottom: 10px;
}
.xl-oauth-btn--facebook:hover {
  background: #1464d8;
  border-color: #1464d8;
  color: #fff;
  box-shadow: 0 0 0 3px rgba(24,119,242,0.20);
}
.xl-oauth-btn--github {
  background: #24292e;
  border-color: #24292e;
  color: #fff;
  margin-bottom: 0;
}
.xl-oauth-btn--github:hover {
  background: #1a1e22;
  border-color: #1a1e22;
  color: #fff;
  box-shadow: 0 0 0 3px rgba(36,41,46,0.22);
}

/* ─── Divider ────────────────────────────────── */
.xl-divider {
  position: relative;
  text-align: center;
  margin: 4px 0 20px;
}
.xl-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  height: 1px;
  background: var(--xl-border);
}
.xl-divider span {
  position: relative;
  background: var(--xl-white);
  padding: 0 12px;
  font-size: 12px;
  color: var(--xl-muted);
  font-weight: 500;
}

/* ─── Form fields ────────────────────────────── */
.xl-field { margin-bottom: 16px; }
.xl-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--xl-text);
  margin-bottom: 6px;
}
.xl-hint { font-weight: 400; color: var(--xl-muted); }
.xl-input {
  width: 100%;
  height: 44px;
  border: 1.5px solid var(--xl-border);
  border-radius: var(--xl-radius);
  padding: 0 14px;
  font-size: 14px;
  color: var(--xl-text);
  background: var(--xl-white);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
  display: block;
}
.xl-input:focus {
  border-color: var(--xl-border-focus);
  box-shadow: 0 0 0 3px rgba(21,101,192,0.12);
}
.xl-input.xl-invalid {
  border-color: var(--xl-error);
  box-shadow: 0 0 0 3px rgba(211,47,47,0.10);
}
.xl-input::placeholder { color: #A8B0BC; }
.xl-field-err {
  display: block;
  font-size: 12px;
  color: var(--xl-error);
  margin-top: 4px;
  min-height: 16px;
  font-weight: 500;
}

/* ─── Password toggle ────────────────────────── */
.xl-pw-wrap { position: relative; }
.xl-pw-wrap .xl-input { padding-right: 42px; }
.xl-pw-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--xl-muted);
  padding: 4px;
  line-height: 1;
}
.xl-pw-toggle:hover { color: var(--xl-blue); }

/* ─── Forgot / terms row ─────────────────────── */
.xl-form-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.xl-forgot {
  font-size: 13px;
  color: var(--xl-blue-light);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.xl-forgot:hover { text-decoration: underline; }
.xl-terms-inline { font-size: 12px; color: var(--xl-muted); }
.xl-terms-inline a { color: var(--xl-muted); }

/* ─── Submit button ──────────────────────────── */
.xl-submit {
  width: 100%;
  height: 46px;
  background: var(--xl-blue);
  color: var(--xl-white);
  border: none;
  border-radius: var(--xl-radius);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: background .18s, transform .10s, box-shadow .18s;
  margin-bottom: 16px;
}
.xl-submit:hover {
  background: var(--xl-blue-hover);
  box-shadow: 0 4px 16px rgba(21,101,192,0.30);
}
.xl-submit:active { transform: scale(0.98); }
.xl-submit-sm { width: auto; min-width: 100px; }

/* ─── Signup link ────────────────────────────── */
.xl-signup-row {
  font-size: 13px;
  color: var(--xl-muted);
  text-align: center;
  margin-bottom: 0;
}
.xl-link {
  color: var(--xl-blue-light);
  font-weight: 600;
  cursor: pointer;
}
.xl-link:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════
   MODALS
═══════════════════════════════════════════════ */
.xl-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 40, 0.60);
  backdrop-filter: blur(2px);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.xl-modal {
  background: var(--xl-white);
  border-radius: var(--xl-radius-lg);
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  padding: 36px 36px 32px;
  width: 100%;
  max-width: 400px;
  position: relative;
}
.xl-modal-lg { max-width: 460px; }
.xl-modal-close {
  position: absolute;
  top: 14px; right: 18px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--xl-muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}
.xl-modal-close:hover { color: var(--xl-text); }
.xl-modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--xl-text);
  margin-bottom: 6px;
}
.xl-modal-desc {
  font-size: 14px;
  color: var(--xl-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ─── Success modal ──────────────────────────── */
.xl-modal-success { text-align: center; }
.xl-success-icon { margin-bottom: 16px; }
.xl-success-icon svg { display: block; margin: 0 auto; }

/* ─── Info / Alert modals ────────────────────── */
.xl-modal-alert { text-align: center; }
.xl-info-icon  { margin-bottom: 12px; }
.xl-alert-icon { margin-bottom: 12px; }
.xl-alert-text {
  font-size: 14px;
  color: var(--xl-text);
  margin-bottom: 20px;
  line-height: 1.55;
}

/* ─── CAPTCHA ─────────────────────────────────── */
.xl-captcha-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.xl-captcha-canvas {
  font-family: 'Nanum', monospace;
  font-size: 28px;
  font-weight: 700;
  color: var(--xl-text);
  letter-spacing: 4px;
  padding: 6px 12px;
  background: #F4F6FB;
  border-radius: 8px;
  border: 1px solid var(--xl-border);
  min-width: 130px;
}
.xl-icon-btn {
  background: none;
  border: 1px solid var(--xl-border);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}
.xl-redo-icon { width: 22px; height: 22px; }

/* ─── PIN row ─────────────────────────────────── */
.xl-pin-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.xl-pin-input { flex: 1; letter-spacing: 4px; font-weight: 700; }

/* ═══════════════════════════════════════════════
   RESPONSIVE — Tablet (≤ 1024px)
═══════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .xl-brand { flex: 0 0 38%; padding: 36px 28px; }
  .xl-card  { padding: 32px 28px; }
}

/* ═══════════════════════════════════════════════
   RESPONSIVE — Mobile (≤ 768px)
═══════════════════════════════════════════════ */
@media (max-width: 768px) {
  body { background: #0D47A1; }
  .xl-layout { flex-direction: column; min-height: 100vh; }

  .xl-brand {
    flex: none;
    padding: 36px 24px 28px;
    background: none;
  }
  .xl-brand::after { display: none; }
  .xl-brand-inner { max-width: 100%; }
  .xl-logo        { width: 60px; height: 60px; border-radius: 14px; }
  .xl-brand-name  { font-size: 26px; }
  .xl-brand-tag   { font-size: 14px; margin-bottom: 0; }
  .xl-brand-desc, .xl-brand-features { display: none; }

  .xl-form-panel {
    flex: 1;
    padding: 0;
    background: transparent;
    align-items: flex-start;
  }
  .xl-card {
    border-radius: 24px 24px 0 0;
    max-width: 100%;
    width: 100%;
    min-height: calc(100vh - 180px);
    padding: 32px 24px 40px;
    box-shadow: 0 -4px 32px rgba(0,0,0,0.15);
  }

  .xl-modal { padding: 28px 20px; }
  .xl-pin-row { flex-direction: column; }
  .xl-submit-sm { width: 100%; }
}

/* ═══════════════════════════════════════════════
   RESPONSIVE — iPad landscape
═══════════════════════════════════════════════ */
@media only screen
  and (min-device-width: 768px)
  and (max-device-width: 1024px)
  and (orientation: landscape) {
  .xl-brand { flex: 0 0 40%; }
  .xl-card  { padding: 28px 28px; }
  .xl-modal { max-width: 80vw; }
  .xl-modal-lg { max-width: 80vw; }
}

/* ═══════════════════════════════════════════════
   LEGACY CLASS SHIM — keeps login.js working
   (displayAlertMessage uses #commonAlertModal)
═══════════════════════════════════════════════ */
.modal { display: none; }
