/**
 * Adam Cottons — Login
 * Pure Cotton Warmth. Family clothes brand.
 * Based on Adam Cottons design & Agon reference.
 */

@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Outfit:wght@500;600;700&display=swap");

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

:root {
  /* Baby blue palette — rgb(41, 110, 158) */
  --ac-bg: #f5f8fa;
  --ac-bg-warm: #eef4f9;
  --ac-card: #ffffff;
  --ac-brand: #296e9e;
  --ac-brand-light: #3a8bc4;
  --ac-brand-dark: #1e5278;
  --ac-accent: #2c5282;
  --ac-accent-light: #5ba3d9;
  --ac-cream: #f8fafc;
  --ac-text: #1a1a1a;
  --ac-text-soft: #4a4a4a;
  --ac-muted: #6b7280;
  --ac-border: rgba(41, 110, 158, 0.15);
  --ac-glow: rgba(41, 110, 158, 0.2);
  --ac-shadow: rgba(41, 110, 158, 0.1);
  --ac-error: #c45c5c;
  /* Dark brand side for blue logo */
  --ac-dark-bg: #1a2d42;
  --ac-dark-bg-deep: #132336;
  --ac-dark-text: rgba(255, 255, 255, 0.95);
  --ac-dark-muted: rgba(255, 255, 255, 0.7);
}

@keyframes ac-fade-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ac-card-in {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes ac-shine {
  0% { left: -100%; }
  100% { left: 100%; }
}

@keyframes ac-float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(0, -10px); }
}

@keyframes ac-float-slow {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(4px, -6px) rotate(1deg); }
  66% { transform: translate(-3px, 4px) rotate(-0.5deg); }
}

@keyframes ac-glow-pulse {
  0%, 100% { box-shadow: 0 32px 80px rgba(0,0,0,0.06), 0 0 0 1px var(--ac-border); }
  50% { box-shadow: 0 40px 100px rgba(41, 110, 158, 0.15), 0 0 0 1px var(--ac-border); }
}

@keyframes ac-orb-float {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.5; }
  25% { transform: translate(3%, -4%) scale(1.05); opacity: 0.65; }
  50% { transform: translate(-2%, 2%) scale(0.95); opacity: 0.55; }
  75% { transform: translate(2%, 3%) scale(1.02); opacity: 0.6; }
}

@keyframes ac-bg-drift {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.92; }
}

@keyframes ac-cotton-float {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.6; }
  50% { transform: translateY(-15px) rotate(2deg); opacity: 0.8; }
}

/* Base */
body.ac-auth {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background:
    linear-gradient(145deg, #eef4f9 0%, #e8f1f8 25%, #f0f6fb 50%, #e5eef6 75%, #f5f9fc 100%);
}

body.ac-auth::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 100% 80% at 0% 0%, rgba(191, 35, 39, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse 80% 100% at 100% 0%, rgba(66, 153, 225, 0.05) 0%, transparent 48%),
    radial-gradient(ellipse 90% 70% at 100% 100%, rgba(191, 35, 39, 0.04) 0%, transparent 45%),
    radial-gradient(ellipse 70% 90% at 0% 100%, rgba(66, 153, 225, 0.05) 0%, transparent 45%),
    radial-gradient(ellipse 60% 60% at 50% 50%, rgba(255, 252, 248, 0.9) 0%, transparent 70%);
  pointer-events: none;
  animation: ac-bg-drift 12s ease-in-out infinite;
}

/* Fabric-like grain + cotton texture */
.ac-grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at center, rgba(41, 110, 158, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.9;
}

.ac-grain::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* Soft orbs — Adam Cottons warm ambient */
.ac-bg-orbs {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.ac-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  animation: ac-orb-float 20s ease-in-out infinite;
}

.ac-orb:nth-child(1) {
  width: 320px; height: 320px;
  top: -8%; left: -5%;
  background: radial-gradient(circle, rgba(41, 110, 158, 0.12) 0%, rgba(41, 110, 158, 0.03) 50%, transparent 70%);
  animation-duration: 22s; animation-delay: 0s;
}

.ac-orb:nth-child(2) {
  width: 280px; height: 280px;
  top: 40%; right: -6%;
  background: radial-gradient(circle, rgba(91, 163, 217, 0.1) 0%, rgba(91, 163, 217, 0.02) 50%, transparent 70%);
  animation-duration: 18s; animation-delay: 3s;
}

.ac-orb:nth-child(3) {
  width: 240px; height: 240px;
  bottom: -5%; left: 25%;
  background: radial-gradient(circle, rgba(41, 110, 158, 0.08) 0%, transparent 60%);
  animation-duration: 25s; animation-delay: 6s;
}

.ac-orb:nth-child(4) {
  width: 200px; height: 200px;
  top: 60%; left: -4%;
  background: radial-gradient(circle, rgba(91, 163, 217, 0.07) 0%, transparent 60%);
  animation-duration: 20s; animation-delay: 2s;
}

.ac-orb:nth-child(5) {
  width: 260px; height: 260px;
  top: 15%; right: 20%;
  background: radial-gradient(circle, rgba(41, 110, 158, 0.06) 0%, transparent 55%);
  animation-duration: 24s; animation-delay: 4s;
}

