/* ========================================
   LOGIN SECTION (Cinematic Glassmorphism)
   ======================================== */
.login-section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    min-height: 100dvh;
    height: 100dvh;
    background: var(--upm-gradient-hero-radial);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    overflow: hidden;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    will-change: opacity, transform;
    transform: translateZ(0);
}

.login-shell {
    position: relative;
    z-index: 3;
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(320px, 420px);
    width: min(980px, 100%);
    max-height: calc(100dvh - 40px);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    box-shadow:
        0 32px 80px rgba(0, 0, 0, 0.38),
        0 0 0 1px rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.login-showcase {
    position: relative;
    min-height: 320px;
    background: var(--upm-gradient-hero-radial);
    overflow: hidden;
}

.login-bg-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transform: scale(1.06);
    filter: saturate(0.9) contrast(1.04);
}

.login-showcase-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(160deg, rgba(10, 42, 42, 0.55) 0%, rgba(19, 78, 74, 0.28) 50%, rgba(10, 42, 42, 0.62) 100%),
        radial-gradient(circle at 30% 20%, rgba(212, 175, 55, 0.12), transparent 45%);
    pointer-events: none;
}

.login-showcase-caption {
    position: absolute;
    left: 24px;
    right: 24px;
    bottom: 24px;
    z-index: 2;
    color: #fff;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.login-showcase-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    margin-bottom: 10px;
}

.login-showcase-badge i {
    color: var(--gold, #D4AF37);
}

.login-showcase-title {
    margin: 0 0 6px;
    font-family: "Poppins", "Inter", sans-serif;
    font-size: clamp(1.35rem, 2.4vw, 1.75rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.3px;
    max-width: 16ch;
}

.login-showcase-sub {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.82);
    max-width: 24ch;
}

.login-showcase-caption p {
    margin: 0;
}

.login-showcase .floating-element {
    opacity: 0.28;
}

.login-showcase .el-1 {
    width: 220px;
    height: 220px;
    top: -8%;
    left: -8%;
}

.login-showcase .el-2 {
    width: 280px;
    height: 220px;
    bottom: -12%;
    right: -10%;
}

.login-section::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background:
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.025'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.45;
    pointer-events: none;
}

.login-section::after {
    content: "";
    position: absolute;
    top: -35%;
    right: -10%;
    z-index: 0;
    width: min(480px, 80vw);
    height: min(480px, 80vw);
    background: radial-gradient(circle, var(--upm-teal-glow) 0%, transparent 68%);
    pointer-events: none;
    animation: loginGlowPulse 9s ease-in-out infinite;
}

@keyframes loginGlowPulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 0.95; transform: scale(1.06); }
}

.login-section.is-scrollable {
    align-items: center;
    overflow-y: auto;
    padding: 16px;
}

.login-section.is-scrollable .login-shell {
    max-height: none;
    margin: auto 0;
}

.login-entrance {
    animation: fadeInLogin 1.1s ease-out forwards;
    pointer-events: auto;
}

.fade-out-up {
    animation: fadeOutUpLogin 0.5s ease-in forwards;
    pointer-events: none;
}

.floating-element {
    position: absolute;
    z-index: 1;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), inset 0 0 32px rgba(255, 255, 255, 0.06);
    opacity: 0.45;
}

.el-1 {
    width: 350px;
    height: 350px;
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    top: -5%;
    left: -5%;
    background: linear-gradient(135deg, rgba(42, 117, 117, 0.35), rgba(10, 42, 42, 0.2));
    animation: morphFloat 12s ease-in-out infinite alternate;
}

.el-2 {
    width: 500px;
    height: 400px;
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    bottom: -10%;
    right: -10%;
    background: linear-gradient(135deg, rgba(32, 96, 96, 0.4), rgba(19, 78, 74, 0.15));
    animation: morphFloat 15s ease-in-out infinite alternate-reverse;
}

.el-3 {
    width: 200px;
    height: 250px;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    top: 20%;
    right: 15%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(42, 117, 117, 0.12));
    animation: morphFloat 10s ease-in-out infinite alternate;
}

.el-4 {
    width: 250px;
    height: 250px;
    border-radius: 50% 50% 30% 70% / 50% 50% 70% 50%;
    bottom: 15%;
    left: 8%;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.12), rgba(255, 255, 255, 0.06));
    animation: morphFloat 14s ease-in-out infinite alternate;
    filter: blur(8px);
}

