@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&family=Inter:wght@400;500;600&display=swap');

/* ==========================================================
   TOKENS — matches the site's brand palette (blue/indigo on
   a light background), same as the dashboard/product pages.
   ========================================================== */
:root {
    --brand-900: #1E2A78;
    --brand-700: #2C3EA6;
    --brand-600: #3B55D9;
    /* primary brand blue, same as dashboard */
    --brand-400: #6C7FEA;
    /* secondary brand blue, same as dashboard */
    --brand-gradient: linear-gradient(135deg, #3B55D9, #6C7FEA, #3B55D9);

    --bg-page: #fdfdfd;
    --bg-page-tint: #eef1fd;

    --ink-900: #1b2144;
    --ink-500: #6b7280;
    --ink-300: #9aa2b1;

    --card-bg: #ffffff;
    --card-line: rgba(59, 85, 217, 0.14);

    --field-fill: rgba(59, 85, 217, 0.045);
    --field-fill-strong: rgba(59, 85, 217, 0.09);
    --field-line: rgba(59, 85, 217, 0.18);
    --field-line-strong: rgba(59, 85, 217, 0.4);

    --radius-lg: 24px;
    --radius-md: 16px;
}

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

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: radial-gradient(ellipse at 50% -10%, var(--bg-page-tint) 0%, var(--bg-page) 55%);
    min-height: 100vh;
    color: var(--ink-900);
    overflow-x: hidden;
    position: relative;
}

/* soft ambient brand glow blobs, matching the dashboard's blue accent */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(560px circle at 14% 18%, rgba(59, 85, 217, 0.10), transparent 62%),
        radial-gradient(480px circle at 86% 78%, rgba(108, 127, 234, 0.10), transparent 62%),
        radial-gradient(420px circle at 50% 105%, rgba(59, 85, 217, 0.06), transparent 60%);
}

/* Container card sizing safety, keeps things tidy on mobile */
.card,
.auth-card,
.register-card {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

/* Captcha helper text wrapping on small screens */
.captcha-text,
.captcha-reload,
.captcha-container span,
.captcha-container a {
    display: block;
    width: 100%;
    text-align: center;
    font-size: 0.85rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    margin-top: 5px;
}

.captcha-container img,
.captcha-img {
    max-width: 100%;
    height: auto;
}

/* ===== MAIN CONTAINER ===== */
.main-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1.5rem 1rem;
    position: relative;
    z-index: 1;
}

/* ===== LOGO ===== */
.logo-container {
    margin-bottom: 1.25rem;
    position: relative;
    text-align: center;
}

.logo-container::before {
    content: '';
    position: absolute;
    inset: -22px;
    background: radial-gradient(circle, rgba(59, 85, 217, .25), transparent 70%);
    filter: blur(22px);
    z-index: -1;
}

@media (prefers-reduced-motion: no-preference) {
    .logo-container::before {
        animation: pulseGlow 3.6s ease-in-out infinite;
    }
}

@keyframes pulseGlow {
    0%, 100% {
        opacity: .5;
        transform: scale(.94);
    }
    50% {
        opacity: .95;
        transform: scale(1.06);
    }
}

/* Gambar Logo Diperjelas */
.logo-container img {
    max-width: 200px;
    height: auto;
    filter: drop-shadow(0 4px 12px rgba(30, 42, 120, 0.35)) contrast(1.1);
}

/* ===== CARD ===== */
.bg-glass {
    background: var(--card-bg);
    border: 1px solid var(--card-line);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px !important;
    margin: auto;
    box-shadow:
        0 8px 32px rgba(30, 42, 120, 0.10),
        0 0 0 1px rgba(255, 255, 255, 0.6) inset;
    position: relative;
    isolation: isolate;
    z-index: 1;
    overflow: hidden; /* Memastikan garis atas terpotong rapi sesuai border-radius */
}

/* Garis Biru Atas Card dibuat FULL lebar */
.bg-glass::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: 24px 24px 0 0;
    background: var(--brand-gradient);
    opacity: 1;
}

