:root {
    --bg-dark: #0a0a0f;
    --bg-card: #12121a;
    --bg-input: #1a1a24;
    --border: #2a2a3a;
    --text: #e4e4e7;
    --text-muted: #71717a;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --success: #22c55e;
    --error: #ef4444;
    --gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

*::-webkit-scrollbar {
    width: 0;
    height: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

#login-screen {
    display: none;
    place-items: center;
    min-height: 100vh;
    background: 
        radial-gradient(ellipse at top, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        var(--bg-dark);
}

#login-screen.active {
    display: grid;
}

.login-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px 28px;
    width: 90%;
    max-width: 340px;
    text-align: center;
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.4);
}

.logo {
    margin-bottom: 6px;
}

.logo h1 {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.logo-icon {
    font-size: 28px;
    display: inline-block;
    filter: drop-shadow(0 0 20px var(--accent-glow));
}

.logo-text {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-muted);
    margin-bottom: 18px;
    font-size: 11px;
}

.access-code-display {
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
    text-align: center;
}

.code-label {
    color: var(--text-muted);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.code-value {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    letter-spacing: 1px;
    margin: 0;
}

/* Info Tooltip */
.info-tooltip {
    display: inline-block;
    position: relative;
    cursor: help;
    color: var(--accent);
    font-size: 12px;
    margin-left: 4px;
    font-weight: bold;
}

.tooltip-text {
    visibility: hidden;
    opacity: 0;
    width: 260px;
    background: var(--bg-card);
    color: var(--text);
    text-align: left;
    border-radius: 8px;
    padding: 12px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    line-height: 1.5;
    text-transform: none;
    letter-spacing: normal;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: opacity 0.2s, visibility 0.2s;
    white-space: normal;
}

.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--bg-card);
}

.info-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

#login-form {
    margin-bottom: 0;
}

.hint {
    color: var(--text-muted);
    font-size: 12px;
}

header {
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    background: rgba(18, 18, 26, 0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-small {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 18px;
}

.logo-small span:first-child {
    font-size: 24px;
}

main {
    padding: 20px 24px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.form-header {
    margin-bottom: 20px;
    text-align: center;
}

.form-header h2 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 4px;
}

.form-header p {
    color: var(--text-muted);
    font-size: 13px;
}

.form-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    flex: 0 1 auto;
}

.form-header {
    margin-bottom: 20px;
    text-align: center;
}

.form-header h2 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 4px;
}

.form-header p {
    color: var(--text-muted);
    font-size: 13px;
}

/* Stepper Styles */
.stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 0;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 0 0 auto;
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.3s ease;
    margin-bottom: 4px;
    font-size: 14px;
}

.step-label {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
    transition: color 0.3s ease;
    white-space: nowrap;
}

.step-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    margin: 0 12px;
    margin-bottom: 20px;
    transition: background 0.3s ease;
}

.step.active .step-number {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    box-shadow: 0 0 20px var(--accent-glow);
}

.step.active .step-label {
    color: var(--accent);
}

