/* ===== CSS Variables ===== */
:root {
    --bg-primary: #0a0f1a;
    --bg-secondary: #0d1420;
    --bg-card: #111827;
    --bg-input: #1a2332;
    --bg-input-focus: #1e2836;
    
    --border-color: #1e3a5f;
    --border-focus: #3b82f6;
    
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-primary: #3b82f6;
    --accent-hover: #2563eb;
    --accent-glow: rgba(59, 130, 246, 0.5);
    
    --error-color: #ef4444;
    --success-color: #22c55e;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 40px rgba(59, 130, 246, 0.15);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

/* ===== Background Effects ===== */
.background-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
}

.glow-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent-primary), transparent 70%);
    top: -200px;
    right: -150px;
    animation: float 8s ease-in-out infinite;
}

.glow-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #1e40af, transparent 70%);
    bottom: -150px;
    left: -100px;
    animation: float 10s ease-in-out infinite reverse;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(30px, 20px); }
}

/* ===== Login Container ===== */
.login-container {
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}

/* ===== Login Card ===== */
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    backdrop-filter: blur(10px);
    animation: slideUp 0.5s ease-out;
}

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

/* ===== Login Header ===== */
.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-hover));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.logo svg {
    width: 32px;
    height: 32px;
    color: white;
}

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 6px;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-header .subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 400;
}

/* ===== Form Styles ===== */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

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

.input-icon {
    position: absolute;
    left: 14px;
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    pointer-events: none;
    transition: color var(--transition-fast);
}

.input-wrapper input {
    width: 100%;
    padding: 14px 14px 14px 46px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all var(--transition-fast);
    outline: none;
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
}

.input-wrapper input:hover {
    background: var(--bg-input-focus);
    border-color: #2d4a6f;
}

.input-wrapper input:focus {
    background: var(--bg-input-focus);
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input-wrapper input:focus + .input-icon,
.input-wrapper:focus-within .input-icon {
    color: var(--accent-primary);
}

/* ===== Toggle Password ===== */
.toggle-password {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-password svg {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.toggle-password:hover svg {
    color: var(--text-secondary);
}

/* ===== Form Options ===== */
.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: -4px;
}

/* Custom Checkbox */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
    user-select: none;
}

.checkbox-wrapper input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    width: 18px;
    height: 18px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    position: relative;
    transition: all var(--transition-fast);
}

.checkbox-wrapper:hover .checkmark {
    border-color: var(--accent-primary);
}

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

.checkmark::after {
    content: '';
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-wrapper input:checked ~ .checkmark::after {
    display: block;
}

/* Forgot Password Link */
.forgot-link {
    font-size: 0.875rem;
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

/* ===== Login Button ===== */
.btn-login {
    width: 100%;
    padding: 14px 24px;
    margin-top: 8px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-hover));
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

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

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

/* Loader Spinner */
.spinner {
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

.spinner circle {
    stroke-dasharray: 45;
    stroke-dashoffset: 45;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

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

@keyframes dash {
    0% { stroke-dashoffset: 45; }
    50% { stroke-dashoffset: 10; }
    100% { stroke-dashoffset: 45; }
}

/* ===== Login Footer ===== */
.login-footer {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.login-footer p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== Error Message ===== */
.error-message {
    margin-top: 16px;
    padding: 14px 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: shake 0.4s ease-in-out;
}

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

.error-message span {
    color: var(--error-color);
    font-size: 0.9rem;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* ===== Success Message ===== */
.success-message {
    margin-top: 16px;
    padding: 14px 16px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
}

.success-message svg {
    width: 20px;
    height: 20px;
    color: var(--success-color);
    flex-shrink: 0;
}

.success-message span {
    color: var(--success-color);
    font-size: 0.9rem;
}

/* ===== Responsive Design ===== */
@media (max-width: 480px) {
    .login-card {
        padding: 30px 24px;
    }
    
    .login-header h1 {
        font-size: 1.5rem;
    }
    
    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .glow-1, .glow-2 {
        opacity: 0.2;
    }
}

/* ===== Input Autofill Styles ===== */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text-primary);
    -webkit-box-shadow: 0 0 0px 1000px var(--bg-input) inset;
    transition: background-color 5000s ease-in-out 0s;
}

/* ===== Focus Visible ===== */
:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

button:focus-visible,
input:focus-visible {
    outline: none;
}

/* ===== 2FA Modal Styles ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    width: 100%;
    max-width: 420px;
    padding: 32px;
    animation: slideUp 0.3s ease;
}

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

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

.twofa-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--accent-primary), #8b5cf6);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.twofa-icon svg {
    width: 32px;
    height: 32px;
    color: white;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.modal-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.twofa-instruction {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
    line-height: 1.5;
}

.code-input-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.code-input {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    font-family: 'Inter', monospace;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.code-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.code-input.filled {
    border-color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.1);
}

.code-input.error {
    border-color: var(--error-color);
    background: rgba(239, 68, 68, 0.1);
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.code-separator {
    font-size: 1.5rem;
    color: var(--text-muted);
    font-weight: 600;
}

.twofa-error {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 16px;
    color: var(--error-color);
    font-size: 0.875rem;
}

.btn-2fa {
    width: 100%;
    margin-bottom: 12px;
}

.btn-2fa:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.backup-link {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.875rem;
    cursor: pointer;
    padding: 8px;
    text-align: center;
    transition: color var(--transition-fast);
}

.backup-link:hover {
    color: var(--accent-primary);
}

.backup-input-wrapper {
    margin-bottom: 20px;
}

.backup-input {
    width: 100%;
    padding: 16px;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1.25rem;
    font-family: 'Fira Code', 'Consolas', monospace;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 3px;
    transition: all var(--transition-fast);
}

.backup-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.backup-input::placeholder {
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: normal;
}

.modal-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.cancel-link {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.cancel-link:hover {
    color: var(--error-color);
}

.twofa-view {
    animation: fadeIn 0.2s ease;
}

/* Responsive 2FA Modal */
@media (max-width: 480px) {
    .modal-card {
        padding: 24px 20px;
    }
    
    .code-input {
        width: 40px;
        height: 48px;
        font-size: 1.25rem;
    }
    
    .code-input-container {
        gap: 6px;
    }
}
/* ===== KRASSER Loading Screen ===== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #0d1420 0%, #050810 100%);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    overflow: hidden;
}

.loading-screen.show {
    display: flex !important;
    animation: fadeInScreen 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeInScreen {
    to { opacity: 1; }
}

/* Partikel System */
.loading-bg-effects {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.loading-particle {
    position: absolute;
    background: linear-gradient(135deg, var(--accent-primary), #8b5cf6);
    border-radius: 50%;
    opacity: 0;
    animation: particleFloat 8s ease-in-out infinite;
}

@keyframes particleFloat {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        transform: translateY(-100vh) scale(1);
        opacity: 0;
    }
}

.loading-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.4;
    animation: glowPulse 4s ease-in-out infinite;
}

.loading-glow-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-primary), transparent 70%);
    top: -200px;
    right: -200px;
}

