/* Login Page Styles */
:root {
    --primary-text: #1d1d1f;
    --secondary-text: #86868b;
    --border-color: #d2d2d7;
    --input-border: #d2d2d7;
    --input-border-focus: rgb(42, 82, 152);
    --button-primary: rgb(42, 82, 152);
    --button-primary-hover: rgb(32, 72, 142);
    --background-white: #fff;
    --background-light: #f5f5f7;
    --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.1);
    --font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
    
    /* Zusätzliche Akzentfarben für bessere Unterstützung */
    --accent-color: rgb(42, 82, 152);
    --accent-color-hover: rgb(32, 72, 142);
    --accent-color-light: rgba(42, 82, 152, 0.1);
    --accent-color-focus: rgba(42, 82, 152, 0.15);
}

/* Globale Akzentfarben für alle interaktiven Elemente */
*:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Für bessere Browser-Kompatibilität */
*:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Entferne Standard-Fokus-Outline für benutzerdefinierte Stile */
*:focus:not(:focus-visible) {
    outline: none;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
    -webkit-font-smoothing: antialiased;
    background-color: #fff;
}

.login-main {
    background-color: var(--background-white);
    min-height: 100vh;
    padding: 40px 20px;
    font-family: var(--font-family);
    font-size: 17px;
    font-weight: 400;
}

.login-main * {
    font-size: 17px;
    font-weight: 400;
}

.login-container {
    max-width: 540px;
    margin: 0 auto;
    background-color: var(--background-white);
}

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

.login-header h1 {
    font-size: 48px !important;
    font-weight: 600 !important;
    line-height: 1.08;
    color: var(--primary-text);
    margin: 0 0 24px 0;
    letter-spacing: -0.003em;
}

.login-subtitle {
    font-size: 17px;
    line-height: 1.38;
    color: var(--primary-text);
    margin: 0 0 24px 0;
    font-weight: 400;
}

.register-link {
    font-size: 17px;
    line-height: 1.47;
    color: var(--primary-text);
    margin: 0;
}

.register-link a {
    color: var(--button-primary);
    text-decoration: none;
}

.register-link a:hover {
    text-decoration: underline;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-group {
    position: relative;
}

.form-label {
    display: block;
    font-size: 17px;
    font-weight: 400;
    color: var(--primary-text);
    margin-bottom: 8px;
    line-height: 1.47;
}

.form-input {
    width: 100%;
    padding: 16px;
    font-size: 17px;
    line-height: 1.47;
    border: 1px solid var(--input-border);
    border-radius: 50px;
    background-color: var(--background-white);
    color: var(--primary-text);
    font-family: var(--font-family);
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 4px var(--accent-color-focus);
}

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

.checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 17px;
    line-height: 1.47;
    color: var(--primary-text);
}

.checkbox-label input[type="checkbox"] {
    margin-right: 12px;
    margin-top: 2px;
    width: 16px;
    height: 16px;
    accent-color: var(--accent-color) !important;
    flex-shrink: 0;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"]:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.checkbox-text {
    flex: 1;
}

.login-button {
    background-color: var(--button-primary);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 16px 24px;
    font-size: 17px;
    font-weight: 400;
    font-family: var(--font-family);
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-top: 8px;
}

.login-button:hover {
    background-color: var(--button-primary-hover);
}

.login-button:active {
    transform: translateY(1px);
}

.login-button:disabled {
    background-color: var(--secondary-text);
    cursor: not-allowed;
    opacity: 0.6;
}

.login-button:disabled:hover {
    background-color: var(--secondary-text);
    transform: none;
}

