/* css/auth.css */
:root {
    --auth-bg-color: #111827; /* Tailwind bg-gray-900 */
    --auth-text-primary: #e5e7eb; /* Tailwind text-gray-200 / zinc-200 */
    --auth-text-secondary: #9ca3af; /* Tailwind text-gray-400 / zinc-400 */
    --auth-text-muted: #6b7280;   /* Tailwind text-gray-500 / zinc-500 */
    
    --auth-accent-color: #818cf8; /* Tailwind indigo-400 */
    --auth-accent-hover-color: #6366f1; /* Tailwind indigo-500 or 600 */
    --auth-accent-glow-color: rgba(129, 140, 248, 0.4);
    --auth-accent-glow-color-input: rgba(129, 140, 248, 0.25);

    /* Glas-Effekt Variablen */
    --auth-card-bg: rgba(31, 41, 55, 0.6); 
    --auth-card-bg-hover: rgba(31, 41, 55, 0.75);
    --auth-card-border: rgba(255, 255, 255, 0.08);
    --auth-card-shadow: 0 10px 35px 0 rgba(0, 0, 0, 0.35);
    --auth-glass-blur: blur(16px);

    --auth-input-bg: rgba(55, 65, 81, 0.7); 
    --auth-input-border: rgba(107, 114, 128, 0.5); 
    --auth-input-focus-border: var(--auth-accent-color);

    --auth-success-color: #4ade80; /* Tailwind green-400 */
    --auth-warning-color: #facc15; /* Tailwind yellow-400 */
    --auth-danger-color: #f87171;  /* Tailwind red-400 */

    --font-family-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";

    /* Modal Variablen */
    --auth-modal-overlay-bg: rgba(0, 0, 0, 0.8);
    --auth-modal-content-bg: var(--auth-card-bg); 
    --auth-modal-content-border: var(--auth-card-border);
    --auth-modal-content-shadow: 0 10px 35px rgba(0, 0, 0, 0.5);
    --auth-modal-header-border: rgba(107, 114, 128, 0.3);

    /* Dynamische Höhen für Header/Footer - BITTE ANPASSEN! */
    --header-height: 4.5rem;
    --footer-height: 4rem; 
}

/* Sternenhimmel Hintergrundanimation */
@keyframes moveStars {
    from { background-position-y: 0px; }
    to { background-position-y: -10000px; }
}

.auth-body {
    font-family: var(--font-family-sans);
    background-color: var(--auth-bg-color);
    color: var(--auth-text-primary);
    background-image:
        radial-gradient(1px 1px at 50px 150px, rgba(255,255,255,0.5), rgba(255,255,255,0)),
        radial-gradient(1px 1px at 100px 250px, rgba(220,220,220,0.4), rgba(255,255,255,0)),
        radial-gradient(1.5px 1.5px at 200px 50px, rgba(238,238,238,0.45), rgba(255,255,255,0)),
        radial-gradient(2px 2px at 300px 300px, rgba(255,255,255,0.5), rgba(255,255,255,0)),
        radial-gradient(1.5px 1.5px at 450px 100px, rgba(220,220,220,0.4), rgba(255,255,255,0)),
        radial-gradient(2.5px 2.5px at 600px 400px, rgba(255,255,255,0.45), rgba(255,255,255,0));
    background-repeat: repeat;
    background-size: 
        300px 300px, 400px 400px, 
        350px 350px, 500px 500px, 
        600px 600px, 800px 800px;
    animation:
         moveStars 200s linear infinite, moveStars 200s linear infinite,
         moveStars 150s linear infinite alternate, moveStars 150s linear infinite alternate,
         moveStars 100s linear infinite, moveStars 120s linear infinite;
    background-attachment: fixed;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.auth-main-container {
    flex-grow: 1; 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: var(--header-height);
    padding-bottom: var(--footer-height); 
    width: 100%;
    box-sizing: border-box;
    padding-left: 1rem; 
    padding-right: 1rem; 
}

/* Genereller .glass-effect */
.glass-effect {
    background-color: var(--auth-card-bg);
    backdrop-filter: var(--auth-glass-blur);
    -webkit-backdrop-filter: var(--auth-glass-blur);
    border: 1px solid var(--auth-card-border);
    border-radius: 0.75rem; 
    box-shadow: var(--auth-card-shadow), 
                inset 0 1px 1px rgba(255, 255, 255, 0.05); 
    transition: background-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease-out;
}
.glass-effect:hover {
    background-color: var(--auth-card-bg-hover);
    box-shadow: 0 14px 45px rgba(0,0,0,0.40),
                inset 0 1px 1px rgba(255, 255, 255, 0.05);
}

/* Fixed Header */
.fixed-glass-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    z-index: 40;
    background-color: var(--auth-card-bg);
    backdrop-filter: var(--auth-glass-blur);
    -webkit-backdrop-filter: var(--auth-glass-blur);
    border-bottom: 1px solid var(--auth-card-border);
    box-shadow: var(--auth-card-shadow);
    display: flex;
    align-items: center;
    padding: 0 1.5rem; 
    box-sizing: border-box;
}
.fixed-glass-header .header-content-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
}
.fixed-glass-header .logo-area a {
    color: var(--auth-text-primary);
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}
.fixed-glass-header .logo-area a:hover {
    color: var(--auth-accent-color);
}
.fixed-glass-header .auth-nav .btn-header-auth {
    background-color: transparent;
    color: var(--auth-text-secondary);
    border: 1px solid var(--auth-input-border);
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    margin-left: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    font-weight: 500;
    font-size: 0.875rem;
}
.fixed-glass-header .auth-nav .btn-header-auth:hover {
    background-color: var(--auth-accent-color);
    color: white;
    border-color: var(--auth-accent-color);
    box-shadow: 0 0 10px 2px var(--auth-accent-glow-color-input);
}