/* ===== HEADER ===== */
.header-container {
    margin-bottom: 1.75rem;
    text-align: center;
}

.header-text {
    font-family: 'Poppins', sans-serif;
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-sub {
    display: block;
    margin-top: .4rem;
    font-family: 'Inter', sans-serif;
    font-size: .8rem;
    font-weight: 400;
    color: var(--ink-500);
}

/* ===== FORM ===== */
.form-container {
    margin-bottom: .5rem;
}

/* floating-label field */
.field-group {
    position: relative;
    display: flex;
    align-items: center;
    border-radius: var(--radius-md);
    background: var(--field-fill);
    border: 1px solid var(--field-line);
    margin-bottom: 1.1rem;
    transition: border-color .25s, box-shadow .25s, background .25s;
}

.field-group:focus-within {
    border-color: var(--brand-600);
    background: var(--field-fill-strong);
    box-shadow: 0 0 0 3px rgba(59, 85, 217, .12), 0 8px 20px rgba(30, 42, 120, .08);
}

.field-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    flex-shrink: 0;
    color: var(--brand-400);
    font-size: 1.05rem;
    transition: color .25s, transform .25s;
}

.field-group:focus-within .field-icon {
    color: var(--brand-600);
    transform: scale(1.12);
}

.field-input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none !important;
    box-shadow: none !important;
    color: var(--ink-900) !important;
    font-family: 'Inter', sans-serif;
    font-size: .92rem;
    padding: 1.35rem .75rem .55rem 0;
}

.field-input:read-only {
    opacity: .65;
    cursor: not-allowed;
}

.field-label {
    position: absolute;
    left: 46px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-500);
    font-size: .85rem;
    pointer-events: none;
    transition: all .2s ease;
}

.field-input:focus~.field-label,
.field-input:not(:placeholder-shown)~.field-label {
    top: 9px;
    font-size: .64rem;
    letter-spacing: .03em;
    color: var(--brand-600);
    transform: none;
}

.field-toggle {
    background: transparent;
    border: none;
    color: var(--ink-300);
    font-size: 1.05rem;
    cursor: pointer;
    padding: 0 .9rem;
    display: flex;
    align-items: center;
    transition: color .2s;
}

.field-toggle:hover {
    color: var(--brand-600);
}

/* ===== CAPTCHA ===== */
.captcha-shell {
    cursor: pointer;
    border-radius: var(--radius-md);
    border: 1px dashed var(--field-line-strong);
    background: rgba(59, 85, 217, .03);
    padding: .75rem 0.85rem;
    margin-bottom: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    transition: border-color .25s, background .25s, transform .15s;
    user-select: none;
    flex-wrap: nowrap;
}

.captcha-shell:hover {
    border-color: var(--brand-600);
    background: var(--field-fill);
}

.captcha-shell:active {
    transform: scale(.98);
}

.captcha-tiles {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}

.captcha-tiles span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 30px;
    background: linear-gradient(160deg, rgba(59, 85, 217, .10), rgba(59, 85, 217, .03));
    border: 1px solid var(--field-line);
    border-radius: 6px;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: .95rem;
    color: var(--brand-600);
}

.captcha-tiles span:nth-child(odd) {
    transform: rotate(-4deg);
}

.captcha-tiles span:nth-child(even) {
    transform: rotate(3deg);
}

.captcha-refresh {
    display: flex;
    align-items: center;
    gap: .3rem;
    font-size: .72rem;
    color: var(--ink-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.captcha-refresh i {
    color: var(--brand-600);
    transition: transform .4s ease;
    flex-shrink: 0;
}

.captcha-shell:hover .captcha-refresh i {
    transform: rotate(180deg);
}

/* ===== BUTTONS ===== */
.button-container {
    gap: .75rem;
    margin-bottom: 1.25rem;
    margin-top: .25rem;
}

.primary-button,
.primary-button:hover,
.primary-button:focus {
    position: relative;
    overflow: hidden;
    border: none !important;
    border-radius: var(--radius-md) !important;
    padding: .95rem 1.5rem !important;
    font-family: 'Poppins', sans-serif;
    font-weight: 700 !important;
    font-size: .95rem !important;
    letter-spacing: .01em;
    color: #ffffff !important;
    background: var(--brand-gradient) !important;
    box-shadow:
        0 10px 24px rgba(59, 85, 217, .32),
        inset 0 1px 0 rgba(255, 255, 255, .2);
    cursor: pointer;
    transition: transform .25s, box-shadow .25s, filter .25s;
    width: 100%;
}

.primary-button::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .25), transparent);
    transform: translateX(-120%);
    transition: transform .6s ease;
}

