/* ============================================
   IPD Login Page - Modern & Elegant Design
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

:root {
    /* Color Palette */
    --primary-blue: #0052CC;
    --deep-blue: #003D99;
    --light-blue: #0066FF;
    --accent-yellow: #FFD700;
    --accent-green: #7FFF00;
    --progress-orange: #FF8C00;
    --white: #FFFFFF;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --error-red: #EF4444;
    --success-green: #10B981;

    /* Spacing */
    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 100px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

html,
body {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(180deg, var(--primary-blue) 0%, var(--deep-blue) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
    position: relative;
    overflow-x: hidden;
}

/* Animated background effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 80%, rgba(255, 215, 0, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 80% 20%, rgba(127, 255, 0, 0.1) 0%, transparent 40%);
    pointer-events: none;
    z-index: 0;
}

/* ============================================
   Login Container
   ============================================ */

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-lg);
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Login Header
   ============================================ */

.login-header {
    text-align: center;
    animation: slideDown 0.6s ease-out 0.1s both;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo-small {
    font-size: 48px;
    font-weight: 800;
    font-weight: 800;
    letter-spacing: 4px;
    margin-bottom: var(--spacing-xs);

    /* Global Brand Gradient - White to Gold */
    background: linear-gradient(90deg, #FFFFFF 0%, #FFD700 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;

    /* Text shadow for legibility on blue */
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.header-title {
    font-size: 16px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.5px;
}

/* ============================================
   Login Card
   ============================================ */

.login-card {
    width: 100%;
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.6s ease-out 0.2s both;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-header {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.card-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: var(--spacing-xs);
}

.card-subtitle {
    font-size: 14px;
    color: var(--gray-500);
}

/* ============================================
   Login Tabs
   ============================================ */

.login-tabs {
    display: flex;
    gap: var(--spacing-xs);
    background: var(--gray-100);
    padding: 4px;
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    color: var(--gray-500);
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn svg {
    width: 18px;
    height: 18px;
}

.tab-btn:hover {
    color: var(--gray-700);
}

.tab-btn.active {
    background: var(--white);
    color: var(--primary-blue);
    box-shadow: var(--shadow-sm);
}

.tab-btn.active svg {
    color: var(--primary-blue);
}

/* Admin button style */
.btn-admin {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.btn-admin:hover {
    box-shadow: 0 8px 20px rgba(5, 150, 105, 0.4);
}

/* ============================================
   Login Form
   ============================================ */

.login-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

/* Input Group */
.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.input-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
}

.input-icon {
    width: 16px;
    height: 16px;
    color: var(--primary-blue);
}

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

.input-field {
    width: 100%;
    padding: var(--spacing-md);
    padding-right: 60px;
    font-size: 16px;
    font-family: inherit;
    color: var(--gray-800);
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    outline: none;
}

.input-field::placeholder {
    color: var(--gray-400);
}

.input-field:focus {
    background: var(--white);
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 4px rgba(0, 82, 204, 0.1);
}

.input-field:valid:not(:placeholder-shown) {
    border-color: var(--success-green);
}

.input-counter {
    position: absolute;
    right: var(--spacing-md);
    font-size: 12px;
    color: var(--gray-400);
    pointer-events: none;
}

/* Toggle Password */
.toggle-password {
    position: absolute;
    right: var(--spacing-sm);
    padding: var(--spacing-xs);
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
    transition: color 0.2s ease;
}

.toggle-password:hover {
    color: var(--primary-blue);
}

.toggle-password svg {
    width: 20px;
    height: 20px;
}

.hidden {
    display: none !important;
}

/* ============================================
   Remember & Forgot
   ============================================ */

.remember-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--spacing-xs);
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    cursor: pointer;
    user-select: none;
}

.checkbox-wrapper input {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.checkbox-wrapper input:checked+.checkmark {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
}

.checkbox-wrapper input:checked+.checkmark::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.checkbox-label {
    font-size: 14px;
    color: var(--gray-600);
}

.forgot-link {
    font-size: 14px;
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.forgot-link:hover {
    color: var(--deep-blue);
    text-decoration: underline;
}

/* ============================================
   Login Button
   ============================================ */

.btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    width: 100%;
    padding: var(--spacing-md) var(--spacing-lg);
    margin-top: var(--spacing-sm);
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    color: var(--white);
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--deep-blue) 100%);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-login::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: left 0.5s ease;
}

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

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 82, 204, 0.4);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.btn-login:hover .btn-icon {
    transform: translateX(4px);
}

/* ============================================
   Fingerprint Login Button
   ============================================ */

.divider-or {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0 12px;
}

.divider-or::before,
.divider-or::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-200);
}

