/* ========================================= */
/* Tema ringkas untuk halaman login          */
/* ========================================= */

:root {
    --bg-body: radial-gradient(circle at 15% 20%, #0f172a, #020617 55%, #020617);
    --bg-card: rgba(15, 23, 42, 0.9);
    --bg-card-soft: rgba(15, 23, 42, 0.72);
    --bg-input: rgba(15, 23, 42, 0.95);
    --bg-input-alt: rgba(15, 23, 42, 0.88);

    --border-soft: rgba(148, 163, 184, 0.35);
    --border-strong: rgba(148, 163, 184, 0.65);

    --text-main: #e5e7eb;
    --text-soft: #94a3b8;
    --text-muted: #cbd5e1;
    --text-inverse: #0b1120;

    --accent: #4f46e5;
    --accent-2: #22c55e;
    --danger: #ef4444;

    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.35);
    --transition-fast: 0.16s ease-out;
}

:root[data-theme="light"] {
    --bg-body: linear-gradient(180deg, #f8fafc, #e2e8f0);
    --bg-card: #ffffff;
    --bg-card-soft: #f8fafc;
    --bg-input: #f8fafc;
    --bg-input-alt: #f1f5f9;

    --border-soft: #e2e8f0;
    --border-strong: #cbd5e1;

    --text-main: #0f172a;
    --text-soft: #475569;
    --text-muted: #64748b;
    --text-inverse: #ffffff;

    --shadow-soft: 0 14px 30px rgba(15, 23, 42, 0.1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

body {
    min-height: 100vh;
}

.icon { width:16px; height:16px; display:inline-block; stroke: currentColor; fill: none; }
.icon-lg { width:18px; height:18px; }
.icon-sprite { display:none; }

button,
input {
    font-family: inherit;
}

/* Custom scrollbar */
body,
.auth-forms-wrapper {
    scrollbar-width: thin;
    scrollbar-color: rgba(79, 70, 229, 0.6) transparent;
}

body::-webkit-scrollbar,
.auth-forms-wrapper::-webkit-scrollbar {
    width: 10px;
}

body::-webkit-scrollbar-track,
.auth-forms-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

body::-webkit-scrollbar-thumb,
.auth-forms-wrapper::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(79, 70, 229, 0.8), rgba(14, 165, 233, 0.8));
    border-radius: 999px;
    border: 2px solid rgba(0, 0, 0, 0);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

body::-webkit-scrollbar-thumb:hover,
.auth-forms-wrapper::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.9), rgba(59, 130, 246, 0.9));
}

/* ========================================= */
/* Shell                                     */
/* ========================================= */

.auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 18px 16px;
    gap: 14px;
}

.auth-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    background: var(--bg-card-soft);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(10px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at 30% 20%, #6366f1 0, #22c55e 70%, #0b1120 100%);
    box-shadow: 0 0 0 1px var(--border-soft), 0 10px 24px rgba(79, 70, 229, 0.35);
}

.brand-lock {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-title {
    font-weight: 600;
    font-size: 15px;
}

.brand-subtitle {
    font-size: 12px;
    color: var(--text-soft);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    background: rgba(148, 163, 184, 0.08);
    font-size: 12px;
    color: var(--text-soft);
}

.pill-muted {
    border-style: dashed;
}

.theme-toggle {
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    background: var(--bg-card);
    padding: 6px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--text-main);
    transition: background-color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.theme-toggle:hover {
    transform: translateY(-1px);
    border-color: var(--border-strong);
}

.theme-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
}

[data-theme="dark"] .theme-icon-light,
[data-theme="light"] .theme-icon-dark {
    opacity: 0.35;
}

/* ========================================= */
/* Layout                                    */
/* ========================================= */

.auth-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-layout {
    width: 100%;
    max-width: 520px;
    display: flex;
    justify-content: center;
}

.auth-panel {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 26px 32px 28px;
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-soft);
    overflow: visible;
    width: 100%;
    max-width: 760px;
}

.panel-heading h1 {
    margin: 0 0 6px 0;
    font-size: 22px;
}

.panel-heading p {
    margin: 0 0 14px 0;
    font-size: 13px;
    color: var(--text-soft);
}

/* ========================================= */
/* Tabs & forms                              */
/* ========================================= */

.auth-tabs {
    display: inline-flex;
    gap: 6px;
    background-color: var(--bg-card-soft);
    border-radius: 999px;
    padding: 4px;
    margin-bottom: 12px;
    border: 1px solid var(--border-soft);
    position: relative;
    z-index: 10;
    pointer-events: auto;
}

.auth-tab {
    border: none;
    background: transparent;
    border-radius: 999px;
    padding: 6px 16px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-soft);
    transition: background-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
    pointer-events: auto;
}

.auth-tab.is-active {
    background: linear-gradient(135deg, #4f46e5, #0ea5e9);
    color: var(--text-inverse);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.35);
}

