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

:root {
    --primary-color: #224abe;
    --primary-hover: #4e73df;
    --secondary-color: #6c757d;
    --whatsapp-color: #25D366;
    --background-start: #1a2980;
    --background-end: #26d0ce;
    --transition-speed: 0.4s;
}

body {
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    background: linear-gradient(45deg, var(--background-start), var(--background-end));
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Poppins', sans-serif;
}

#particles-js {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 0;
}

#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, var(--background-start), var(--background-end));
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: transform 0.7s cubic-bezier(0.83, 0, 0.17, 1), opacity 0.7s ease;
    opacity: 1;
}

#preloader.preloader-hidden {
    transform: scale(5);
    opacity: 0;
    pointer-events: none;
}

.preloader-content {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

#preloader .logo { width: 120px; }

.spinner {
    position: absolute;
    width: 160px;
    height: 160px;
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
}

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

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.5s ease-in 0.5s;
}

body.loaded .login-container { opacity: 1; }

.login-box {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 40px 35px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.header-content { margin-bottom: 25px; }

.header-content img.logo {
    width: 120px;
    margin-bottom: 15px;
    transition: transform 0.3s ease;
}
.header-content img.logo:hover { transform: scale(1.1) rotate(-5deg); }
.header-content h2 {
    margin: 0 0 5px 0;
    color: #fff;
    font-size: 28px;
    font-weight: 600;
    text-shadow: 1px 1px 5px rgba(0,0,0,0.3);
}
.header-content p {
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
}

.form-wrapper {
    width: 100%;
    overflow: hidden;
    transition: max-height var(--transition-speed) ease-in-out;
    will-change: max-height;
}

#form-login { display: block; }
#form-otp { display: none; }
.form-group { margin-bottom: 22px; position: relative; }

.form-control {
    width: 100%;
    padding: 14px 15px 14px 45px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    font-size: 15px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-control::placeholder { color: rgba(255, 255, 255, 0.7); opacity: 1; }

.form-control:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 10px rgba(34, 74, 190, 0.3);
}

.form-group i.input-icon {
    position: absolute;
    top: 50%;
    left: 15px;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.3s ease;
    z-index: 2;
}

.form-control:focus ~ i.input-icon { color: #fff; }

.password-toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 0;
    z-index: 2;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--primary-color);
    border: none;
    color: #fff;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.otp-group { display: flex; gap: 10px; }

#btn-kirim-otp {
    padding: 0 15px;
    background: var(--secondary-color);
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
    white-space: nowrap;
}
#btn-kirim-otp:hover { background: #5a6268; }
#btn-kirim-otp:disabled { background: #868e96; cursor: not-allowed; }

.switch-method { margin-top: 25px; text-align: center; }

.btn-switch {
    background: var(--whatsapp-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-switch:hover {
    background: #128C7E;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.btn-switch:disabled {
    background: #868e96;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.small-text {
    margin-top: 25px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.alert {
    padding: .75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: .25rem;
    color: #fff;
    background-color: #dc3545;
    border-color: #d32535;
}

.role-selection-button {
    display: block;
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    font-size: 16px;
    font-weight: 500;
    color: #fff;
    background-color: var(--primary-color);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}
.role-selection-button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}

@media (max-width: 480px) {
    .login-box { padding: 30px 20px; background: rgba(0, 0, 0, 0.2); }
}