@keyframes morphFloat {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
        border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    }

    33% {
        border-radius: 70% 30% 50% 50% / 30% 30% 70% 70%;
        transform: translateY(-20px) rotate(5deg) scale(1.05);
    }

    66% {
        border-radius: 100% 60% 60% 100% / 100% 100% 60% 60%;
        transform: translateY(10px) rotate(-5deg) scale(0.95);
    }

    100% {
        transform: translateY(-40px) rotate(10deg) scale(1);
        border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    }
}

.login-card {
    position: relative;
    z-index: 1;
    background: #ffffff;
    border: none;
    border-left: 1px solid rgba(19, 78, 74, 0.08);
    border-radius: 0;
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - 40px);
    padding: 34px 30px 24px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transform: translateX(16px);
    opacity: 0;
    animation: loginCardIn 0.65s cubic-bezier(0.2, 0.8, 0.2, 1) 0.15s forwards;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow-x: hidden;
    overflow-y: auto;
    will-change: transform, opacity;
}

@keyframes loginCardIn {
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.login-card.signup-mode {
    padding: 24px 26px 14px;
}

.login-section:has(.login-card.signup-mode) .login-shell {
    width: min(1040px, 100%);
    grid-template-columns: minmax(0, 0.82fr) minmax(360px, 1.18fr);
}

.login-section.is-scrollable .login-card {
    max-height: none;
    overflow: hidden;
}

.login-section.is-scrollable .login-card::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.login-card.signup-mode .login-header {
    margin-bottom: 16px;
}

.login-card.signup-mode .login-logo {
    width: 64px;
    height: 64px;
    margin-bottom: 10px;
}

.login-card.signup-mode .login-header h2 {
    font-size: 2rem;
    margin-bottom: 4px;
}

.login-card.signup-mode .login-header p {
    font-size: 0.72rem;
}

.login-card.signup-mode .signup-fields .form-group {
    margin-bottom: 10px;
}

.login-card.signup-mode .login-form label {
    font-size: 0.7rem;
    margin-bottom: 6px;
}

.login-card.signup-mode .login-form input,
.login-card.signup-mode .login-form select {
    padding-top: 12px;
    padding-bottom: 12px;
}

.login-card.signup-mode .btn-masuk {
    margin-top: 8px;
    padding: 12px;
}

.login-card.signup-mode .login-toggle {
    margin-top: 10px;
}

.login-card.signup-mode .login-footer {
    margin-top: 12px;
    padding-top: 10px;
    font-size: 0.68rem;
}

.login-upm-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(19, 78, 74, 0.08);
    border: 1px solid rgba(19, 78, 74, 0.14);
    box-shadow: 0 4px 12px rgba(10, 42, 42, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.login-upm-logo {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.login-upm-badge span {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--upm-teal-800, #134e4a);
}

.login-form {
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.login-form.fade-out {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

.login-form.fade-in {
    opacity: 1;
    transform: translateY(0);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
    animation: floatYSoft 4s ease-in-out infinite alternate;
}

.login-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--upm-teal-900, #0d3333);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.login-header p {
    font-size: 0.85rem;
    color: var(--upm-teal-800, #134e4a);
    opacity: 0.85;
    font-weight: 400;
}

@keyframes shake {
    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-5px);
    }

    40%,
    80% {
        transform: translateX(5px);
    }
}

.shake {
    animation: shake 0.4s ease-in-out;
}

#loginError {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    text-align: center;
    margin-top: 5px;
    margin-bottom: 10px;
    display: none;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.signup-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 14px;
    row-gap: 0;
}

.signup-fields .form-group {
    margin-bottom: 14px;
}

.signup-fields .form-group.full-row {
    grid-column: 1 / -1;
}

.login-form label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--emerald-900);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    color: var(--emerald-500);
    font-size: 0.9rem;
    transition: var(--transition-base);
}

.login-form input {
    width: 100%;
    padding: 14px 16px 14px 44px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-md);
    color: var(--emerald-900);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.input-wrapper:has(.password-toggle) input {
    padding-right: 44px;
}

.login-form input::placeholder {
    color: var(--emerald-600);
    opacity: 0.6;
}

.login-form input:focus {
    outline: none;
    background: #ffffff;
    border-color: var(--emerald-400);
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2);
}

.login-form input:focus + .input-icon,
.login-form input:focus ~ .input-icon {
    color: var(--emerald-500);
}

.password-toggle {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--emerald-500);
    cursor: pointer;
    padding: 4px;
    transition: var(--transition-fast);
}