.auth-forms-wrapper {
    margin-top: 6px;
    overflow-y: auto;
    position: relative;
    z-index: 1;
}

.auth-forms {
    display: grid;
    position: relative;
    min-height: 340px;
}

.auth-form {
    position: relative;
    position: relative;
    display: none;
    flex-direction: column;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.auth-form.is-active {
    display: flex;
}

.auth-form h2 {
    margin: 0 0 6px 0;
    font-size: 18px;
}

.auth-form-subtitle {
    margin: 0 0 12px 0;
    font-size: 12px;
    color: var(--text-soft);
}

/* ========================================= */
/* Legal page                                */
/* ========================================= */

.legal-content {
    display: grid;
    gap: 12px;
}

.legal-section {
    background: var(--bg-card-soft);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 14px 16px;
}

.legal-section h2 {
    margin: 0 0 8px 0;
    font-size: 15px;
}

.legal-section p {
    margin: 0 0 8px 0;
    font-size: 12px;
    color: var(--text-soft);
    line-height: 1.6;
}

.legal-section ul {
    margin: 0;
    padding-left: 18px;
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.6;
}

.legal-section li {
    margin-bottom: 6px;
}

.legal-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.legal-actions .link-button {
    font-size: 13px;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.form-field {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}

.form-field label {
    font-size: 12px;
    color: var(--text-soft);
    margin-bottom: 4px;
}

.field-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.link-button {
    border: none;
    background: transparent;
    padding: 0;
    font-size: 12px;
    color: var(--accent);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color var(--transition-fast), opacity var(--transition-fast);
}

.link-button:hover {
    color: #7c3aed;
}

.link-button:disabled {
    cursor: not-allowed;
    opacity: 0.7;
    color: var(--text-soft);
    text-decoration: none;
}

.link-button:focus-visible {
    outline: 2px solid rgba(79, 70, 229, 0.9);
    outline-offset: 2px;
    border-radius: 8px;
}

.link-button-center {
    align-self: center;
    margin-top: 8px;
}

.form-field input {
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-soft);
    font-size: 13px;
    outline: none;
    background-color: var(--bg-input);
    color: var(--text-main);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

[data-theme="light"] .form-field input {
    background-color: var(--bg-input);
}

.form-field input::placeholder {
    color: var(--text-muted);
}

.form-field input:focus {
    border-color: var(--accent);
    background-color: var(--bg-input-alt);
    box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.3);
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon input {
    width: 100%;
    padding-right: 34px;
}

.password-toggle-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.password-toggle-btn .icon {
    width: 16px;
    height: 16px;
}

/* Password checker */

.password-checker {
    margin: 4px 0 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background-color: var(--bg-input-alt);
    border: 1px dashed var(--border-soft);
    display: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.18s ease-out, transform 0.18s ease-out;
}

.password-checker.is-visible {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.password-checker.is-hidden {
    opacity: 0;
    transform: translateY(4px);
}

.password-checker-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    margin-bottom: 4px;
    color: var(--text-soft);
    overflow: hidden;
    max-height: 28px;
    opacity: 1;
    transform: translateX(0);
    transition: color 0.18s ease-out, opacity 0.22s ease-out, transform 0.22s ease-out, max-height 0.22s ease-out, margin-bottom 0.22s ease-out;
}

.password-checker-item:last-child {
    margin-bottom: 0;
}

.password-checker-item.is-met {
    opacity: 0;
    transform: translateX(48px);
    max-height: 0;
    margin-bottom: 0;
    pointer-events: none;
}

.password-checker-item .check-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 18px;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    background: rgba(148, 163, 184, 0.08);
    color: var(--danger);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    transition: border-color 0.18s ease-out, background-color 0.18s ease-out, color 0.18s ease-out;
}

.password-checker-item.is-valid {
    color: var(--accent-2);
}

.password-checker-item.is-valid .check-icon {
    border-color: rgba(34, 197, 94, 0.55);
    background: rgba(34, 197, 94, 0.12);
    color: var(--accent-2);
}

.password-checker-item.is-invalid {
    color: var(--danger);
}

.password-checker-item.is-invalid .check-icon {
    border-color: rgba(239, 68, 68, 0.55);
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
}

.password-checker-item.item-just-valid {
    animation: passwordItemValid 0.28s ease-out forwards;
}

@keyframes passwordItemValid {
    0% { transform: translateX(0); opacity: 1; }
    50% { transform: translateX(4px); }
    100% { transform: translateX(0); opacity: 0; }
}

.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.form-links {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-soft);
}

.checkbox-label input {
    width: 14px;
    height: 14px;
}

.form-helper-text {
    font-size: 11px;
    color: var(--text-soft);
}

.form-message {
    min-height: 18px;
    font-size: 12px;
    margin-bottom: 10px;
    color: var(--text-soft);
}
.form-message.is-error { color: var(--danger); }
.form-message.is-success { color: var(--accent-2); }
.form-message.is-muted { color: var(--text-soft); }

