* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Allow selection only in password input */
input[type="password"], input[type="text"] {
    user-select: text;
    -webkit-user-select: text;
}

/* Disable image dragging */
img {
    -webkit-user-drag: none;
    user-drag: none;
    pointer-events: none;
}

/* Re-enable pointer for phantom icon */
.phantom-icon {
    pointer-events: auto;
}

/* Disable browser validation tooltips */
input:invalid,
textarea:invalid {
    box-shadow: none;
}

input::-webkit-validation-bubble,
input::-webkit-validation-bubble-message,
input::-webkit-validation-bubble-arrow,
input::-webkit-validation-bubble-arrow-clipper {
    display: none;
}

:root {
    --bg-primary: #09090b;
    --bg-secondary: #18181b;
    --bg-card: #1c1c1f;
    --border-color: #27272a;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;
    --accent-primary: #6366f1;
    --accent-secondary: #818cf8;
    --success: #22c55e;
    --error: #ef4444;
    --phantom-color: #AB9FF2;
    --border-radius: 12px;
    --border-radius-lg: 16px;
}

html, body {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    position: fixed;
    width: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100dvh;
    min-height: -webkit-fill-available;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.login-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 32px;
    width: 100%;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

body.ready .login-container {
    opacity: 1;
    transform: translateY(0);
}

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

.login-logo {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-logo svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.3));
}

.login-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-header .subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Alerts */
.login-alerts {
    margin-bottom: 20px;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--border-radius);
    font-size: 14px;
    display: none;
    align-items: center;
    gap: 8px;
}

.alert.show {
    display: flex;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: #86efac;
}

/* Type Selector */
.login-type-selector {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.login-type-btn {
    flex: 1;
    padding: 16px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.login-type-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
}

.login-type-btn.active {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--accent-primary);
}

.login-type-icon {
    font-size: 24px;
}

.login-type-label {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}

/* Login Sections */
.login-section {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Biometric Button */
.biometric-btn {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: inherit;
}

.biometric-btn.visible {
    display: flex;
}

.biometric-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.3);
}

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

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

/* Separator */
.separator {
    display: none;
    align-items: center;
    margin: 20px 0;
    color: var(--text-tertiary);
    font-size: 13px;
}

.separator.visible {
    display: flex;
}

.separator::before,
.separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.separator span {
    padding: 0 16px;
}

/* Form */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
}

input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 15px;
    color: var(--text-primary);
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="password"]::placeholder {
    color: var(--text-tertiary);
}

input[type="password"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

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

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    width: 100%;
    padding: 14px 20px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-secondary:hover {
    background: var(--border-color);
}

/* Phantom Section */
.phantom-info {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 16px;
    font-size: 14px;
}

.phantom-btn {
    width: 100%;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--phantom-color) 0%, #8B7FF2 100%);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-family: inherit;
}

.phantom-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(171, 159, 242, 0.4);
}

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

.phantom-icon {
    width: 24px;
    height: 24px;
}

.phantom-note {
    color: var(--text-tertiary);
    text-align: center;
    margin-top: 12px;
    font-size: 12px;
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* Allow text selection in inputs */
input {
    user-select: text;
    -webkit-user-select: text;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 32px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.modal h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
}

.modal p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 24px;
}

.modal-buttons {
    display: flex;
    gap: 12px;
}

.modal-buttons button {
    flex: 1;
}

/* Mobile */
@media (max-width: 480px) {
    .login-wrapper {
        padding: 16px;
    }
    
    .login-container {
        padding: 24px;
    }
    
    .login-header h1 {
        font-size: 22px;
    }
    
    .login-logo {
        width: 56px;
        height: 56px;
    }
    
    .logo-icon {
        font-size: 28px;
    }
    
    .login-type-btn {
        padding: 14px 10px;
    }
    
    .login-type-icon {
        font-size: 20px;
    }
    
    .login-type-label {
        font-size: 13px;
    }
}


/* Background pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
    will-change: transform;
}

