/* login-enhance.css — D Care login redesign v2 (ดีไซน์ตาม design-system/d-care-clinic/MASTER.md)
   แพทเทิร์นเดียวกับ home-enhance.css: ไฟล์แยก ไม่แตะ markup เดิม กันโดนทับตอน mirror FTP
   ถ้าย้อนกลับ: ลบ <link login-enhance.css> + <script login-enhance.js> ออกจาก login.php */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:wght@500;600;700&family=Prompt:wght@300;400;500;600&display=swap');

:root {
  --dcl-primary: #EC4899;
  --dcl-accent: #8B5CF6;
  --dcl-bg: #FDF2F8;
  --dcl-fg: #831843;
  --dcl-border: #FBCFE8;
  --dcl-deep: #4A1042;
}

/* ===== พื้นหลังหน้า ===== */
body.login-enhanced {
  background:
    radial-gradient(1100px 600px at 85% -10%, rgba(139, 92, 246, 0.14), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(236, 72, 153, 0.16), transparent 60%),
    var(--dcl-bg);
  font-family: 'Prompt', 'Inter', sans-serif;
  min-height: 100vh;
}

body.login-enhanced .authentication-wrapper.authentication-cover {
  min-height: 100vh;
  align-items: stretch;
}

body.login-enhanced .authentication-cover .row.m-0 {
  width: 100%;
  min-height: 100vh;
  align-items: stretch;
}

/* โลโก้มุมบน — ให้ตัดกับแผงเข้มด้านซ้าย */
body.login-enhanced .auth-cover-brand,
body.login-enhanced .auth-cover-brand .app-brand-text {
  color: #fff !important;
  z-index: 5;
}

/* ===== ฝั่งซ้าย: แผงแบรนด์แทนภาพ 3D เดิม ===== */
body.login-enhanced .auth-cover-illustration,
body.login-enhanced .authentication-image {
  display: none !important;
}

.dcl-brand {
  position: absolute;
  inset: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #BE3455 0%, var(--dcl-primary) 45%, var(--dcl-accent) 100%);
}

/* grain พรีเมียมบาง ๆ ทับแผง */
.dcl-brand::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='120' height='120' filter='url(%23n)' opacity='0.5'/></svg>");
  opacity: 0.045;
  pointer-events: none;
  z-index: 1;
}

/* aurora — แสงไหลเอียงช้า ๆ */
.dcl-aurora {
  position: absolute;
  inset: -25%;
  pointer-events: none;
  filter: blur(70px);
  z-index: 0;
}
.dcl-aurora span {
  position: absolute;
  border-radius: 50%;
  mix-blend-mode: screen;
  animation: dclAurora 20s ease-in-out infinite alternate;
}
.dcl-aurora .a1 { width: 55%; height: 55%; top: 5%; left: 5%;  background: radial-gradient(circle, rgba(249,168,212,0.8), transparent 70%); }
.dcl-aurora .a2 { width: 50%; height: 50%; bottom: 0;  right: 0;  background: radial-gradient(circle, rgba(196,181,253,0.85), transparent 70%); animation-delay: -7s; }
.dcl-aurora .a3 { width: 40%; height: 40%; top: 30%; left: 35%; background: radial-gradient(circle, rgba(255,228,189,0.5), transparent 70%); animation-delay: -13s; animation-duration: 26s; }

@keyframes dclAurora {
  from { transform: translate(0, 0) rotate(0deg) scale(1); }
  to   { transform: translate(6%, -5%) rotate(35deg) scale(1.18); }
}

/* วงแหวนโคจรรอบศูนย์กลาง */
.dcl-orbit {
  position: absolute;
  top: 50%; left: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  z-index: 0;
  animation: dclSpinSlow 36s linear infinite;
}
.dcl-orbit.o1 { width: 480px;  height: 480px;  margin: -240px 0 0 -240px; }
.dcl-orbit.o2 { width: 660px;  height: 660px;  margin: -330px 0 0 -330px; border-style: dashed; border-color: rgba(255,255,255,0.12); animation-duration: 55s; animation-direction: reverse; }
.dcl-orbit .dot {
  position: absolute;
  top: -4px; left: 50%;
  width: 8px; height: 8px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 14px 2px rgba(255, 255, 255, 0.8);
}
@keyframes dclSpinSlow { to { transform: rotate(360deg); } }

/* วงแสงลอยเบลอ ๆ (layer แรกของ parallax) */
.dcl-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.35;
  pointer-events: none;
  will-change: transform;
  z-index: 0;
}
.dcl-blob-1 { width: 420px; height: 420px; background: #F9A8D4; top: -80px; left: -60px; }
.dcl-blob-2 { width: 360px; height: 360px; background: #C4B5FD; bottom: -100px; right: -40px; }

/* อนุภาคลอย ✦ ♥ ❀ */
.dcl-shape {
  position: absolute;
  color: rgba(255, 255, 255, 0.5);
  pointer-events: none;
  animation: dclFloat 11s ease-in-out infinite;
  will-change: transform;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.35);
  z-index: 1;
}
.dcl-shape:nth-child(odd)  { animation-duration: 14s; animation-delay: -4s; }
.dcl-shape:nth-child(3n)   { animation-duration: 9s;  animation-delay: -7s; }

@keyframes dclFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-26px) rotate(8deg); }
}

