/* ===== CSS Variables ===== */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --danger-gradient: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    --dark-gradient: linear-gradient(135deg, #0c0c0c 0%, #1a1a2e 50%, #16213e 100%);
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #38ef7d;
    --danger-color: #f45c43;
    --warning-color: #ffa726;
    --bg-dark: #0a0a0f;
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-input: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --border-color: rgba(255, 255, 255, 0.1);
    --border-focus: rgba(102, 126, 234, 0.5);
    --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 40px rgba(102, 126, 234, 0.3);
    --shadow-success: 0 0 40px rgba(56, 239, 125, 0.3);
    --shadow-danger: 0 0 40px rgba(244, 92, 67, 0.3);
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 20px;
    --border-radius-xl: 30px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--dark-gradient);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: var(--text-primary);
    padding: 20px;
}

.animated-bg { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; overflow: hidden; z-index: 0; }
.particle { position: absolute; width: 10px; height: 10px; background: var(--primary-gradient); border-radius: 50%; opacity: 0.3; animation: particleFloat 20s infinite; }
.particle:nth-child(1) { left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { left: 20%; animation-delay: 2s; }
.particle:nth-child(3) { left: 35%; animation-delay: 4s; }
.particle:nth-child(4) { left: 50%; animation-delay: 6s; }
.particle:nth-child(5) { left: 65%; animation-delay: 8s; }
.particle:nth-child(6) { left: 75%; animation-delay: 10s; }
.particle:nth-child(7) { left: 85%; animation-delay: 12s; }
.particle:nth-child(8) { left: 95%; animation-delay: 14s; }

@keyframes particleFloat {
    0%, 100% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    10% { opacity: 0.5; }
    90% { opacity: 0.3; }
    100% { transform: translateY(-100vh) rotate(720deg); opacity: 0; }
}

.security-animation { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); pointer-events: none; z-index: 0; }
.shield-ring { position: absolute; border: 2px solid rgba(102, 126, 234, 0.1); border-radius: 50%; animation: ringPulse 4s infinite; }
.ring-1 { width: 400px; height: 400px; top: -200px; left: -200px; }
.ring-2 { width: 600px; height: 600px; top: -300px; left: -300px; animation-delay: 1s; }
.ring-3 { width: 800px; height: 800px; top: -400px; left: -400px; animation-delay: 2s; }
@keyframes ringPulse { 0%, 100% { transform: scale(1); opacity: 0.3; } 50% { transform: scale(1.1); opacity: 0.1; } }

.login-container {
    position: relative; width: 100%; max-width: 440px;
    background: var(--bg-card); backdrop-filter: blur(20px);
    border: 1px solid var(--border-color); border-radius: var(--border-radius-lg);
    padding: 40px; box-shadow: var(--shadow-soft); z-index: 10;
    animation: containerEntry 0.8s ease-out;
}
@keyframes containerEntry { 0% { opacity: 0; transform: translateY(30px) scale(0.95); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
.login-container::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--primary-gradient); border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0; }

.logo-section { text-align: center; margin-bottom: 30px; }
.logo-icon { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 80px; height: 80px; background: var(--primary-gradient); border-radius: 50%; margin-bottom: 15px; font-size: 36px; color: white; box-shadow: var(--shadow-glow); }
.logo-pulse { position: absolute; width: 100%; height: 100%; border-radius: 50%; background: var(--primary-gradient); animation: logoPulse 2s infinite; z-index: -1; }
@keyframes logoPulse { 0% { transform: scale(1); opacity: 0.5; } 100% { transform: scale(1.5); opacity: 0; } }
.logo-text { font-size: 28px; font-weight: 700; background: var(--primary-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: 5px; }
.logo-tagline { font-size: 14px; color: var(--text-muted); letter-spacing: 2px; text-transform: uppercase; }

.security-badge { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; background: rgba(56, 239, 125, 0.1); border: 1px solid rgba(56, 239, 125, 0.3); border-radius: var(--border-radius-xl); margin-bottom: 30px; font-size: 12px; color: var(--success-color); }

.user-type-selector { display: flex; position: relative; background: var(--bg-input); border-radius: var(--border-radius-md); padding: 5px; margin-bottom: 25px; }
.user-type-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; background: transparent; border: none; border-radius: var(--border-radius-sm); color: var(--text-secondary); font-family: inherit; font-size: 14px; font-weight: 500; cursor: pointer; transition: var(--transition-normal); z-index: 2; }
.user-type-btn.active { color: white; }
.selector-highlight { position: absolute; top: 5px; left: 5px; width: calc(50% - 5px); height: calc(100% - 10px); background: var(--primary-gradient); border-radius: var(--border-radius-sm); transition: var(--transition-normal); z-index: 1; }
.selector-highlight.employee { left: calc(50%); }

