/**
 * KISpro Login-System - Clean Design mit Dark Mode
 */

:root {
    /* SaaS Blue Colors */
    --color-primary: #2563EB;        /* Dunkleres SaaS Blue (vorher Hover) */
    --color-primary-dark: #1D4ED8;   /* Noch dunkleres Blau für Hover */
    --color-primary-light: #60A5FA;  /* Helleres Blau für Dark Mode */
    
    /* Light Mode */
    --color-text: #1F2937;
    --color-text-secondary: #6B7280;
    --color-border: #E5E7EB;
    --color-bg: #FFFFFF;
    --color-bg-secondary: #F9FAFB;
    
    /* Effects */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --radius: 8px;
}

/* Dark Mode (System-Präferenz) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --color-primary: #60A5FA;
        --color-primary-dark: #3B82F6;
        --color-text: #FFFFFF;
        --color-text-secondary: #9CA3AF;
        --color-border: #374151;
        --color-bg: #1F2937;
        --color-bg-secondary: #111827;
    }
}

/* Dark Mode (Manuell aktiviert) */
:root[data-theme="dark"] {
    --color-primary: #60A5FA;
    --color-primary-dark: #3B82F6;
    --color-text: #FFFFFF;
    --color-text-secondary: #9CA3AF;
    --color-border: #374151;
    --color-bg: #1F2937;
    --color-bg-secondary: #111827;
}

/* Light Mode (Manuell aktiviert, überschreibt System-Dark) */
:root[data-theme="light"] {
    --color-primary: #2563EB;
    --color-primary-dark: #1D4ED8;
    --color-text: #1F2937;
    --color-text-secondary: #6B7280;
    --color-border: #E5E7EB;
    --color-bg: #FFFFFF;
    --color-bg-secondary: #F9FAFB;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg-secondary);
    -webkit-font-smoothing: antialiased;
}

.auth-container {
    display: flex;
    min-height: 100vh;
    background: var(--color-bg-secondary);
}

/* Hero nur Desktop */
.auth-hero {
    display: none;
}

@media (min-width: 1024px) {
    .auth-hero {
        display: block;
        flex: 1;
        background-image: url('/img/hero-bg.jpg');
        background-size: cover;
        background-position: center;
        position: relative;
        border-top-right-radius: 20px;
        border-bottom-right-radius: 20px;
        overflow: hidden;
    }
    
    .auth-hero::before {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(135deg, rgba(81, 78, 156, 0.4) 0%, rgba(106, 191, 163, 0.3) 100%);
    }
}

.auth-form-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    background: transparent;
}

.auth-form-wrapper {
    width: 100%;
    max-width: 420px;
}

/* Logo */
.auth-form-logo {
    text-align: center;
    margin-bottom: 48px;
}

.form-logo {
    max-width: 180px;
    height: auto;
}

/* Heading */
.auth-form-wrapper h2 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--color-text);
}

/* Tabs */
.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--color-border);
}

.auth-tab {
    flex: 1;
    padding: 12px 0;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 15px;
    font-weight: 400;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: -1px;
}

.auth-tab:hover {
    color: var(--color-text);
}

.auth-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: 500;
}

/* Form */
.auth-form {
    margin-bottom: 24px;
}

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

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

.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg);
    color: var(--color-text);
    transition: all 0.2s ease;
}

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

.form-group input::placeholder {
    color: var(--color-text-secondary);
}

/* Password Toggle */
.password-input-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--color-text-secondary);
    transition: color 0.2s ease;
}

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

/* Checkbox */
.form-group-checkbox {
    margin-bottom: 24px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: var(--color-text);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
    accent-color: var(--color-primary);
}

/* Button */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

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

.btn-block {
    width: 100%;
}

.btn-spinner {
    margin-left: 8px;
}

.spinner {
    animation: spin 1s linear infinite;
}

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

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
}

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

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

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    color: #2563EB;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Error & Success Messages */
.error-message {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
    background: rgba(239, 68, 68, 0.1);
    color: #DC2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.success-message {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
    background: rgba(34, 197, 94, 0.1);
    color: #16A34A;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

/* Auth Card (für einfache Seiten wie Password Reset) */
.auth-card {
    width: 100%;
    max-width: 420px;
    margin: 3rem auto;
    padding: 48px 32px;
    background: var(--color-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.auth-card .btn-primary {
    margin-left: auto;
    display: block;
    width: auto;
    min-width: 180px;
}

.auth-logo {
    max-width: 180px;
    height: auto;
    display: block;
    margin: 0 auto 32px;
}

.auth-card h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--color-text);
    text-align: center;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--color-text-secondary);
    text-align: center;
    margin-bottom: 32px;
}