.login-options {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.forgot-password-link {
    text-decoration: none;
    font-size: 17px;
    font-weight: 400;
    line-height: 1.47;
    background-color: transparent;
    color: var(--button-primary);
    border: 1px solid var(--button-primary);
    border-radius: 50px;
    padding: 12px 24px;
    transition: all 0.2s ease;
}

.forgot-password-link:hover {
    background-color: var(--button-primary);
    color: white;
}

.create-account-link {
    text-decoration: none;
    font-size: 17px;
    font-weight: 500;
    line-height: 1.47;
    background-color: var(--button-primary);
    color: white;
    border: 1px solid var(--button-primary);
    border-radius: 50px;
    padding: 12px 24px;
    transition: all 0.2s ease;
}

.create-account-link:hover {
    background-color: var(--button-primary-hover);
    border-color: var(--button-primary-hover);
}

.privacy-section {
    text-align: center;
    margin: 32px 0;
    padding: 24px;
}

.privacy-icon {
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.privacy-text {
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    color: #6e6e73;
    margin: 0;
    text-align: center;
}

.privacy-link {
    color: var(--button-primary);
    text-decoration: none;
    font-size: 12px;
    font-weight: 400;
}

.privacy-link:hover {
    text-decoration: underline;
}

/* Field validation styles */
.form-input.error {
    border-color: #d70015;
    box-shadow: 0 0 0 4px rgba(215, 0, 21, 0.15);
}

.field-error {
    color: #d70015;
    font-size: 14px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.43;
}

.field-error::before {
    content: "!";
    font-size: 10px;
    font-weight: 700;
    background: #ff3b30;
    color: white;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Loading state */
.login-button.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.login-button.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Mobile Responsive */
@media (max-width: 768px) {
    .login-main {
        padding: 20px 16px;
    }
    
    .login-header h1 {
        font-size: 32px !important;
    }
    
    .login-subtitle {
        font-size: 17px;
    }
}

@media (max-width: 480px) {
    .login-header h1 {
        font-size: 28px !important;
    }
    
    .login-subtitle {
        font-size: 17px;
    }
    
    .form-input {
        font-size: 17px;
        padding: 14px;
    }
    
    .login-button {
        font-size: 17px;
        padding: 14px 20px;
    }
}

/* ============================================
   QR Code / App Login
   ============================================ */

/* Divider */
.login-divider {
    display: flex;
    align-items: center;
    margin: 32px 0;
    gap: 16px;
}

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

.login-divider span {
    color: var(--secondary-text);
    font-size: 14px;
    font-weight: 500;
}

/* App Login Button */
.app-login-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 24px;
    background: var(--background-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 17px;
    font-weight: 500;
    color: var(--primary-text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.app-login-button:hover {
    background: #eaeaec;
    border-color: #c2c2c7;
}

.app-login-button:active {
    transform: scale(0.98);
}

.app-login-button svg {
    flex-shrink: 0;
}

/* Beta Badge */
.beta-badge {
    display: inline-block;
    background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 8px;
    vertical-align: middle;
}

.qr-modal-header h2 .beta-badge {
    font-size: 11px;
    padding: 4px 10px;
    position: relative;
    top: -2px;
}

/* QR Modal Overlay */
.qr-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

/* QR Modal */
.qr-login-modal {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 420px;
    position: relative;
    transform: scale(0.95);
    opacity: 0;
    transition: all 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.qr-modal-overlay.active .qr-login-modal {
    transform: scale(1);
    opacity: 1;
}

/* Close Button */
.qr-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.06);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    z-index: 10;
}

.qr-modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.qr-modal-close svg {
    color: var(--primary-text);
}

/* Modal Content */
.qr-modal-content {
    padding: 40px 32px 32px;
}

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

.qr-modal-header h2 {
    font-size: 28px;
    font-weight: 600;
    color: var(--primary-text);
    margin: 0 0 8px 0;
}

.qr-modal-header p {
    font-size: 16px;
    color: var(--secondary-text);
    margin: 0;
}

/* QR Code Container */
.qr-code-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    background: var(--background-light);
    border-radius: 16px;
    margin-bottom: 24px;
    position: relative;
}

.qr-code-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--secondary-text);
    font-size: 14px;
}

.qr-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e5e7;
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

#qrCodeElement {
    display: none;
    border-radius: 8px;
    overflow: hidden;
}

#qrCodeElement.visible {
    display: block;
}

#qrCodeElement img {
    display: block;
}

/* Session Code */
.qr-session-code {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
}

.code-label {
    font-size: 13px;
    color: var(--secondary-text);
}

.code-value {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 8px;
    color: var(--primary-text);
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

/* Status */
.qr-status {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.qr-status-pending,
.qr-status-success {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 500;
}

.qr-status-pending {
    color: var(--secondary-text);
}

.qr-status-success {
    color: #34C759;
}

.qr-status-success svg {
    stroke: #34C759;
}

.pulse-dot {
    width: 10px;
    height: 10px;
    background: var(--accent-color);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* Timer */
.qr-timer {
    text-align: center;
    font-size: 14px;
    color: var(--secondary-text);
    margin-bottom: 32px;
}

#qrTimerValue {
    font-weight: 600;
    color: var(--primary-text);
}

.qr-timer.expiring #qrTimerValue {
    color: #FF3B30;
}

/* Instructions */
.qr-instructions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    background: var(--background-light);
    border-radius: 12px;
}