.primary-button:hover::before {
    transform: translateX(120%);
}

.primary-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(59, 85, 217, .4), inset 0 1px 0 rgba(255, 255, 255, .25);
}

.primary-button:active {
    transform: translateY(0);
    filter: brightness(.96);
}

.primary-button:disabled {
    opacity: .65;
    cursor: not-allowed;
    transform: none;
}

.spin {
    display: inline-block;
    animation: spin .8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== FOOTER TEXT / LINKS ===== */
.register-text {
    color: var(--ink-500);
    font-size: .85rem;
    text-align: center;
    margin-top: .25rem;
}

.register-text a {
    color: var(--brand-600) !important;
    text-decoration: none !important;
    font-weight: 600;
    position: relative;
}

.register-text a::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 1px;
    background: var(--brand-600);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform .25s;
}

.register-text a:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

.register-text a:hover {
    color: var(--brand-900) !important;
}

/* ===== ALERT ===== */
.alert-danger {
    background: rgba(220, 53, 69, 0.08) !important;
    border: 1px solid rgba(220, 53, 69, 0.25) !important;
    color: #c0293b !important;
    border-radius: 12px !important;
    margin-bottom: 1rem;
}

/* ===== SWEETALERT2 ===== */
.swal2-glass-modal,
.swal2-mobile-captcha {
    background: #ffffff !important;
    border: 1px solid var(--card-line) !important;
    border-radius: 20px !important;
    color: var(--ink-900) !important;
    box-shadow: 0 20px 50px rgba(30, 42, 120, 0.18) !important;
}

.swal2-glass-modal .swal2-title,
.swal2-mobile-captcha .swal2-title {
    color: var(--brand-700) !important;
    font-family: 'Poppins', sans-serif !important;
}

.swal2-glass-modal .swal2-html-container {
    color: var(--ink-500) !important;
}

.swal2-glass-modal .swal2-confirm,
.swal2-mobile-captcha .swal2-confirm {
    background: var(--brand-gradient) !important;
    color: #ffffff !important;
    border-radius: 10px !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 15px rgba(59, 85, 217, 0.35) !important;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: var(--bg-page-tint);
}

::-webkit-scrollbar-thumb {
    background: var(--brand-400);
    border-radius: 4px;
}

/* ===== ACCESSIBILITY ===== */
.field-input:focus-visible,
.primary-button:focus-visible,
.captcha-shell:focus-visible,
.field-toggle:focus-visible,
.register-text a:focus-visible {
    outline: 2px solid var(--brand-600);
    outline-offset: 2px;
}

/* ===== RESPONSIVE & MOBILE OPTIMIZATION ===== */
@media (max-width: 480px) {
    .main-container {
        padding: 1rem 0.75rem;
    }

    .bg-glass {
        padding: 1.75rem 1.25rem;
        border-radius: 20px;
        max-width: 100% !important;
    }

    .header-text {
        font-size: 1.4rem;
    }

    .logo-container img {
        max-width: 160px;
    }

    /* Penyesuaian Captcha di Mobile agar Teks Tidak Keluar Batas */
    .captcha-shell {
        padding: .65rem .6rem;
        gap: .35rem;
    }

    .captcha-tiles span {
        width: 20px;
        height: 26px;
        font-size: .85rem;
    }

    .captcha-refresh {
        font-size: .68rem;
    }
}