.input-group { position: relative; margin-bottom: 20px; }
.input-icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 16px; z-index: 2; transition: var(--transition-normal); }
.input-field { width: 100%; padding: 18px 50px; background: var(--bg-input); border: 1px solid var(--border-color); border-radius: var(--border-radius-md); color: var(--text-primary); font-family: inherit; font-size: 15px; transition: var(--transition-normal); outline: none; }
.input-field:focus { border-color: var(--primary-color); background: rgba(102, 126, 234, 0.1); box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2); }
.input-field:focus + .input-label, .input-field:not(:placeholder-shown) + .input-label { transform: translateY(-38px) scale(0.85); color: var(--primary-color); background: linear-gradient(180deg, transparent 50%, rgba(10, 10, 15, 0.9) 50%); padding: 0 8px; }
.input-label { position: absolute; left: 50px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 14px; pointer-events: none; transition: var(--transition-normal); }
.input-border { position: absolute; bottom: 0; left: 50%; width: 0; height: 2px; background: var(--primary-gradient); transition: var(--transition-normal); }
.input-field:focus ~ .input-border { width: 100%; left: 0; }
.input-group:focus-within .input-icon { color: var(--primary-color); }
.input-validation { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); color: var(--success-color); opacity: 0; transition: var(--transition-normal); }
.input-group.valid .input-validation { opacity: 1; }
.input-group.valid .input-field { border-color: var(--success-color); }
.input-group.invalid .input-field { border-color: var(--danger-color); animation: inputShake 0.5s ease; }
@keyframes inputShake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

.toggle-password { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 5px; transition: var(--transition-normal); }
.toggle-password:hover { color: var(--primary-color); }

.password-strength { position: absolute; bottom: -8px; left: 0; width: 100%; height: 3px; background: var(--bg-input); border-radius: 2px; overflow: hidden; opacity: 0; transition: var(--transition-normal); }
.input-field:focus ~ .password-strength, #password:not(:placeholder-shown) ~ .password-strength { opacity: 1; }
.strength-bar { height: 100%; width: 0%; background: var(--danger-color); transition: var(--transition-normal); }
.strength-bar.weak { width: 25%; background: var(--danger-color); }
.strength-bar.fair { width: 50%; background: var(--warning-color); }
.strength-bar.good { width: 75%; background: #4fc3f7; }
.strength-bar.strong { width: 100%; background: var(--success-color); }

.security-features { display: flex; align-items: center; justify-content: space-between; margin-bottom: 25px; }
.checkbox-container { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.checkbox-container input { display: none; }
.checkmark { width: 20px; height: 20px; border: 2px solid var(--border-color); border-radius: 5px; display: flex; align-items: center; justify-content: center; transition: var(--transition-normal); }
.checkbox-container input:checked + .checkmark { background: var(--primary-gradient); border-color: transparent; }
.checkmark::after { content: '\f00c'; font-family: 'Font Awesome 6 Free'; font-weight: 900; font-size: 10px; color: white; opacity: 0; transform: scale(0); transition: var(--transition-fast); }
.checkbox-container input:checked + .checkmark::after { opacity: 1; transform: scale(1); }
.checkbox-text { font-size: 13px; color: var(--text-secondary); }
.forgot-password { font-size: 13px; color: var(--primary-color); text-decoration: none; transition: var(--transition-normal); }
.forgot-password:hover { text-decoration: underline; }

.login-btn { position: relative; width: 100%; padding: 16px 30px; background: var(--primary-gradient); border: none; border-radius: var(--border-radius-md); color: white; font-family: inherit; font-size: 16px; font-weight: 600; cursor: pointer; overflow: hidden; transition: var(--transition-normal); display: flex; align-items: center; justify-content: center; gap: 10px; }
.login-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow); }
.login-btn:active { transform: translateY(0); }
.login-btn::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: 0.5s; }
.login-btn:hover::before { left: 100%; }
.btn-icon { transition: var(--transition-normal); }
.login-btn:hover .btn-icon { transform: translateX(5px); }
.btn-loader { display: none; position: absolute; }
.login-btn.loading .btn-text, .login-btn.loading .btn-icon { opacity: 0; }
.login-btn.loading .btn-loader { display: block; }
.spinner { width: 24px; height: 24px; border: 3px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }

.error-message { display: none; align-items: center; gap: 10px; padding: 12px 16px; background: rgba(244, 92, 67, 0.1); border: 1px solid rgba(244, 92, 67, 0.3); border-radius: var(--border-radius-sm); margin-top: 15px; color: var(--danger-color); font-size: 13px; animation: errorEntry 0.3s ease; }
.error-message.show { display: flex; }
@keyframes errorEntry { 0% { opacity: 0; transform: translateY(-10px); } 100% { opacity: 1; transform: translateY(0); } }

.attempts-warning { display: none; align-items: center; gap: 10px; padding: 12px 16px; background: rgba(255, 167, 38, 0.1); border: 1px solid rgba(255, 167, 38, 0.3); border-radius: var(--border-radius-sm); margin-top: 15px; color: var(--warning-color); font-size: 13px; }
.attempts-warning.show { display: flex; }