.instruction-step {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--primary-text);
}

.step-number {
    width: 24px;
    height: 24px;
    background: var(--accent-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

/* Responsive */
@media (max-width: 480px) {
    .qr-modal-content {
        padding: 32px 24px 24px;
    }
    
    .qr-modal-header h2 {
        font-size: 24px;
    }
    
    .code-value {
        font-size: 28px;
        letter-spacing: 6px;
    }
    
    .qr-code-container {
        min-height: 200px;
    }
}

/* ============================================
   Dark Mode - Login Page
   ============================================ */

@media (prefers-color-scheme: dark) {
    :root {
        --primary-text: #ffffff;
        --secondary-text: #8e8e93;
        --border-color: rgba(255, 255, 255, 0.1);
        --input-border: rgba(255, 255, 255, 0.15);
        --input-border-focus: rgb(60, 100, 170);
        --background-white: #000000;
        --background-light: #1c1c1e;
        --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.3);
    }
    
    body {
        background-color: #000000;
        color: var(--primary-text);
    }
    
    .login-main {
        background-color: #000000;
    }
    
    .login-container {
        background: transparent;
    }
    
    .login-header h1 {
        color: var(--primary-text);
    }
    
    .login-subtitle {
        color: var(--secondary-text);
    }
    
    .register-link {
        color: var(--secondary-text);
    }
    
    .register-link a {
        color: var(--accent-color);
    }
    
    .form-input {
        background: #1c1c1e;
        border-color: var(--input-border);
        color: var(--primary-text);
    }
    
    .form-input:focus {
        border-color: var(--input-border-focus);
        background: #2c2c2e;
    }
    
    .form-input::placeholder {
        color: #636366;
    }
    
    .checkbox-text {
        color: var(--secondary-text);
    }
    
    .login-options a {
        color: var(--secondary-text);
    }
    
    .login-options a:hover {
        color: var(--primary-text);
    }
    
    /* App Login Button Dark Mode */
    .app-login-button {
        background: #1c1c1e;
        border-color: rgba(255, 255, 255, 0.1);
        color: var(--primary-text);
    }
    
    .app-login-button:hover {
        background: #2c2c2e;
        border-color: rgba(255, 255, 255, 0.15);
    }
    
    .login-divider span {
        color: var(--secondary-text);
    }
    
    .login-divider::before,
    .login-divider::after {
        background: rgba(255, 255, 255, 0.1);
    }
    
    /* QR Modal Dark Mode */
    .qr-modal-overlay {
        background: rgba(0, 0, 0, 0.7);
    }
    
    .qr-login-modal {
        background: #1c1c1e;
    }
    
    .qr-modal-close {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .qr-modal-close:hover {
        background: rgba(255, 255, 255, 0.15);
    }
    
    .qr-modal-close svg {
        color: var(--primary-text);
    }
    
    .qr-modal-header h2 {
        color: var(--primary-text);
    }
    
    .qr-modal-header p {
        color: var(--secondary-text);
    }
    
    .qr-code-container {
        background: #2c2c2e;
    }
    
    .qr-code-loading {
        color: var(--secondary-text);
    }
    
    .qr-spinner {
        border-color: #48484a;
        border-top-color: var(--accent-color);
    }
    
    .code-label {
        color: var(--secondary-text);
    }
    
    .code-value {
        color: var(--primary-text);
    }
    
    .qr-status-pending {
        color: var(--secondary-text);
    }
    
    .qr-timer {
        color: var(--secondary-text);
    }
    
    #qrTimerValue {
        color: var(--primary-text);
    }
    
    .qr-instructions {
        background: #2c2c2e;
    }
    
    .instruction-step {
        color: var(--primary-text);
    }
    
    /* Navbar Dark Mode */
    .secondary-nav {
        background: rgba(0, 0, 0, 0.8);
        backdrop-filter: blur(20px);
    }
    
    .nav-capsule {
        background: rgba(255, 255, 255, 0.08);
    }
    
    .nav-link {
        color: var(--secondary-text);
    }
    
    .nav-link:hover {
        color: var(--primary-text);
    }
    
    .nav-link.active {
        color: var(--primary-text);
    }
    
    .capsule-dropdown-content {
        background: #2c2c2e;
    }
    
    .capsule-dropdown-item {
        color: var(--secondary-text);
    }
    
    .capsule-dropdown-item:hover {
        background: rgba(255, 255, 255, 0.08);
        color: var(--primary-text);
    }
    
    .capsule-dropdown-item.active {
        color: var(--primary-text);
    }
}