/* ============================================================
   ExtraordinaryCBT - Fancy Student Login
   Scoped hanya ke halaman login (yang memiliki .auth-form)
   ============================================================ */

/* ---------- Keyframes ---------- */
@keyframes exo-bg-shift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes exo-float-blob {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%      { transform: translate(30px, -40px) scale(1.1); }
    66%      { transform: translate(-25px, 25px) scale(0.95); }
}
@keyframes exo-fade-up {
    from { opacity: 0; transform: translateY(28px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes exo-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes exo-pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0.55), 0 10px 30px -8px rgba(59,130,246,0.45); }
    50%      { box-shadow: 0 0 0 8px rgba(255,255,255,0),  0 14px 40px -6px rgba(59,130,246,0.6); }
}
@keyframes exo-shine {
    0%   { transform: translateX(-120%) skewX(-20deg); }
    60%  { transform: translateX(220%)  skewX(-20deg); }
    100% { transform: translateX(220%)  skewX(-20deg); }
}
@keyframes exo-gradient-rotate {
    0%   { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}
@keyframes exo-logo-float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50%      { transform: translateY(-4px) rotate(-2deg); }
}

/* ---------- 1. Latar belakang animated mesh gradient ---------- */
body.c-app:has(.auth-form) {
    background: linear-gradient(125deg, #1e3a8a, #2563eb, #3b82f6, #6366f1, #8b5cf6, #2563eb, #1e3a8a);
    background-size: 400% 400%;
    animation: exo-bg-shift 18s ease infinite;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* ---------- 2. Floating decorative blobs ---------- */
body.c-app:has(.auth-form)::before,
body.c-app:has(.auth-form)::after {
    content: "";
    position: fixed;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.55;
    pointer-events: none;
    z-index: 0;
}
body.c-app:has(.auth-form)::before {
    width: 420px; height: 420px;
    top: -120px; left: -120px;
    background: radial-gradient(circle, #60a5fa, transparent 70%);
    animation: exo-float-blob 14s ease-in-out infinite;
}
body.c-app:has(.auth-form)::after {
    width: 480px; height: 480px;
    bottom: -160px; right: -140px;
    background: radial-gradient(circle, #c084fc, transparent 70%);
    animation: exo-float-blob 17s ease-in-out infinite reverse;
}

/* ---------- 3. Wrapper utama di atas background ---------- */
body.c-app:has(.auth-form) .wrapper {
    position: relative;
    z-index: 1;
    animation: exo-fade-in 0.5s ease;
}

/* ---------- 4. Header banner (gradient) ---------- */
body.c-app:has(.auth-form) .bg-gradient-to-r.from-blue-500.to-blue-400 {
    background: linear-gradient(135deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04)) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(255,255,255,0.18);
    padding-top: 28px !important;
    padding-bottom: 96px !important;
    box-shadow: 0 10px 40px -10px rgba(0,0,0,0.35);
    animation: exo-fade-up 0.6s ease both;
}

/* Logo container */
body.c-app:has(.auth-form) .h-16.w-16.bg-white {
    background: linear-gradient(135deg, #ffffff, #e0e7ff) !important;
    box-shadow: 0 8px 24px -4px rgba(0,0,0,0.4), 0 0 0 4px rgba(255,255,255,0.15) !important;
    animation: exo-logo-float 4s ease-in-out infinite, exo-pulse-glow 3.5s ease-in-out infinite;
}
body.c-app:has(.auth-form) .h-16.w-16.bg-white img {
    border-radius: 8px;
}

/* Nama sekolah */
body.c-app:has(.auth-form) .font-semibold,
body.c-app:has(.auth-form) .text-gray-100 {
    text-shadow: 0 2px 12px rgba(0,0,0,0.35) !important;
    letter-spacing: 0.3px;
}

/* ---------- 5. Card login (glassmorphism) ---------- */
body.c-app:has(.auth-form) .bg-white.border-gray-200.shadow.sm\:shadow-2xl {
    background: rgba(255, 255, 255, 0.92) !important;
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    border-radius: 22px !important;
    box-shadow:
        0 25px 60px -15px rgba(0, 0, 0, 0.45),
        0 10px 25px -5px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255,255,255,0.8) !important;
    overflow: hidden;
    animation: exo-fade-up 0.7s 0.1s ease both;
    position: relative;
}
/* Garis glow di tepi atas card */
body.c-app:has(.auth-form) .bg-white.border-gray-200.shadow.sm\:shadow-2xl::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899, #3b82f6);
    background-size: 200% 100%;
    animation: exo-gradient-rotate 4s linear infinite;
}

/* ---------- 6. Card header ("Login" title) ---------- */
body.c-app:has(.auth-form) .pt-2.pb-2.px-2.flex.justify-between.border-b.border-gray-300 {
    border-bottom-color: rgba(59, 130, 246, 0.15) !important;
    padding: 18px 22px !important;
    margin-bottom: 8px !important;
    background: linear-gradient(90deg, rgba(59,130,246,0.06), transparent);
}
body.c-app:has(.auth-form) .font-medium.text-gray-700.text-lg {
    font-size: 1.45rem !important;
    font-weight: 700 !important;
    background: linear-gradient(90deg, #2563eb, #7c3aed);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.5px;
    padding: 0 !important;
}

/* ---------- 7. Form area ---------- */
body.c-app:has(.auth-form) .py-2.px-2.my-2 {
    padding: 20px 26px 26px !important;
}

/* Label field */
body.c-app:has(.auth-form) .text-xs.font-semibold.text-gray-500 {
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600 !important;
    color: #6b7280 !important;
    margin-bottom: 2px;
    display: inline-block;
}

/* Wrapper icon kiri */
body.c-app:has(.auth-form) .absolute.inset-y-0.left-0.w-10 {
    background: linear-gradient(135deg, #dbeafe, #c7d2fe) !important;
    border-right: 1px solid rgba(59,130,246,0.12);
    transition: background 0.3s ease;
    border-radius: 10px 0 0 10px;
}
body.c-app:has(.auth-form) .relative:focus-within .absolute.inset-y-0.left-0.w-10 {
    background: linear-gradient(135deg, #3b82f6, #6366f1) !important;
}
body.c-app:has(.auth-form) .relative:focus-within .absolute.inset-y-0.left-0.w-10 svg {
    color: #ffffff !important;
    stroke: #ffffff !important;
}

/* ---------- 8. Input fields ---------- */
body.c-app:has(.auth-form) .auth-form input[type="text"],
body.c-app:has(.auth-form) .auth-form input[type="password"],
body.c-app:has(.auth-form) .auth-form input:not([type]) {
    border: 2px solid #e5e7eb !important;
    border-radius: 12px !important;
    padding: 14px 14px 14px 48px !important;
    font-size: 15px !important;
    background: #f9fafb !important;
    transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.04);
    height: 52px;
}
body.c-app:has(.auth-form) .auth-form input[type="text"]:hover,
body.c-app:has(.auth-form) .auth-form input[type="password"]:hover,
body.c-app:has(.auth-form) .auth-form input:not([type]):hover {
    border-color: #93c5fd !important;
    background: #ffffff !important;
}
body.c-app:has(.auth-form) .auth-form input[type="text"]:focus,
body.c-app:has(.auth-form) .auth-form input[type="password"]:focus,
body.c-app:has(.auth-form) .auth-form input:not([type]):focus {
    border-color: #6366f1 !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15), 0 4px 16px -4px rgba(59,130,246,0.35) !important;
    outline: none !important;
    transform: translateY(-1px);
}

/* Tombol mata (show/hide password) */
body.c-app:has(.auth-form) .absolute.inset-y-0.right-0 {
    transition: color 0.25s ease, transform 0.25s ease;
    border-radius: 0 10px 10px 0;
}
body.c-app:has(.auth-form) .absolute.inset-y-0.right-0:hover {
    transform: scale(1.15);
    color: #6366f1 !important;
}
body.c-app:has(.auth-form) .absolute.inset-y-0.right-0:hover svg {
    color: #6366f1 !important;
    stroke: #6366f1 !important;
}

/* ---------- 9. Tombol submit (gradient + shine) ---------- */
body.c-app:has(.auth-form) .auth-form button[type="submit"],
body.c-app:has(.auth-form) .auth-form button:not([type]) {
    background: linear-gradient(90deg, #2563eb, #6366f1, #8b5cf6, #6366f1, #2563eb) !important;
    background-size: 200% 100% !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    font-size: 16px !important;
    letter-spacing: 0.5px;
    padding: 14px 20px !important;
    border-radius: 12px !important;
    width: 100%;
    height: 52px;
    border: none !important;
    box-shadow: 0 10px 25px -6px rgba(79, 70, 229, 0.55), inset 0 1px 0 rgba(255,255,255,0.25) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    animation: exo-gradient-rotate 5s linear infinite;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
}
/* Efek kilau (shine) */
body.c-app:has(.auth-form) .auth-form button[type="submit"]::before,
body.c-app:has(.auth-form) .auth-form button:not([type])::before {
    content: "";
    position: absolute;
    top: 0; left: 0;
    width: 40%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    animation: exo-shine 3.5s ease-in-out infinite;
}
body.c-app:has(.auth-form) .auth-form button[type="submit"]:hover,
body.c-app:has(.auth-form) .auth-form button:not([type]):hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 16px 32px -8px rgba(79, 70, 229, 0.65), inset 0 1px 0 rgba(255,255,255,0.3) !important;
}
body.c-app:has(.auth-form) .auth-form button[type="submit"]:active,
body.c-app:has(.auth-form) .auth-form button:not([type]):active {
    transform: translateY(0) scale(0.98) !important;
}
/* State loading */
body.c-app:has(.auth-form) .auth-form button[type="submit"][disabled],
body.c-app:has(.auth-form) .auth-form button:not([type])[disabled] {
    opacity: 0.75;
    cursor: wait;
}

/* ---------- 10. Pesan error ---------- */
body.c-app:has(.auth-form) .text-red-600.py-2.px-4.bg-red-100 {
    border-radius: 12px !important;
    border: 1px solid #fca5a5 !important;
    background: linear-gradient(135deg, #fef2f2, #fee2e2) !important;
    color: #b91c1c !important;
    font-weight: 500;
    animation: exo-fade-up 0.35s ease;
    box-shadow: 0 4px 12px -4px rgba(239,68,68,0.35) !important;
}
/* Error teks kecil di bawah input */
body.c-app:has(.auth-form) .auth-form .text-xs.text-red-600 {
    font-weight: 500;
    margin-top: 4px;
    display: block;
}

/* ---------- 11. Container utama (card column) ---------- */
body.c-app:has(.auth-form) .container.md\:mx-auto {
    position: relative;
    z-index: 2;
}
body.c-app:has(.auth-form) .w-full.lg\:max-w-lg {
    animation: exo-fade-up 0.7s 0.15s ease both;
}

/* ---------- 12. Footer page ---------- */
body.c-app:has(.auth-form) .fixed.bottom-0.left-0.w-full {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255,255,255,0.3) !important;
    color: #4b5563 !important;
    z-index: 10;
}
body.c-app:has(.auth-form) .fixed.bottom-0.left-0.w-full .text-sm {
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* ---------- 13. Card footer (border-t dalam card) ---------- */
body.c-app:has(.auth-form) .py-2.px-2.flex.justify-between.border-t.border-gray-200 {
    border-top-color: rgba(59,130,246,0.1) !important;
}

/* ---------- 14. Responsive tweaks ---------- */
@media (max-width: 640px) {
    body.c-app:has(.auth-form) .bg-gradient-to-r.from-blue-500.to-blue-400 {
        padding-bottom: 80px !important;
    }
    body.c-app:has(.auth-form) .container.md\:mx-auto {
        margin-top: -56px !important;
    }
    body.c-app:has(.auth-form) .py-2.px-2.my-2 {
        padding: 16px 18px 20px !important;
    }
    body.c-app:has(.auth-form) .font-medium.text-gray-700.text-lg {
        font-size: 1.25rem !important;
    }
}

/* ---------- 15. Fallback bila :has() tidak didukung ---------- */
@supports not (selector(:has(*))) {
    /* Jika browser lama, terapkan minimal: background gradient saja */
    form.auth-form ~ *,
    form.auth-form {
        position: relative;
        z-index: 1;
    }
}