.password-toggle:hover {
    color: var(--emerald-700);
}

.btn-masuk {
    width: 100%;
    margin-top: 12px;
    padding: 14px;
    border: none;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--upm-teal-800, #134e4a) 0%, var(--upm-teal-600, #206060) 100%);
    color: var(--white);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(10, 42, 42, 0.25);
}

.btn-masuk::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: all 0.5s ease;
}

.btn-masuk:hover {
    transform: scale(1.02);
    background: linear-gradient(135deg, var(--upm-teal-700, #1a5050) 0%, var(--upm-teal-500, #2a7575) 100%);
    box-shadow: 0 6px 20px rgba(10, 42, 42, 0.35);
}

.btn-masuk:hover::before {
    left: 100%;
}

.btn-masuk:active {
    transform: scale(0.95);
}

.social-login {
    margin-top: 24px;
    text-align: center;
}

.social-text {
    font-size: 0.75rem;
    color: var(--emerald-800);
    opacity: 0.7;
    position: relative;
    display: inline-block;
    padding: 0 10px;
}

.social-text::before,
.social-text::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 40px;
    height: 1px;
    background: rgba(19, 78, 74, 0.3);
}

.social-text::before {
    right: 100%;
}

.social-text::after {
    left: 100%;
}

.social-icons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 16px;
}

.social-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--emerald-700);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.social-btn:hover {
    background: #ffffff;
    transform: translateY(-2px);
    color: var(--emerald-500);
    box-shadow: 0 6px 15px rgba(19, 78, 74, 0.15);
}

.login-footer {
    margin-top: 32px;
    text-align: center;
    font-size: 0.72rem;
    color: var(--emerald-800);
    opacity: 0.7;
    border-top: 1px solid rgba(19, 78, 74, 0.2);
    padding-top: 16px;
}

@media (max-width: 900px) {
    .login-shell {
        grid-template-columns: 1fr;
        grid-template-rows: min(34vh, 260px) auto;
        max-height: calc(100dvh - 28px);
    }

    .login-showcase-caption p {
        max-width: none;
    }

    .login-showcase-title {
        max-width: none;
        font-size: 1.25rem;
    }

    .login-card {
        border-left: none;
        border-top: 1px solid rgba(19, 78, 74, 0.08);
        max-height: none;
    }

    .login-section:has(.login-card.signup-mode) .login-shell {
        grid-template-rows: min(24vh, 180px) auto;
    }
}

@media (max-width: 768px) {
    .login-section,
    .login-section.is-scrollable {
        align-items: flex-start;
        justify-content: center;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 14px 12px;
    }

    .login-shell {
        width: 100%;
    }

    .login-card,
    .login-section.is-scrollable .login-card {
        width: 100%;
        max-width: none;
        margin: 0;
    }
}

@media (max-width: 640px) {
    .login-upm-badge {
        top: 10px;
        right: 10px;
        padding: 5px 8px;
        gap: 5px;
    }

    .login-upm-logo {
        width: 18px;
        height: 18px;
    }

    .login-card.signup-mode {
        max-width: 440px;
        padding: 24px 20px 14px;
    }

    .signup-fields {
        grid-template-columns: 1fr;
        column-gap: 0;
    }
}

@media (max-height: 860px) {
    .login-section,
    .login-section.is-scrollable {
        overflow-y: auto;
        padding: 12px;
    }

    .login-shell {
        max-height: calc(100dvh - 24px);
    }

    .login-card,
    .login-section.is-scrollable .login-card {
        max-height: none;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 24px 22px 18px;
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .login-card::-webkit-scrollbar,
    .login-section.is-scrollable .login-card::-webkit-scrollbar {
        width: 0;
        height: 0;
        display: none;
    }

    .login-card.signup-mode {
        max-width: 680px;
    }

    .login-header {
        margin-bottom: 20px;
    }

    .login-logo {
        width: 56px;
        height: 56px;
        margin-bottom: 10px;
    }

    .login-header h2 {
        font-size: 1.5rem;
        margin-bottom: 6px;
    }

    .login-form .form-group {
        margin-bottom: 14px;
    }

    .signup-fields {
        grid-template-columns: 1fr;
    }

    .btn-masuk {
        padding: 12px;
    }

    .login-footer {
        margin-top: 20px;
        padding-top: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-bg-video {
        display: none;
    }

    .login-card {
        animation: none;
        opacity: 1;
        transform: none;
    }
}