.dcl-brand-inner {
  position: relative;
  z-index: 2;
  text-align: center;
  color: #fff;
  max-width: 480px;
  padding: 2rem;
  animation: dclFadeUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.dcl-brand-inner .dcl-logo {
  width: 84px;
  height: 84px;
  object-fit: contain;
  margin-bottom: 1.25rem;
  animation: dclGlow 4.5s ease-in-out infinite;
}

@keyframes dclGlow {
  0%, 100% { filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.25)); }
  50%      { filter: drop-shadow(0 10px 36px rgba(255, 255, 255, 0.5)); }
}

.dcl-brand-inner h1 {
  font-family: 'Playfair Display', 'Prompt', serif;
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.5rem;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

/* เส้นสายรุ้งใต้ headline */
.dcl-brand-inner h1::after {
  content: '';
  display: block;
  width: 72px;
  height: 3px;
  margin: 0.9rem auto 0;
  border-radius: 99px;
  background: linear-gradient(90deg, #F9A8D4, #fff, #C4B5FD);
  background-size: 200% 100%;
  animation: dclShimmerLine 3s linear infinite;
}
@keyframes dclShimmerLine { to { background-position: 200% 0; } }

.dcl-brand-inner p.dcl-tagline {
  font-size: 1.05rem;
  font-weight: 300;
  opacity: 0.92;
  margin-bottom: 2rem;
}

.dcl-chips {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.dcl-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 0.875rem;
  font-weight: 400;
  color: #fff;
  transition: transform 0.25s ease, background 0.25s ease;
  animation: dclPop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both 0.5s;
}
.dcl-chip:nth-child(2) { animation-delay: 0.65s; }
.dcl-chip:nth-child(3) { animation-delay: 0.8s; }
.dcl-chip:hover { transform: translateY(-3px); background: rgba(255, 255, 255, 0.22); }
.dcl-chip i { font-size: 1.05rem; }

@keyframes dclPop {
  from { opacity: 0; transform: scale(0.6); }
  to   { opacity: 1; transform: scale(1); }
}

/* ===== ฝั่งขวา: การ์ด glassmorphism ===== */
/* คอลัมน์ซ้ายยืดเต็ม การ์ดขวากว้างคงที่ — กัน Bootstrap wrap เพราะ margin เกิน 100% */
body.login-enhanced .authentication-cover .row.m-0 { flex-wrap: nowrap; }
body.login-enhanced .authentication-cover .row.m-0 > .col-lg-7 {
  flex: 1 1 0;
  width: auto;
  max-width: none;
}
body.login-enhanced .authentication-bg {
  flex: 0 0 clamp(420px, 36%, 560px);
  width: auto;
  max-width: none;
  align-self: center;
  align-items: center;
  background: rgba(255, 255, 255, 0.72) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 28px !important;
  box-shadow:
    0 24px 60px -18px rgba(131, 24, 67, 0.25),
    0 4px 16px rgba(236, 72, 153, 0.08);
  margin: 2rem 2rem 2rem 0 !important;
  padding-left: 3rem !important;
  padding-right: 3rem !important;
  animation: dclCardIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: 0.1s;
}

/* เลิกล็อก 400px ให้ยืดตามการ์ด */
body.login-enhanced .w-px-400 {
  width: 100% !important;
  max-width: 400px;
}

@keyframes dclCardIn {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* โลโก้ badge หัวการ์ด */
.dcl-badge {
  display: flex;
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 10px 30px -10px rgba(236, 72, 153, 0.45), 0 0 0 6px rgba(236, 72, 153, 0.08);
  align-items: center;
  justify-content: center;
  animation: dclPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both 0.2s;
}
.dcl-badge img { width: 40px; height: 40px; object-fit: contain; }

/* หัวการ์ด */
body.login-enhanced .w-px-400 h4 {
  font-family: 'Playfair Display', 'Prompt', serif;
  font-size: 1.55rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--dcl-fg);
}

body.login-enhanced .w-px-400 > p.mb-5 {
  color: #9D6B82;
  font-size: 0.925rem;
}

/* ไล่ระดับ entrance ทีละบล็อก */
body.login-enhanced .w-px-400 > * {
  animation: dclFadeUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}
body.login-enhanced .w-px-400 > *:nth-child(1) { animation-delay: 0.25s; }
body.login-enhanced .w-px-400 > *:nth-child(2) { animation-delay: 0.32s; }
body.login-enhanced .w-px-400 > *:nth-child(3) { animation-delay: 0.39s; }
body.login-enhanced .w-px-400 > *:nth-child(4) { animation-delay: 0.46s; }
body.login-enhanced .w-px-400 > *:nth-child(5) { animation-delay: 0.53s; }
body.login-enhanced .w-px-400 > *:nth-child(6) { animation-delay: 0.60s; }
body.login-enhanced .w-px-400 > *:nth-child(7) { animation-delay: 0.67s; }

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

/* ===== ฟอร์ม ===== */
body.login-enhanced .form-floating-outline { position: relative; }

/* ไอคอนหน้า input */
.dcl-ico {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #C48AA6;
  z-index: 6;
  pointer-events: none;
  font-size: 1.1rem;
  transition: color 0.25s ease;
}
body.login-enhanced .form-floating-outline .form-control { padding-left: 46px; }
body.login-enhanced .form-floating-outline > label { padding-left: 46px; }
body.login-enhanced .form-floating-outline:focus-within .dcl-ico { color: var(--dcl-primary); }

body.login-enhanced .form-control {
  border-radius: 14px;
  border-color: var(--dcl-border);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
body.login-enhanced .form-control:focus {
  border-color: var(--dcl-primary);
  box-shadow: 0 0 0 4px rgba(236, 72, 153, 0.14);
}
body.login-enhanced .form-floating > label { color: #B08A9B; }
body.login-enhanced .form-floating.form-floating-outline > label::after { background-color: transparent !important; }
body.login-enhanced .input-group-text {
  background: transparent;
  border-color: var(--dcl-border);
  border-radius: 0 14px 14px 0;
  color: #C48AA6;
}
body.login-enhanced .input-group:focus-within .input-group-text {
  border-color: var(--dcl-primary);
  color: var(--dcl-primary);
}

/* เตือน Caps Lock */
.dcl-caps {
  display: none;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  color: #B45309;
  animation: dclFadeUp 0.25s ease both;
}
.dcl-caps.dcl-on { display: flex; }

/* ===== ปุ่ม Sign in ===== */
body.login-enhanced .btn-primary {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--dcl-primary) 0%, var(--dcl-accent) 100%);
  border: none;
  border-radius: 14px;
  padding: 0.7rem 1rem;
  font-weight: 500;
  font-family: 'Prompt', sans-serif;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 24px -8px rgba(236, 72, 153, 0.55);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
/* แสงกวาดผ่านปุ่มตอน hover */
body.login-enhanced .btn-primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -80%;
  width: 50%;
  height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: skewX(-20deg);
  transition: left 0.6s ease;
}
body.login-enhanced .btn-primary:hover::after { left: 130%; }

body.login-enhanced .btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px -8px rgba(236, 72, 153, 0.65);
  filter: brightness(1.05);
}
body.login-enhanced .btn-primary:active:not(:disabled) { transform: translateY(0) scale(0.98); }
body.login-enhanced .btn-primary:disabled {
  opacity: 0.75;
  transform: none;
  box-shadow: none;
}
body.login-enhanced .btn-primary:disabled::after { display: none; }

.dcl-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: dclSpin 0.7s linear infinite;
  vertical-align: -0.125em;
  margin-right: 0.5rem;
}
@keyframes dclSpin { to { transform: rotate(360deg); } }

