:root {
  --c1: #6d28d9;
  --c2: #db2777;
  --c3: #f97316;
  --c4: #0ea5e9;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --card: rgba(255, 255, 255, .92);
  --focus: rgba(109, 40, 217, .18);
  --radius: 22px;
  --font: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body.login-body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(125deg, #4c1d95, #be185d, #ea580c, #0369a1, #4c1d95);
  background-size: 400% 400%;
  animation: bgShift 22s ease infinite;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
@keyframes bgShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Floating colour blobs */
.login-blobs { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.login-blobs span {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55;
  animation: float 18s ease-in-out infinite;
}
.login-blobs span:nth-child(1) { width: 420px; height: 420px; background: #a855f7; top: -120px; left: -80px; }
.login-blobs span:nth-child(2) { width: 360px; height: 360px; background: #f472b6; bottom: -120px; right: 8%; animation-delay: -6s; }
.login-blobs span:nth-child(3) { width: 300px; height: 300px; background: #38bdf8; top: 30%; right: -80px; animation-delay: -11s; }
.login-blobs span:nth-child(4) { width: 260px; height: 260px; background: #fb923c; bottom: 10%; left: 25%; animation-delay: -3s; }
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, -30px) scale(1.08); }
  66% { transform: translate(-30px, 25px) scale(.95); }
}

/* Layout */
.login-shell {
  position: relative; z-index: 1;
  min-height: 100vh; width: 90%; margin: 0 auto;
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 40px; align-items: center;
  padding: 40px 0;
}

/* Showcase slider */
.showcase {
  position: relative; height: min(640px, calc(100vh - 80px)); min-height: 460px;
  border-radius: 28px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(17, 24, 39, .35);
  animation: rise .8s ease both;
}
.slides { position: absolute; inset: 0; }
.slide {
  position: absolute; inset: 0; margin: 0;
  opacity: 0; visibility: hidden; transition: opacity .9s ease, visibility .9s;
}
.slide.is-active { opacity: 1; visibility: visible; }
.slide img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transform: scale(1.12); transition: transform 7s ease-out;
}
.slide.is-active img { transform: scale(1); }
.slide::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 40%, rgba(17, 24, 39, .78) 100%);
}
.slide-caption {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 0 40px 70px; color: #fff;
  transform: translateY(24px); opacity: 0; transition: all .8s ease .35s;
}
.slide.is-active .slide-caption { transform: translateY(0); opacity: 1; }
/* Uploaded banners: box follows the image's shape, whole banner visible, no zoom crop */
.showcase.has-banners { height: auto; min-height: 0; aspect-ratio: var(--banner-ratio, 16 / 9); }
.showcase.has-banners .slide img { object-fit: contain; transform: none; transition: none; }
.showcase.has-banners .slide::after { background: linear-gradient(180deg, rgba(0, 0, 0, 0) 78%, rgba(17, 24, 39, .45) 100%); }
.showcase.has-banners .slider-nav { bottom: 18px; }
.slide-caption h2 { font-size: clamp(1.4rem, 2.6vw, 2.2rem); font-weight: 700; margin: 0 0 8px; line-height: 1.2; }
.slide-caption p { margin: 0; font-size: 1rem; opacity: .88; max-width: 520px; }

/* Built-in slides (shown when no banners uploaded) */
.slide-default { display: flex; flex-direction: column; justify-content: center; padding: 48px; color: #fff; }
.slide-default::after { display: none; }
.slide-default.g1 { background: linear-gradient(135deg, #7c3aed 0%, #db2777 100%); }
.slide-default.g2 { background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%); }
.slide-default.g3 { background: linear-gradient(135deg, #f97316 0%, #e11d48 100%); }
.slide-default .slide-caption { position: static; padding: 0; }
.slide-art {
  width: 120px; height: 120px; border-radius: 32px; margin-bottom: 32px;
  display: grid; place-items: center; background: rgba(255, 255, 255, .16);
  backdrop-filter: blur(6px); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3);
  animation: bob 4s ease-in-out infinite;
}
.slide-art svg { width: 60px; height: 60px; }
.slide-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.slide-chips span { padding: 8px 16px; border-radius: 999px; background: rgba(255, 255, 255, .16); font-size: .85rem; font-weight: 500; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.slider-nav { position: absolute; left: 40px; right: 40px; bottom: 26px; z-index: 3; display: flex; align-items: center; justify-content: space-between; }
.slider-dots { display: flex; gap: 8px; }
.slider-dots button {
  width: 10px; height: 10px; padding: 0; border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, .45); cursor: pointer; transition: all .3s ease;
}
.slider-dots button.is-active { width: 30px; background: #fff; }
.slider-arrows { display: flex; gap: 8px; }
.slider-arrows button {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .4);
  background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer; display: grid; place-items: center;
  backdrop-filter: blur(6px); transition: background .2s ease;
}
.slider-arrows button:hover { background: rgba(255, 255, 255, .28); }
.slider-arrows svg { width: 18px; height: 18px; }
.slider-progress { position: absolute; left: 0; top: 0; height: 3px; background: linear-gradient(90deg, #fde68a, #f472b6); z-index: 3; width: 0; }
.slider-progress.run { animation: progress linear forwards; }
@keyframes progress { from { width: 0; } to { width: 100%; } }

/* Login panel */
.login-panel {
  background: var(--card); backdrop-filter: blur(18px);
  border-radius: var(--radius); padding: 44px 42px;
  box-shadow: 0 30px 80px rgba(17, 24, 39, .3);
  max-width: 480px; width: 100%; justify-self: center;
  animation: rise .8s ease .15s both;
}
@keyframes rise { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }

.login-logo { display: inline-flex; margin-bottom: 26px; }
.login-logo img { height: 52px; width: auto; max-width: 220px; object-fit: contain; }
.login-logo .logo-text { font-weight: 700; font-size: 1.4rem; }
.login-panel h1 { font-size: 1.85rem; font-weight: 700; margin: 0 0 6px; }
.login-panel h1 .wave { display: inline-block; animation: wave 2.4s ease-in-out infinite; transform-origin: 70% 70%; }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20% { transform: rotate(-8deg); } 40% { transform: rotate(10deg); } }
.login-sub { color: var(--muted); margin: 0 0 30px; }
.gradient-text { background: linear-gradient(90deg, var(--c1), var(--c2), var(--c3)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.field { margin-bottom: 18px; }
.field-label { display: flex; justify-content: space-between; align-items: baseline; font-size: .88rem; font-weight: 600; margin-bottom: 8px; }
.field-label a { font-weight: 500; color: var(--c1); text-decoration: none; }
.field-label a:hover { text-decoration: underline; }
.input-wrap { position: relative; }
.input-wrap > svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: #9ca3af; transition: color .2s ease; pointer-events: none; }
.input-wrap input {
  width: 100%; height: 54px; padding: 0 52px 0 48px;
  font: inherit; font-size: 1rem; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 14px; background: #fff;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.input-wrap input::placeholder { color: #9ca3af; }
.input-wrap input:focus { outline: none; border-color: var(--c1); box-shadow: 0 0 0 4px var(--focus); }
.input-wrap:focus-within > svg { color: var(--c1); }
.input-username { text-transform: uppercase; }
.input-username::placeholder { text-transform: none; }
.toggle-pass {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border: 0; background: none; border-radius: 10px; color: #6b7280; cursor: pointer;
  display: grid; place-items: center;
}
.toggle-pass:hover { background: #f3f4f6; color: var(--ink); }
.toggle-pass svg { width: 20px; height: 20px; }
.caps-hint { display: none; margin-top: 8px; font-size: .8rem; color: #b45309; }
.caps-hint.show { display: block; }

.btn-login {
  position: relative; overflow: hidden;
  width: 100%; height: 56px; margin-top: 8px; border: 0; border-radius: 14px; cursor: pointer;
  font: inherit; font-size: 1.05rem; font-weight: 600; color: #fff;
  background: linear-gradient(90deg, var(--c1), var(--c2), var(--c3), var(--c2), var(--c1));
  background-size: 300% 100%; animation: btnFlow 8s linear infinite;
  box-shadow: 0 12px 30px rgba(219, 39, 119, .35);
  transition: transform .15s ease, box-shadow .2s ease;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 16px 36px rgba(219, 39, 119, .45); }
.btn-login:active { transform: translateY(0); }
.btn-login:focus-visible { outline: 3px solid #fde68a; outline-offset: 3px; }
.btn-login svg { width: 20px; height: 20px; transition: transform .2s ease; }
.btn-login:hover svg { transform: translateX(4px); }
.btn-login .spinner { display: none; width: 22px; height: 22px; border: 3px solid rgba(255, 255, 255, .4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.btn-login.is-loading .btn-text, .btn-login.is-loading svg { display: none; }
.btn-login.is-loading .spinner { display: block; }
@keyframes btnFlow { 0% { background-position: 0% 50%; } 100% { background-position: 300% 50%; } }
@keyframes spin { to { transform: rotate(360deg); } }

.divider { display: flex; align-items: center; gap: 14px; margin: 26px 0 18px; color: var(--muted); font-size: .85rem; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.btn-register {
  display: flex; align-items: center; justify-content: center; height: 52px; border-radius: 14px;
  border: 1.5px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; transition: all .2s ease;
}
.btn-register:hover { border-color: var(--c1); color: var(--c1); background: #faf5ff; }

.support { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; justify-content: center; }
.support a {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  font-size: .85rem; font-weight: 500; text-decoration: none; color: var(--ink); background: #f3f4f6; transition: background .2s ease;
}
.support a:hover { background: #e5e7eb; }
.support svg { width: 16px; height: 16px; }
.support .wa { color: #15803d; background: #dcfce7; }
.support .wa:hover { background: #bbf7d0; }
.support .mail { color: #6d28d9; background: #ede9fe; max-width: 100%; overflow-wrap: anywhere; }
.support .mail:hover { background: #ddd6fe; }

.login-foot { margin-top: 24px; text-align: center; font-size: .78rem; color: var(--muted); }
.login-foot a { color: var(--muted); }

/* Responsive */
@media (max-width: 991px) {
  .login-shell { grid-template-columns: 1fr; gap: 0; padding: 0 0 30px; width: 100%; }
  .showcase { height: 300px; min-height: 0; border-radius: 0 0 28px 28px; }
  .slide-caption { padding: 0 24px 76px; }
  .slide-caption p { font-size: .9rem; }
  .slide-default { padding: 24px 24px 76px; justify-content: flex-end; }
  .slide-art { width: 72px; height: 72px; border-radius: 20px; margin-bottom: 16px; }
  .slide-art svg { width: 36px; height: 36px; }
  .slide-chips { display: none; }
  .slider-nav { left: 24px; right: 24px; bottom: 50px; }
  .slider-arrows { display: none; }
  .login-panel { margin-top: -36px; width: calc(100% - 32px); padding: 32px 24px; position: relative; z-index: 2; }
  .showcase.has-banners { border-radius: 0 0 20px 20px; }
  .showcase.has-banners .slider-nav { bottom: 12px; }
  .showcase.has-banners + .login-panel { margin-top: 16px; }
}
@media (max-width: 420px) {
  .showcase { height: 240px; }
  .slide-caption h2 { font-size: 1.2rem; }
  .login-panel h1 { font-size: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .slide.is-active .slide-caption { opacity: 1; transform: none; }
}

/* SweetAlert above everything */
.swal-overlay { z-index: 10000; }