/* Floating shapes — minimal lines */
.ac-shapes {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.ac-shape {
  position: absolute;
  border: 1px solid rgba(41, 110, 158, 0.12);
  border-radius: 2px;
  opacity: 0.45;
  animation: ac-float 14s ease-in-out infinite;
}

.ac-shape:nth-child(1) { width: 140px; height: 1px; top: 15%; left: 6%; animation-delay: 0s; animation-duration: 12s; }
.ac-shape:nth-child(2) { width: 90px; height: 1px; top: 78%; right: 10%; animation-delay: 2.5s; animation-duration: 16s; }
.ac-shape:nth-child(3) { width: 70px; height: 1px; bottom: 22%; left: 12%; animation-delay: 5s; animation: ac-float-slow 18s ease-in-out infinite; }
.ac-shape:nth-child(4) { width: 110px; height: 1px; top: 38%; right: 18%; animation-delay: 1s; animation-duration: 13s; }
.ac-shape:nth-child(5) { width: 1px; height: 90px; top: 58%; left: 4%; animation-delay: 3s; animation-duration: 15s; }
.ac-shape:nth-child(6) { width: 1px; height: 70px; top: 18%; right: 6%; animation-delay: 4s; animation: ac-float-slow 14s ease-in-out infinite; }

/* Main card */
.ac-login-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1000px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--ac-card);
  border-radius: 28px;
  overflow: hidden;
  min-height: 580px;
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.06),
    0 0 0 1px var(--ac-border);
  animation: ac-card-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards, ac-glow-pulse 8s ease-in-out 1s infinite;
}

/* Left: Brand — dark for blue logo */
.ac-brand-side {
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(165deg, var(--ac-dark-bg) 0%, var(--ac-dark-bg-deep) 50%, #152a42 100%);
}

.ac-brand-side::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(41, 110, 158, 0.25) 0%, transparent 50%),
    radial-gradient(ellipse 60% 80% at 80% 80%, rgba(91, 163, 217, 0.12) 0%, transparent 50%),
    linear-gradient(105deg, transparent 0%, rgba(255, 255, 255, 0.03) 50%, transparent 100%);
  background-size: 100% 100%, 100% 100%, 200% 100%;
  z-index: 0;
}

.ac-brand-side::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: repeating-linear-gradient(
    105deg,
    transparent,
    transparent 2px,
    rgba(255, 255, 255, 0.02) 2px,
    rgba(255, 255, 255, 0.02) 3px
  );
  z-index: 0;
  pointer-events: none;
}

.ac-brand-content {
  position: relative;
  z-index: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ac-brand-content .logo-link {
  display: inline-block;
  margin-bottom: 0;
  animation: ac-fade-up 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.ac-brand-content .logo-link:hover {
  transform: scale(1.03);
  filter: drop-shadow(0 4px 20px var(--ac-shadow));
}

.ac-brand-content .logo-link img {
  max-width: 200px;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 4px 24px rgba(0, 0, 0, 0.3));
}

/* Cotton visual element — light on dark */
.ac-brand-visual {
  width: 100%;
  max-width: 240px;
  margin-top: 32px;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  animation: ac-cotton-float 8s ease-in-out infinite;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.06) 50%, rgba(255, 255, 255, 0.1) 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ac-brand-visual svg {
  width: 50%;
  height: 50%;
  opacity: 0.4;
  color: rgba(255, 255, 255, 0.85);
}

.ac-brand-tagline {
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  color: var(--ac-dark-muted);
  margin-top: 28px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  animation: ac-fade-up 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both;
}

.ac-brand-subtitle {
  font-size: 14px;
  color: var(--ac-dark-muted);
  margin-top: 8px;
  font-weight: 500;
  animation: ac-fade-up 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both;
}

.ac-brand-side .ac-corner {
  position: absolute;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-right: 2px solid rgba(255, 255, 255, 0.2);
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 0 0 12px 0;
  opacity: 0.7;
}

/* Right: Form */
.ac-form-side {
  padding: 48px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    linear-gradient(180deg, #ffffff 0%, #fefdfb 40%, #faf9f7 100%);
  border-left: 1px solid var(--ac-border);
  position: relative;
}

.ac-form-side::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse 80% 60% at 100% 0%, rgba(248, 252, 255, 0.95) 0%, transparent 55%),
    radial-gradient(ellipse 50% 80% at 0% 100%, rgba(41, 110, 158, 0.04) 0%, transparent 50%);
  pointer-events: none;
}

.ac-form-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
}

.ac-form-header {
  margin-bottom: 36px;
}

.ac-form-title {
  font-family: 'Outfit', sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--ac-text);
  margin-bottom: 10px;
  letter-spacing: -0.03em;
  line-height: 1.2;
  animation: ac-fade-up 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.ac-form-subtitle {
  font-size: 15px;
  color: var(--ac-muted);
  font-weight: 500;
  letter-spacing: 0.01em;
  animation: ac-fade-up 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.06s both;
}