/* Links */
.auth-links {
    text-align: center;
    margin-top: 24px;
}

.auth-links a {
    font-size: 14px;
    color: var(--color-primary);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.auth-links a:hover {
    opacity: 0.8;
}

/* Footer */
.auth-footer {
    text-align: center;
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
}

.auth-footer a {
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-footer a:hover {
    color: var(--color-primary);
}

.separator {
    margin: 0 8px;
}

/* Password Strength */
.password-strength {
    margin-top: 8px;
}

.password-strength-bar {
    height: 3px;
    background: var(--color-border);
    border-radius: 2px;
    overflow: hidden;
}

.password-strength-fill {
    height: 100%;
    width: 0;
    transition: all 0.3s ease;
}

.password-strength-fill.weak {
    width: 33%;
    background: #EF4444;
}

.password-strength-fill.medium {
    width: 66%;
    background: #F59E0B;
}

.password-strength-fill.strong {
    width: 100%;
    background: var(--color-primary);
}

.password-strength-text {
    font-size: 12px;
    margin-top: 4px;
    color: var(--color-text-secondary);
}

/* Password Requirements */
.password-requirements {
    background: var(--color-bg-secondary);
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.password-requirements strong {
    color: var(--color-text);
    display: block;
    margin-bottom: 0.5rem;
}

.password-requirements ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.password-requirements li {
    margin-bottom: 0.25rem;
    color: var(--color-text-secondary);
    padding-left: 1.5rem;
    position: relative;
}

.password-requirements li::before {
    content: '○';
    position: absolute;
    left: 0;
}

.password-requirements li.valid {
    color: #16A34A;
}

.password-requirements li.valid::before {
    content: '✓';
    font-weight: bold;
}

/* Dark Mode Toggle (Debug) */
.dark-mode-toggle {
    position: fixed;
    bottom: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
    z-index: 9999;
}

.dark-mode-toggle:hover {
    background: var(--color-bg-secondary);
    color: var(--color-primary);
    transform: scale(1.1);
}

/* Success Animation */
.success-overlay {
    position: fixed;
    inset: 0;
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.success-overlay.active {
    opacity: 1;
}

.success-content {
    text-align: center;
    animation: fadeInUp 0.6s ease;
}

.success-logo {
    width: 120px;
    height: 120px;
    margin: 0 auto 2rem;
    display: block;
    animation: pulse 2s ease-in-out infinite;
}

.success-greeting {
    font-size: 2rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
    animation: fadeIn 0.8s ease 0.3s both;
}

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

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

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

/* 2FA Code Input - 6 einzelne Felder */
.code-inputs-container {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 2rem 0;
}

.code-inputs-container .code-input-single {
    width: 56px;
    height: 64px;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg);
    color: var(--color-text);
    transition: all 0.2s ease;
    padding: 0;
}

.code-inputs-container .code-input-single:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    transform: scale(1.05);
}

.code-inputs-container .code-input-single.filled {
    border-color: var(--color-primary);
    background: rgba(59, 130, 246, 0.05);
}

/* Separator nach 3. Feld */
.code-inputs-container .code-input-single:nth-child(3) {
    margin-right: 8px;
}

/* Responsive Code Inputs */
@media (max-width: 640px) {
    .code-inputs-container .code-input-single {
        width: 48px;
        height: 56px;
        font-size: 20px;
    }
    
    .code-inputs-container {
        gap: 6px;
    }
    
    .code-inputs-container .code-input-single:nth-child(3) {
        margin-right: 6px;
    }
}

/* Responsive */
@media (max-width: 640px) {
    .success-logo {
        width: 100px;
        height: 100px;
        margin-bottom: 1.5rem;
    }
    
    .success-greeting {
        font-size: 1.5rem;
    }
    .auth-form-container {
        padding: 32px 20px;
    }
    
    .auth-form-logo {
        margin-bottom: 32px;
    }
    
    .form-logo {
        max-width: 140px;
    }
    
    .auth-form-wrapper h2 {
        font-size: 24px;
    }
    
    .dark-mode-toggle {
        bottom: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
    }
}
