/* =========================================
   ROOT VARIABLES (Soft Blue Palette)
   ========================================= */

:root {
    /* SOFT BLUE PALETTE */
    --primary-soft: #60a5fa;       /* Blue 400 */
    --primary-main: #3b82f6;       /* Blue 500 */
    --primary-dark: #2563eb;       /* Blue 600 */
    --bg-gradient-1: #eff6ff;      /* Blue 50 */
    --bg-gradient-2: #dbeafe;      /* Blue 100 */
    --accent-bg: #f0f9ff;          /* Alice Blue-ish */
    
    /* TEXT COLORS */
    --text-main: #334155;          /* Slate 700 */
    --text-muted: #94a3b8;         /* Slate 400 */
    --text-placeholder: #cbd5e1;   /* Slate 300 */

    /* FEEDBACK COLORS */
    --error-bg: #fef2f2;
    --error-border: #fee2e2;
    --error-text: #ef4444;
    --success-color: #10b981;

    /* UI METRICS */
    --card-radius: 28px;
    --input-radius: 16px;
    --btn-radius: 14px;
    --shadow-soft: 0 20px 40px -10px rgba(59, 130, 246, 0.15);
}

/* =========================================
   GLOBAL LOCK & BODY SETTINGS
   ========================================= */
html, body {
    /* Penguncian Tampilan (No Scroll) */
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Mencegah scrollbar muncul */
    position: fixed;  /* Mengunci posisi agar tidak bergeser saat keyboard/zoom */
    overscroll-behavior: none; /* Mencegah efek pantulan (bounce) di mobile */
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-1) 0%, #ffffff 100%);
    
    /* Flexbox Centering */
    display: flex;
    align-items: center;
    justify-content: center;
    
    color: var(--text-main);
    position: relative;
}

/* =========================================
   BACKGROUND DECORATION (Moving Blobs)
   ========================================= */
.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.6;
    animation: float 10s infinite ease-in-out;
    pointer-events: none; /* Agar tidak mengganggu klik */
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: var(--primary-soft);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.shape-2 {
    width: 300px;
    height: 300px;
    background: #bfdbfe; /* Blue 200 */
    bottom: -50px;
    right: -50px;
    animation-delay: 5s;
}

@keyframes float {
    0% { transform: translate(0, 0); }
    50% { transform: translate(30px, 50px); }
    100% { transform: translate(0, 0); }
}

/* =========================================
   CONTAINER & CARD
   ========================================= */
.login-wrapper {
    width: 100%;
    max-width: 440px;
    padding: 24px;
    animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    /* Memastikan wrapper tidak memicu scroll jika konten pas pasan */
    max-height: 100vh; 
    overflow-y: auto; /* Jaga-jaga jika layar SANGAT kecil */
    display: flex; /* Center vertikal dalam wrapper jika ada scroll */
    align-items: center;
}

.login-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255, 255, 255, 0.8);
    padding: 48px 40px;
    position: relative;
    overflow: hidden;
    width: 100%;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 8px;
    background: linear-gradient(90deg, #93c5fd, var(--primary-main), #93c5fd);
    opacity: 0.8;
}

/* =========================================
   TYPOGRAPHY & ICONS
   ========================================= */
.brand-container {
    text-align: center;
    margin-bottom: 8px;
}

.brand-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary-soft), var(--primary-main));
    color: white;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    margin-bottom: 20px;
    box-shadow: 0 10px 20px -5px rgba(59, 130, 246, 0.4);
    position: relative;
}

.brand-icon::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255,255,255,0.4) 0%, transparent 50%);
}

.login-title {
    font-weight: 700;
    color: #1e293b; /* Slate 800 */
    margin-bottom: 6px;
    text-align: center;
    font-size: 1.75rem;
    letter-spacing: -0.5px;
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 36px;
    font-weight: 400;
}

/* =========================================
   FORM ELEMENTS
   ========================================= */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 10px;
    display: block;
    margin-left: 4px;
}


.custom-input-group {
    position: relative;
    background: #f8fafc;
    border-radius: var(--input-radius);
    border: 2px solid transparent;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    overflow: hidden; 
}

/* Desktop Focus Effect */
.custom-input-group:focus-within {
    background: #ffffff;
    border-color: var(--primary-soft);
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.15);
    transform: translateY(-2px); /* Animasi naik (Hanya Desktop) */
}