/* Fixed Footer */
.fixed-glass-footer {
    position: fixed;
    bottom: 0; 
    left: 0;
    width: 100%;
    height: var(--footer-height);
    z-index: 40; 
    background-color: var(--auth-card-bg);
    backdrop-filter: var(--auth-glass-blur);
    -webkit-backdrop-filter: var(--auth-glass-blur);
    border-top: 1px solid var(--auth-card-border);
    box-shadow: 0 -5px 20px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    box-sizing: border-box;
    color: var(--auth-text-muted);
}
.fixed-glass-footer .changelog-link {
    background: none;
    border: none;
    color: var(--auth-text-secondary);
    text-decoration: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    transition: color 0.2s ease, text-decoration 0.2s ease;
    border-radius: 0.25rem;
    margin-bottom: 0.25rem;
}
.fixed-glass-footer .changelog-link:hover {
    color: var(--auth-accent-color);
    text-decoration: underline;
}
.fixed-glass-footer .copyright-text {
    font-size: 0.75rem;
    color: var(--auth-text-muted);
}

/* Modal Basis-Stile */
.modal-overlay {
    background-color: var(--auth-modal-overlay-bg);
    position: fixed;
    inset: 0;
    z-index: 50; 
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
    padding: 1rem; 
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.modal-content {
    background-color: var(--auth-modal-content-bg);
    backdrop-filter: var(--auth-glass-blur);
    -webkit-backdrop-filter: var(--auth-glass-blur);
    border: 1px solid var(--auth-modal-content-border);
    box-shadow: var(--auth-modal-content-shadow);
    border-radius: 0.5rem;
    display: flex; /* Wichtig für Flex-Kinder wie .modal-body / .changelog-body */
    flex-direction: column; /* Wichtig für Flex-Kinder wie .modal-body / .changelog-body */
    text-align: left;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    opacity: 0;
    width: 100%; 
}
.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--auth-modal-header-border);
    flex-shrink: 0; /* Verhindert, dass der Header schrumpft, wenn der Body-Inhalt groß ist */
}
.modal-header-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.modal-header-controls a,
.modal-header-controls button,
.modal-header > button { 
    color: var(--auth-text-secondary);
    transition: color 0.2s ease;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 1.75rem; 
    line-height: 1;
}
.modal-header-controls a:hover,
.modal-header-controls button:hover,
.modal-header > button:hover {
    color: var(--auth-accent-color);
}
.modal-header-controls svg { 
    width: 1.5rem; 
    height: 1.5rem;
}

/* Generische .modal-body (für Auth Modal) und spezifische .changelog-body Anpassung */
.modal-body, 
#login-changelog-modal-content .changelog-body {
    margin-top: 1rem;
    flex-grow: 1;     /* Erlaubt dem Body, den verfügbaren Platz im Flex-Container (.modal-content) einzunehmen */
    overflow-y: auto; /* Aktiviert vertikales Scrollen, wenn der Inhalt die Höhe übersteigt */
    min-height: 0;    /* Wichtig für Flexbox, um korrekte Größenberechnung bei Overflow zu ermöglichen */
    padding-right: 0.75rem; /* Etwas mehr Platz für die Scrollbar, falls sie breiter ist */
    padding-left: 0.1rem; /* Minimaler linker Abstand */
    color: var(--auth-text-primary);
}


/* Spezifische Modal-Content Größen und Stile */
#auth-form-modal-content {
    max-width: 28rem;
    max-height: 90vh;
    padding: 1.5rem;
}

#login-changelog-modal-content {
    max-width: 42rem;
    max-height: 80vh; /* .modal-content hat display:flex, flex-direction:column. max-height hier ist entscheidend */
    padding: 1.5rem;
}
/* Stile für Inhalte IN .changelog-body */
#login-changelog-modal-content .changelog-body h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--auth-accent-color);
    margin-bottom: 0.5rem;
    margin-top: 0.75rem; 
}
#login-changelog-modal-content .changelog-body h4:first-child {
    margin-top: 0;
}
#login-changelog-modal-content .changelog-body ul {
    list-style: disc;
    list-style-position: inside; /* oder outside mit zusätzlichem Padding */
    margin-bottom: 0.75rem;
    padding-left: 0.5rem; /* leichter Einzug für list-style-position: inside */
    font-size: 0.875rem; 
    color: var(--auth-text-secondary); 
    line-height: 1.6; /* Bessere Lesbarkeit für längere Listeneinträge */
}
#login-changelog-modal-content .changelog-body li {
    margin-bottom: 0.25rem; /* Abstand zwischen Listenelementen */
}
#login-changelog-modal-content .changelog-body li strong {
    color: var(--auth-text-primary); 
}