.step.completed .step-number {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.step.completed .step-label {
    color: var(--text);
}

.step.completed + .step-line {
    background: var(--success);
}

/* Form Steps */
.form-step {
    display: none;
    animation: fadeIn 0.3s ease;
}

.form-step.active {
    display: block;
}

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

.step-navigation {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-top: 20px;
}

.step-navigation .btn {
    flex: 1;
}

/* Step 4 (Preview) Button Layout - Generator button larger */
.form-step[data-step="4"] .step-navigation {
    display: flex;
    align-items: stretch;
    gap: 12px;
}

.form-step[data-step="4"] .step-navigation .btn-secondary {
    flex: 0 0 auto;
    padding: 14px 20px;
    margin-top: 0;
}

.form-step[data-step="4"] .step-navigation .btn-primary {
    flex: 1;
    padding: 14px 24px;
    margin-top: 0;
    width: auto;
    font-size: 15px;
}

.field-hint {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

/* Preview Section */
.preview-section {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.preview-section h3 {
    margin-bottom: 16px;
    color: var(--text);
    font-size: 16px;
}

.preview-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.preview-item {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.preview-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.preview-item strong {
    display: block;
    margin-bottom: 6px;
    color: var(--accent);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preview-item span,
.preview-item p {
    color: var(--text);
    line-height: 1.6;
    margin: 0;
}

.preview-item p {
    margin-top: 4px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

@media (max-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .form-container {
        padding: 20px;
    }
    
    main {
        padding: 16px;
    }
    
    .login-container {
        padding: 20px 24px;
        margin: 16px;
        max-width: 300px;
    }
    
    .logo-icon {
        font-size: 24px;
    }
    
    .logo h1 {
        font-size: 20px;
    }
    
    .code-value {
        font-size: 12px;
    }
    
    .tooltip-text {
        width: 200px;
        font-size: 9px;
    }
    
    .stepper {
        padding: 0 10px;
        overflow-x: auto;
    }
    
    .step-label {
        font-size: 10px;
    }
    
    .step-number {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .step-line {
        margin: 0 6px;
    }
    
    .step-navigation {
        flex-direction: column-reverse;
    }
    
    .step-navigation .btn {
        width: 100%;
    }
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    transition: all 0.2s ease;
}

.input-group input::placeholder,
.input-group textarea::placeholder {
    color: var(--text-muted);
}

.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-group textarea {
    resize: none;
    min-height: 60px;
    max-height: 400px;
    overflow: hidden;
    line-height: 1.5;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--gradient);
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
}

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

.btn-secondary {
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
}

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

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    padding: 8px 16px;
}

.btn-ghost:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.btn-large {
    width: 100%;
    padding: 18px 24px;
    font-size: 16px;
    margin-top: 12px;
}

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

.loader {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loader.hidden {
    display: none;
}

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

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 1000;
    padding: 24px;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 5vh;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    width: 100%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 24px;
    border-top: 1px solid var(--border);
    justify-content: flex-end;
}

@media (max-width: 600px) {
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 2000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.error {
    border-color: var(--error);
}

.toast.success {
    border-color: var(--success);
}

.pdf-modal {
    max-width: 1000px;
    height: 90vh;
}

.pdf-viewer-container {
    flex: 1;
    padding: 0;
    overflow: hidden;
    display: flex;
}

.pdf-viewer {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
    border-radius: 0;
}

/* Legal Modals (Datenschutz & Impressum) */
.legal-modal {
    z-index: 10000;
}

.legal-content {
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.legal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    color: var(--text);
}

.legal-body h2 {
    color: var(--accent);
    margin-top: 24px;
    margin-bottom: 12px;
    font-size: 18px;
}

.legal-body h3 {
    color: var(--text);
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 15px;
}

.legal-body p {
    line-height: 1.7;
    margin-bottom: 14px;
}

.legal-body ul {
    padding-left: 24px;
    margin-bottom: 14px;
}

.legal-body li {
    margin-bottom: 6px;
    line-height: 1.6;
}

.legal-body a {
    color: var(--accent);
    text-decoration: none;
}

.legal-body a:hover {
    text-decoration: underline;
}

.highlight-box {
    background: rgba(99, 102, 241, 0.1);
    border-left: 3px solid var(--accent);
    padding: 16px;
    margin: 16px 0;
    border-radius: 4px;
}

.highlight-box p {
    margin: 0;
}

/* Footer */
.app-footer {
    border-top: 1px solid var(--border);
    padding: 20px 24px;
    margin-top: auto;
    background: var(--bg-card);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.footer-content p {
    margin: 0;
}

.footer-content a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-content a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

@media (max-width: 768px) {
    .pdf-modal {
        max-width: 100%;
        height: 95vh;
        border-radius: 12px;
        margin: 10px;
    }
    
    .legal-content {
        max-width: 95%;
        max-height: 90vh;
        margin: 20px;
        border-radius: 12px;
    }
    
    .legal-body {
        padding: 20px;
        font-size: 14px;
    }
    
    .legal-body h2 {
        font-size: 16px;
    }
    
    .legal-body h3 {
        font-size: 14px;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 8px;
        font-size: 11px;
    }
}