.security-info { display: flex; justify-content: center; gap: 20px; margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--border-color); }
.security-item { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); }
.security-item i { color: var(--primary-color); }

.session-info { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 15px; font-size: 11px; color: var(--text-muted); }

.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(5px); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.modal.show { display: flex; animation: modalFade 0.3s ease; }
@keyframes modalFade { 0% { opacity: 0; } 100% { opacity: 1; } }
.modal-content { background: linear-gradient(145deg, rgba(30, 30, 50, 0.95), rgba(20, 20, 35, 0.95)); border: 1px solid var(--border-color); border-radius: var(--border-radius-lg); padding: 40px; text-align: center; max-width: 400px; width: 100%; animation: modalEntry 0.4s ease; }
@keyframes modalEntry { 0% { opacity: 0; transform: scale(0.8) translateY(20px); } 100% { opacity: 1; transform: scale(1) translateY(0); } }
.modal-icon { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 50%; font-size: 36px; margin-bottom: 20px; }
.success-icon { background: var(--success-gradient); color: white; box-shadow: var(--shadow-success); }
.danger-icon { background: var(--danger-gradient); color: white; box-shadow: var(--shadow-danger); }
.twofa-icon { background: var(--primary-gradient); color: white; box-shadow: var(--shadow-glow); }
.icon-ring { position: absolute; width: 100%; height: 100%; border-radius: 50%; animation: iconRingPulse 1.5s infinite; }
.success-icon .icon-ring { background: var(--success-gradient); }
.danger-icon .icon-ring { background: var(--danger-gradient); }
.twofa-icon .icon-ring, .twofa-ring { background: var(--primary-gradient); }
@keyframes iconRingPulse { 0% { transform: scale(1); opacity: 0.5; } 100% { transform: scale(1.5); opacity: 0; } }
.modal-title { font-size: 24px; font-weight: 600; margin-bottom: 10px; color: var(--text-primary); }
.danger-title { color: var(--danger-color); }
.modal-text { font-size: 14px; color: var(--text-secondary); margin-bottom: 20px; }

.user-info-card { display: flex; align-items: center; gap: 15px; padding: 15px 20px; background: var(--bg-input); border-radius: var(--border-radius-md); margin-bottom: 20px; }
.user-avatar { width: 50px; height: 50px; background: var(--primary-gradient); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; color: white; }
.user-avatar.admin { background: var(--primary-gradient); }
.user-avatar.employee { background: var(--secondary-gradient); }
.user-details { text-align: left; }
.user-details h3 { font-size: 16px; font-weight: 600; margin-bottom: 3px; }
.user-details p { font-size: 12px; color: var(--text-secondary); }

.redirect-info { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px; background: var(--bg-input); border-radius: var(--border-radius-sm); font-size: 13px; color: var(--text-secondary); }
.redirect-loader { width: 16px; height: 16px; border: 2px solid var(--border-color); border-top-color: var(--primary-color); border-radius: 50%; animation: spin 0.8s linear infinite; }

.lockout-timer { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 15px 25px; background: rgba(244, 92, 67, 0.1); border-radius: var(--border-radius-md); margin-bottom: 15px; font-size: 14px; color: var(--danger-color); }
.lockout-timer i { animation: timerPulse 1s infinite; }
@keyframes timerPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.contact-admin { font-size: 13px; color: var(--text-muted); }
.contact-admin a { color: var(--primary-color); text-decoration: none; }

.otp-container { display: flex; justify-content: center; gap: 10px; margin-bottom: 20px; }
.otp-input { width: 50px; height: 60px; background: var(--bg-input); border: 2px solid var(--border-color); border-radius: var(--border-radius-sm); text-align: center; font-family: inherit; font-size: 24px; font-weight: 600; color: var(--text-primary); transition: var(--transition-normal); outline: none; }
.otp-input:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2); }
.otp-input.filled { border-color: var(--success-color); background: rgba(56, 239, 125, 0.1); }
.otp-hint { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 15px; background: rgba(102, 126, 234, 0.1); border-radius: var(--border-radius-sm); margin-bottom: 20px; font-size: 12px; color: var(--primary-color); }

.verify-btn { width: 100%; padding: 14px 30px; background: var(--success-gradient); border: none; border-radius: var(--border-radius-md); color: white; font-family: inherit; font-size: 15px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; transition: var(--transition-normal); margin-bottom: 15px; }
.verify-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-success); }
.resend-code { background: none; border: none; color: var(--text-muted); font-family: inherit; font-size: 13px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: var(--transition-normal); width: 100%; }
.resend-code:hover { color: var(--primary-color); }

@media (max-width: 480px) {
    .login-container { padding: 30px 25px; }
    .logo-icon { width: 60px; height: 60px; font-size: 28px; }
    .logo-text { font-size: 24px; }
    .security-info { flex-direction: column; gap: 10px; }
    .user-type-btn { padding: 10px 15px; font-size: 13px; }
    .otp-input { width: 40px; height: 50px; font-size: 20px; }
}