/* Input groups */
.ac-input-group {
  margin-bottom: 22px;
  animation: ac-fade-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.ac-form-inner form .ac-input-group:nth-of-type(2) { animation-delay: 0.1s; }
.ac-form-inner form .ac-input-group:nth-of-type(3) { animation-delay: 0.16s; }

.ac-input-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--ac-text-soft);
  margin-bottom: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: 'DM Sans', sans-serif;
}

.ac-input-wrap {
  position: relative;
  border-radius: 16px;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease, border-color 0.25s ease;
}

.ac-input-wrap:focus-within {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px var(--ac-shadow), 0 0 0 1px var(--ac-border);
}

.ac-input-wrap .icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ac-muted);
  font-size: 20px;
  pointer-events: none;
  transition: color 0.25s ease, transform 0.25s ease;
}

.ac-input-wrap:focus-within .icon {
  color: var(--ac-brand);
  transform: translateY(-50%) scale(1.05);
}

.ac-input-wrap input {
  width: 100%;
  padding: 16px 18px 16px 50px;
  background: var(--ac-cream);
  border: 2px solid var(--ac-border);
  border-radius: 16px;
  color: var(--ac-text);
  font-size: 15px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
  outline: none;
}

.ac-input-wrap input::placeholder {
  color: var(--ac-muted);
  font-weight: 400;
}

.ac-input-wrap input:focus {
  border-color: var(--ac-brand);
  background: #fff;
  box-shadow: 0 0 0 4px var(--ac-glow);
}

.ac-input-wrap input.is-invalid {
  border-color: var(--ac-error);
}

.ac-toggle-password {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ac-muted);
  cursor: pointer;
  font-size: 18px;
  transition: color 0.2s ease;
}

.ac-toggle-password:hover {
  color: var(--ac-brand);
}

.ac-input-wrap.has-toggle input {
  padding-right: 48px;
}

.ac-invalid-feedback {
  color: var(--ac-error);
  font-size: 12px;
  margin-top: 8px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
}

/* Remember me */
.ac-remember {
  margin-bottom: 26px;
  animation: ac-fade-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.28s both;
}

.ac-remember label {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--ac-text-soft);
  cursor: pointer;
  user-select: none;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  transition: color 0.2s ease;
}

.ac-remember label:hover {
  color: var(--ac-text);
}

.ac-remember input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--ac-brand);
  cursor: pointer;
  border-radius: 5px;
}

/* Submit button */
.ac-submit {
  width: 100%;
  padding: 18px 24px;
  background: var(--ac-brand);
  color: #fff;
  border: none;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease, background 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(41, 110, 158, 0.4);
  animation: ac-fade-up 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.32s both;
}

.ac-submit::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  animation: ac-shine 4s ease-in-out infinite;
  pointer-events: none;
}

.ac-submit:hover {
  background: var(--ac-brand-light);
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 16px 40px rgba(41, 110, 158, 0.45);
}

.ac-submit:hover::before {
  animation: ac-shine 1.2s ease-in-out;
}

.ac-submit:active {
  transform: translateY(-1px) scale(1);
}

/* Register link */
.ac-register-link {
  margin-top: 24px;
  text-align: center;
  font-size: 14px;
  color: var(--ac-muted);
  animation: ac-fade-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.35s both;
}

.ac-register-link a {
  color: var(--ac-brand);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}

.ac-register-link a:hover {
  color: var(--ac-brand-dark);
  text-decoration: underline;
}

/* Alert */
.ac-alert {
  padding: 14px 18px;
  border-radius: 14px;
  margin-bottom: 22px;
  font-size: 14px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  background: rgba(196, 92, 92, 0.08);
  border: 1px solid rgba(196, 92, 92, 0.2);
  color: var(--ac-error);
  animation: ac-fade-up 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Back to home */
.ac-back-home {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 2;
  color: var(--ac-muted);
  font-size: 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color 0.2s ease;
}

.ac-back-home:hover {
  color: var(--ac-brand);
}

/* Responsive */
@media (max-width: 900px) {
  .ac-login-wrap {
    grid-template-columns: 1fr;
    max-width: 440px;
    min-height: auto;
    border-radius: 20px;
  }

  .ac-brand-side {
    padding: 36px 28px;
    min-height: 200px;
  }

  .ac-brand-content .logo-link img {
    max-width: 140px;
  }

  .ac-brand-visual {
    max-width: 160px;
    margin-top: 20px;
  }

  .ac-brand-tagline {
    font-size: 12px;
    margin-top: 16px;
  }

  .ac-form-side {
    padding: 36px 28px;
    border-left: none;
    border-top: 1px solid var(--ac-border);
  }

  .ac-form-title {
    font-size: 24px;
  }

  .ac-brand-side .ac-corner {
    display: none;
  }
}

@media (max-width: 480px) {
  body.ac-auth {
    padding: 16px;
  }

  .ac-brand-visual {
    max-width: 120px;
  }

  .ac-form-title {
    font-size: 22px;
  }

  .ac-brand-side,
  .ac-form-side {
    padding: 28px 20px;
  }

  .ac-shape {
    opacity: 0.3;
  }

  .ac-brand-visual img {
        width: 40px;
        height: 40px;
        object-fit: contain;
    }

}