.input-icon {
    padding-left: 18px;
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

.custom-input-group:focus-within .input-icon {
    color: var(--primary-main);
}

.form-control {
    background: transparent;
    border: none;
    padding: 16px 12px 16px 12px;
    font-size: 0.95rem; /* Default desktop */
    color: var(--text-main);
    font-weight: 500;
    width: 100%;
}

.form-control:focus {
    box-shadow: none;
    outline: none;
}

.form-control::placeholder {
    color: var(--text-placeholder);
    font-weight: 400;
}

/* =========================================
   BUTTONS
   ========================================= */
.btn-login {
    background: linear-gradient(135deg, var(--primary-main), var(--primary-dark));
    border: none;
    padding: 16px;
    font-weight: 600;
    border-radius: var(--btn-radius);
    color: white;
    font-size: 1rem;
    letter-spacing: 0.3px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px -2px rgba(37, 99, 235, 0.3);
    width: 100%;
    margin-top: 12px;
    position: relative;
    overflow: hidden;
}

.btn-login:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px -4px rgba(37, 99, 235, 0.5);
    background: linear-gradient(135deg, var(--primary-dark), #1e40af);
}

.btn-login:active {
    transform: translateY(-1px);
}

/* =========================================
   ALERTS & FEEDBACK
   ========================================= */
.alert-error {
    background-color: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--error-text);
    padding: 14px 18px;
    border-radius: 14px;
    font-size: 0.85rem;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 12px;
    line-height: 1.5;
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* =========================================
   SUCCESS STATE
   ========================================= */
.success-content {
    text-align: center;
    padding: 10px 0;
    animation: fadeUp 0.6s ease-out;
}

.checkmark-wrapper {
    width: 90px;
    height: 90px;
    position: relative;
    display: inline-block;
    vertical-align: top;
    margin-bottom: 24px;
}

.checkmark-wrapper .background {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: var(--success-color);
    position: absolute;
    box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.4);
}

.checkmark-wrapper .checkmark {
    border-radius: 5px;
}

.checkmark-wrapper .checkmark.draw:after {
    animation-delay: 100ms;
    animation-duration: 1s;
    animation-timing-function: ease;
    animation-name: checkmark;
    transform: scaleX(-1) rotate(135deg);
    animation-fill-mode: forwards;
}

.checkmark-wrapper .checkmark:after {
    opacity: 1;
    height: 45px;
    width: 22px;
    transform-origin: left top;
    border-right: 5px solid white;
    border-top: 5px solid white;
    content: '';
    left: 32px;
    top: 54px;
    position: absolute;
}

@keyframes checkmark {
    0% { height: 0; width: 0; opacity: 1; }
    20% { height: 0; width: 22px; opacity: 1; }
    40% { height: 45px; width: 22px; opacity: 1; }
    100% { height: 45px; width: 22px; opacity: 1; }
}

.success-text {
    font-size: 1.6rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 12px;
}

.success-subtext {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.spinner-grow-sm {
    width: 1rem; height: 1rem;
    vertical-align: middle;
    margin-left: 8px;
}

.footer-text {
    text-align: center;
    margin-top: 30px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(25px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   MOBILE OPTIMIZATION (FIX STABILITY)
   ========================================= */
@media (max-width: 576px) {
    /* 1. Matikan animasi background agar tidak berat */
    .bg-shape {
        animation: none;
        opacity: 0.4;
    }

    /* 2. Matikan gerakan (transform) pada input agar stabil */
    .custom-input-group:focus-within {
        transform: none !important;
    }

    /* 3. Paksa font 16px untuk mencegah zoom otomatis iOS */
    .form-control {
        font-size: 16px !important;
    }

    /* 4. Kompakkan padding agar muat dalam satu layar */
    .login-wrapper {
        padding: 15px;
    }

    .login-card {
        padding: 30px 20px;
    }

    .brand-icon {
        width: 60px;
        height: 60px;
        font-size: 28px;
        margin-bottom: 15px;
    }

    .login-title {
        font-size: 1.5rem;
    }

    .login-subtitle {
        font-size: 0.85rem;
        margin-bottom: 25px;
    }

    .form-group {
        margin-bottom: 16px;
    }

    .form-label {
        font-size: 0.8rem;
    }
    
    /* Perkecil padding input sedikit */
    .form-control {
        padding: 10px;
    }
    
    .input-icon {
        padding-left: 12px;
    }
}