/* ปุ่ม LINE */
body.login-enhanced .btn-success {
  border-radius: 14px;
  padding: 0.65rem 1rem;
  font-family: 'Prompt', sans-serif;
  background: #06C755;
  border-color: #06C755;
  transition: transform 0.2s ease, filter 0.2s ease;
}
body.login-enhanced .btn-success:hover { transform: translateY(-2px); filter: brightness(1.06); background: #06C755; border-color: #06C755; }

body.login-enhanced .divider-text {
  font-family: 'Prompt', sans-serif;
  color: #C48AA6;
  font-size: 0.85rem;
}

/* เส้น divider ไล่เฉียง */
body.login-enhanced .divider::before,
body.login-enhanced .divider::after {
  background: linear-gradient(90deg, transparent, var(--dcl-border)) !important;
}
body.login-enhanced .divider::after {
  background: linear-gradient(90deg, var(--dcl-border), transparent) !important;
}

.dcl-foot {
  text-align: center;
  font-size: 0.78rem;
  color: #C4A0B2;
  margin-top: 1.5rem;
  font-family: 'Prompt', sans-serif;
}

/* ===== จอเล็ก ===== */
@media (max-width: 991.98px) {
  body.login-enhanced .authentication-cover .row.m-0 { flex-wrap: wrap; }
  body.login-enhanced .authentication-bg {
    flex: 1 1 100%;
    margin: 1rem !important;
    padding: 2rem 1.25rem !important;
    border-radius: 22px !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(255, 255, 255, 0.92) !important;
  }
  body.login-enhanced .auth-cover-brand,
  body.login-enhanced .auth-cover-brand .app-brand-text { color: var(--dcl-fg) !important; }
}

/* เคารพ reduced motion */
@media (prefers-reduced-motion: reduce) {
  body.login-enhanced *,
  .dcl-shape,
  .dcl-blob,
  .dcl-aurora span,
  .dcl-orbit,
  .dcl-brand-inner .dcl-logo {
    animation: none !important;
    transition: none !important;
  }
}