.divider-or span {
    font-size: 13px;
    color: var(--gray-400);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-fingerprint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    color: var(--primary-blue);
    background: linear-gradient(135deg, rgba(0, 82, 204, 0.06) 0%, rgba(0, 61, 153, 0.1) 100%);
    border: 2px solid rgba(0, 82, 204, 0.25);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-fingerprint:hover {
    background: linear-gradient(135deg, rgba(0, 82, 204, 0.12) 0%, rgba(0, 61, 153, 0.15) 100%);
    border-color: var(--primary-blue);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 82, 204, 0.2);
}

.btn-fingerprint:active {
    transform: translateY(0);
}

.fingerprint-pulse {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 82, 204, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.fingerprint-pulse::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    border: 2px solid rgba(0, 82, 204, 0.3);
    animation: fp-pulse 2s ease-in-out infinite;
}

@keyframes fp-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.4; }
}

.fingerprint-btn-icon {
    width: 22px;
    height: 22px;
    color: var(--primary-blue);
}

/* ============================================
   Login Button Row (Masuk + Fingerprint side by side)
   ============================================ */

.login-btn-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
    margin-top: var(--spacing-sm);
    flex-wrap: nowrap;
}

.login-btn-row .btn-login {
    flex: 1;
    margin-top: 0;
}

.btn-fingerprint-side {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    min-width: 52px;
    padding: 0;
    background: linear-gradient(135deg, rgba(0, 82, 204, 0.08) 0%, rgba(0, 61, 153, 0.12) 100%);
    border: 2px solid rgba(0, 82, 204, 0.3);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-fingerprint-side:hover {
    background: linear-gradient(135deg, rgba(0, 82, 204, 0.15) 0%, rgba(0, 61, 153, 0.2) 100%);
    border-color: var(--primary-blue);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 82, 204, 0.25);
}

.btn-fingerprint-side:active {
    transform: translateY(0);
}

.btn-fingerprint-side .fingerprint-btn-icon {
    width: 26px;
    height: 26px;
    color: var(--primary-blue);
    animation: fp-pulse-icon 2s ease-in-out infinite;
}

@keyframes fp-pulse-icon {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.7; }
}