/* Formular-Styling */
.auth-form { display: none; }
.auth-form.active { display: block; }
.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--auth-text-secondary);
    text-align: left;
    font-size: 0.875rem;
}
.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--auth-input-border);
    border-radius: 0.5rem;
    background-color: var(--auth-input-bg);
    color: var(--auth-text-primary);
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    font-size: 0.9375rem;
}
.form-input:hover:not(:focus) {
    border-color: rgba(129, 140, 248, 0.5); 
    box-shadow: 0 0 8px 2px var(--auth-accent-glow-color-input);
}
.form-input:focus {
    outline: none;
    border-color: var(--auth-input-focus-border);
    box-shadow: 0 0 0 3px var(--auth-accent-glow-color); 
}
input[type="checkbox"].w-4.h-4 { 
    border-radius: 0.25rem;
    border-color: var(--auth-input-border);
    background-color: var(--auth-input-bg);
    color: var(--auth-accent-color); 
}
input[type="checkbox"].w-4.h-4:checked {
    background-color: var(--auth-accent-color);
    border-color: var(--auth-accent-color);
}

/* Buttons */
.btn {
    padding: 0.75rem 1rem;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, transform 0.15s ease-in-out, box-shadow 0.25s ease-in-out;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    line-height: 1.5; 
    display: inline-flex; 
    align-items: center;
    justify-content: center;
}
.btn.w-full { width: 100%; }

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px var(--auth-accent-glow-color), 
                0 4px 6px -4px rgba(0,0,0,0.1);
}
.btn:focus-visible:not(:disabled) {
    outline: 2px solid var(--auth-accent-color);
    outline-offset: 2px;
}
.btn:active:not(:disabled) {
    transform: translateY(-1px);
}
.btn:disabled {
    background-color: var(--auth-text-muted) !important; 
    opacity: 0.7;
    cursor: not-allowed;
    transform: translateY(0);
    box-shadow: none;
}

.btn-primary { 
    background-color: var(--auth-accent-color);
}
.btn-primary:hover:not(:disabled) {
    background-color: var(--auth-accent-hover-color);
}
.btn-secondary { 
    background-color: transparent;
    color: var(--auth-text-secondary);
    border: 1px solid var(--auth-input-border);
}
.btn-secondary:hover:not(:disabled) {
    border-color: var(--auth-accent-color);
    color: var(--auth-accent-color);
    background-color: rgba(129, 140, 248, 0.1);
}

.toggle-auth-form {
    color: var(--auth-accent-color);
    transition: color 0.2s ease-in-out;
    font-weight: 500;
}
.toggle-auth-form:hover {
    color: var(--auth-accent-hover-color);
    text-decoration: underline;
}
.auth-error-message {
    color: var(--auth-danger-color);
    font-weight: 500;
}

/* Welcome Box */
#welcome-section {
    width: 100%; 
    max-width: 56rem;  
    max-height: calc(100vh - var(--header-height) - var(--footer-height) - 4rem); /* 2rem margin top, 2rem margin bottom = 4rem */
    overflow-y: auto;
    padding: 1.5rem; 
    margin: 2rem 0; /* Vertikaler Abstand, wenn nicht durch justify-content: center im Main-Container zentriert */
    box-sizing: border-box;
}
#welcome-section h1 {
    color: var(--auth-text-primary);
}
#welcome-section .prose {
    font-size: 0.9375rem; 
}
#welcome-section .prose strong {
    color: var(--auth-text-primary);
}
#welcome-section .prose ul > li::marker {
    color: var(--auth-accent-color);
}
#welcome-section .prose a {
    color: var(--auth-accent-color);
    text-decoration: none; 
}
#welcome-section .prose a:hover {
    color: var(--auth-accent-hover-color);
    text-decoration: underline;
}
#welcome-section .not-prose .btn { 
    margin-top: 0.5rem; 
}

/* Toast Container & Toasts */
.toast-container {
    position: fixed;
    bottom: calc(var(--footer-height) + 1rem); 
    right: 1rem;
    z-index: 1000; 
    display: flex;
    flex-direction: column;
    gap: 0.75rem; 
    width: auto; 
    max-width: calc(100% - 2rem); 
}
@media (min-width: 640px) { 
    .toast-container {
        max-width: 320px; 
    }
}
.toast {
    padding: 0.75rem 1.25rem; 
    border-radius: 0.375rem; 
    color: white;
    font-size: 0.875rem; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.25);
    opacity: 0; 
    animation: toast-in 0.3s ease-out forwards;
}
@keyframes toast-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 0.95; } 
}
@keyframes toast-out {
    from { transform: translateX(0); opacity: 0.95; }
    to { transform: translateX(100%); opacity: 0; }
}
.toast-info { background-color: #3b82f6; } 
.toast-success { background-color: var(--auth-success-color); }
.toast-error { background-color: var(--auth-danger-color); }