.loading-glow-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #8b5cf6, transparent 70%);
    bottom: -150px;
    left: -150px;
    animation-delay: -2s;
}

.loading-glow-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #06b6d4, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -1s;
}

@keyframes glowPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.3;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.5;
    }
}

/* Content Container */
.loading-content {
    text-align: center;
    position: relative;
    z-index: 2;
    transform: translateY(0);
    animation: contentSlideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.2s both;
}

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

/* Mega Krasser Spinner */
.loading-spinner {
    width: 140px;
    height: 140px;
    margin: 0 auto 40px;
    position: relative;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    border-radius: 50%;
    animation: spinRing 2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.spinner-ring:nth-child(1) {
    border-top-color: var(--accent-primary);
    border-right-color: var(--accent-primary);
    filter: drop-shadow(0 0 20px var(--accent-primary));
    animation-duration: 1.2s;
}

.spinner-ring:nth-child(2) {
    border-top-color: #8b5cf6;
    border-bottom-color: #8b5cf6;
    filter: drop-shadow(0 0 20px #8b5cf6);
    animation-duration: 1.8s;
    animation-delay: -0.3s;
}

.spinner-ring:nth-child(3) {
    border-left-color: #06b6d4;
    border-bottom-color: #06b6d4;
    filter: drop-shadow(0 0 20px #06b6d4);
    animation-duration: 2.4s;
    animation-delay: -0.6s;
}

@keyframes spinRing {
    0% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(180deg) scale(1.05);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

/* Center Icon mit Glow */
.loading-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, #8b5cf6 50%, #06b6d4 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: iconPulse 2s ease-in-out infinite;
    box-shadow: 
        0 0 30px rgba(59, 130, 246, 0.6),
        0 0 60px rgba(139, 92, 246, 0.4),
        inset 0 0 20px rgba(255, 255, 255, 0.2);
}

.loading-icon::before {
    content: '';
    position: absolute;
    inset: -4px;
    background: linear-gradient(135deg, var(--accent-primary), #8b5cf6, #06b6d4);
    border-radius: 18px;
    z-index: -1;
    opacity: 0;
    animation: iconGlow 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.15) rotate(180deg);
    }
}

@keyframes iconGlow {
    0%, 100% {
        opacity: 0;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.3);
    }
}

.loading-icon svg {
    width: 28px;
    height: 28px;
    color: white;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
    animation: svgFloat 3s ease-in-out infinite;
}

@keyframes svgFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

/* Text Styles */
.loading-text {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, var(--accent-primary) 50%, #8b5cf6 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
    animation: textShimmer 3s ease-in-out infinite;
}

@keyframes textShimmer {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.loading-subtext {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
    opacity: 0.8;
    animation: subtextFade 2s ease-in-out infinite;
}

@keyframes subtextFade {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.loading-dots {
    display: inline-block;
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* Progress Bar */
.loading-progress {
    width: 280px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin: 24px auto 0;
    overflow: hidden;
    position: relative;
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), #8b5cf6, #06b6d4, var(--accent-primary));
    background-size: 200% 100%;
    border-radius: 10px;
    animation: progressSlide 1.5s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

@keyframes progressSlide {
    0% {
        transform: translateX(-100%);
        background-position: 0% 0%;
    }
    100% {
        transform: translateX(100%);
        background-position: 200% 0%;
    }
}