.recaptcha-field {
    margin-bottom: 12px;
}

.recaptcha-box {
    display: flex;
    justify-content: flex-start;
    min-height: 78px;
}

.recaptcha-box > div {
    margin: 0;
}

#otpEmailLabelLogin,
#otpEmailLabelRegister,
#otpEmailLabelForgot {
    font-weight: 600;
}

/* ========================================= */
/* OTP & PIN input                           */
/* ========================================= */

.otp-inputs {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin: 20px auto 0;
    width: 100%;
    max-width: 520px;
    padding-inline: 8px;
}

.otp-inputs input {
    width: 44px;
    height: 44px;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    padding: 0;
    border-radius: 10px;
    border: 1px solid var(--border-soft);
    background-color: var(--bg-input);
    color: var(--text-main);
    transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.otp-inputs input:focus {
    border-color: var(--accent);
    background-color: var(--bg-input-alt);
    box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.3);
}

.otp-inputs input.valid-animate {
    border-color: var(--accent-2);
    background-color: rgba(34, 197, 94, 0.08);
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.35);
    animation: otpValidPulse 0.35s ease-out forwards;
}

.otp-inputs input.error-animate {
    border-color: var(--danger);
    background-color: rgba(248, 113, 113, 0.12);
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.35);
    animation: otpErrorPulse 0.35s ease-out forwards;
}

@keyframes otpValidPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
    50% { transform: scale(1.05); box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.2); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); border-color: var(--border-soft); background-color: var(--bg-input); }
}

@keyframes otpErrorPulse {
    0% { transform: translateX(0); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
    20% { transform: translateX(-3px); }
    40% { transform: translateX(3px); }
    60% { transform: translateX(-2px); }
    80% { transform: translateX(2px); }
    100% { transform: translateX(0); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); border-color: var(--border-soft); background-color: var(--bg-input); }
}

/* ========================================= */
/* Animasi form slide                        */
/* ========================================= */

.auth-form.slide-in-left { animation: slideInLeft 0.24s ease-out forwards; }
.auth-form.slide-out-left { animation: slideOutLeft 0.22s ease-in forwards; }
.auth-form.slide-in-right { animation: slideInRight 0.24s ease-out forwards; }
.auth-form.slide-out-right { animation: slideOutRight 0.22s ease-in forwards; }

@keyframes slideInLeft { from { transform: translateX(24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOutLeft { from { transform: translateX(0); opacity: 1; } to { transform: translateX(-24px); opacity: 0; } }
@keyframes slideInRight { from { transform: translateX(-24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOutRight { from { transform: translateX(0); opacity: 1; } to { transform: translateX(24px); opacity: 0; } }

/* ========================================= */
/* Buttons                                   */
/* ========================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 999px;
    padding: 10px 16px;
    font-size: 13px;
    cursor: pointer;
    transition: background-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast), color var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #4f46e5, #0ea5e9);
    color: var(--text-inverse);
    box-shadow: 0 12px 28px rgba(79, 70, 229, 0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 32px rgba(79, 70, 229, 0.45);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-soft);
    box-shadow: none;
}

.btn-secondary:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.04);
}

.btn-full {
    width: 100%;
}

/* ========================================= */
/* Footer                                    */
/* ========================================= */

.auth-footer {
    text-align: center;
    padding: 8px 12px 14px;
    font-size: 11px;
    color: var(--text-soft);
}

/* ========================================= */
/* Responsif                                 */
/* ========================================= */

@media (max-width: 900px) {
    .auth-layout {
        max-width: 520px;
    }
    .auth-panel {
        padding: 22px 24px 24px;
    }
}

@media (max-width: 768px) {
    .auth-topbar {
        align-items: flex-start;
    }
    .topbar-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .auth-shell {
        padding: 14px 12px;
    }

    .auth-topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-grid-2 {
        grid-template-columns: minmax(0, 1fr);
    }

    .auth-panel {
        padding: 20px 20px 22px;
    }

    .auth-tabs {
        width: 100%;
        justify-content: space-between;
    }

    .auth-tab {
        flex: 1;
        text-align: center;
    }

    .form-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .otp-inputs input {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .brand-title {
        font-size: 14px;
    }

    .panel-heading h1 {
        font-size: 20px;
    }

    .auth-panel {
        padding: 18px 16px 20px;
    }

    .otp-inputs {
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .otp-inputs input {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
}

@media (max-width: 360px) {
    .pill {
        font-size: 11px;
        padding: 4px 8px;
    }

    .theme-toggle {
        padding: 5px 8px;
    }

    .auth-panel {
        padding: 16px 14px 18px;
    }

    .recaptcha-box {
        transform: scale(0.92);
        transform-origin: top left;
    }
}