/* Loader */
.btn-loader {
    position: absolute;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================
   Error Message
   ============================================ */

.error-message {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    margin-top: var(--spacing-md);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    animation: shake 0.5s ease;
}

@keyframes shake {

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

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

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

.error-icon {
    width: 20px;
    height: 20px;
    color: var(--error-red);
    flex-shrink: 0;
}

.error-text {
    font-size: 14px;
    color: var(--error-red);
}

/* ============================================
   Login Footer
   ============================================ */

.login-footer {
    text-align: center;
    animation: fadeIn 0.6s ease-out 0.4s both;
}

.footer-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: var(--spacing-xs);
}

.register-link {
    color: var(--accent-yellow);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.register-link:hover {
    color: var(--white);
    text-decoration: underline;
}

.version-text {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 480px) {
    body {
        padding: var(--spacing-sm);
        align-items: flex-start;
        padding-top: var(--spacing-xl);
    }

    .logo-small {
        font-size: 40px;
    }

    .header-title {
        font-size: 14px;
    }

    .login-card {
        padding: var(--spacing-lg);
        border-radius: var(--radius-lg);
    }

    .card-title {
        font-size: 20px;
    }

    .input-field {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 15px;
    }
}

@media (max-width: 360px) {
    .logo-small {
        font-size: 36px;
    }

    .login-card {
        padding: var(--spacing-md);
    }

    .remember-group {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }
}

/* ============================================
   Landscape Mode
   ============================================ */

@media (max-height: 600px) and (orientation: landscape) {
    body {
        padding: var(--spacing-sm);
    }

    .login-header {
        margin-bottom: var(--spacing-sm);
    }

    .logo-small {
        font-size: 32px;
    }

    .login-card {
        padding: var(--spacing-md);
    }

    .card-header {
        margin-bottom: var(--spacing-sm);
    }

    .login-form {
        gap: var(--spacing-sm);
    }
}

/* ============================================
   Accessibility
   ============================================ */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard navigation */
.input-field:focus-visible,
.btn-login:focus-visible,
.toggle-password:focus-visible,
.forgot-link:focus-visible,
.register-link:focus-visible {
    outline: 2px solid var(--accent-yellow);
    outline-offset: 2px;
}

/* ============================================
   Modal Styles
   ============================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-card {
    background: var(--white);
    width: 100%;
    max-width: 360px;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-align: center;
    padding: var(--spacing-lg);
}

.modal-overlay.active .modal-card {
    transform: scale(1);
}

.modal-icon-box {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--spacing-md);
}

.modal-icon-box.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-red);
}

.modal-icon-box.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-green);
}

.modal-icon-box svg {
    width: 32px;
    height: 32px;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: var(--spacing-xs);
}

.modal-message {
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: var(--spacing-lg);
    line-height: 1.5;
}

.modal-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--primary-blue);
    color: var(--white);
}

.modal-btn:hover {
    background: var(--deep-blue);
    transform: translateY(-1px);
}

/* ============================================
   Biometric Auto-Detection Overlay
   ============================================ */

.biometric-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    z-index: 100000;
    /* Higher than PWA overlay (99999) */
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.biometric-overlay.active {
    display: flex;
    opacity: 1;
}

.biometric-card {
    background: var(--white);
    width: 100%;
    max-width: 360px;
    border-radius: var(--radius-xl);
    padding: var(--spacing-2xl);
    box-shadow: var(--shadow-xl);
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.biometric-overlay.active .biometric-card {
    transform: scale(1);
}

.biometric-icon-box {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--spacing-lg);
    background: linear-gradient(135deg, rgba(0, 82, 204, 0.1) 0%, rgba(0, 61, 153, 0.1) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Pulse animation for fingerprint icon */
.biometric-icon-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--deep-blue) 100%);
    opacity: 0.2;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.2;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.3;
    }
}

.fingerprint-icon {
    width: 40px;
    height: 40px;
    color: var(--primary-blue);
    position: relative;
    z-index: 1;
    animation: fingerprint-scan 1.5s ease-in-out infinite;
}

@keyframes fingerprint-scan {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

.biometric-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: var(--spacing-xs);
}

.biometric-message {
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: var(--spacing-lg);
    line-height: 1.6;
}

.btn-use-pin {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    width: 100%;
    padding: var(--spacing-md);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    color: var(--gray-700);
    background: var(--gray-100);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-use-pin:hover {
    background: var(--gray-200);
    border-color: var(--gray-300);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-use-pin:active {
    transform: translateY(0);
}

.btn-use-pin svg {
    width: 18px;
    height: 18px;
}

/* Responsive adjustments for biometric overlay */
@media (max-width: 480px) {
    .biometric-card {
        padding: var(--spacing-lg);
    }

    .biometric-icon-box {
        width: 70px;
        height: 70px;
    }

    .fingerprint-icon {
        width: 35px;
        height: 35px;
    }

    .biometric-title {
        font-size: 18px;
    }
}
