/* ======================================================================================== */
/* Globales CSS                                                                             */
/* Projekt: JS Demo DB-Login & Auth-Flow                                                    */
/* Description: Kombiniert Layout-Basis, Formular-Validierung und Authentifizierungs-Flow.  */
/* Autor: BRULSIM                                                                           */
/* Datum: 2026-06-18                                                                        */
/* ======================================================================================== */

/* --- 1. GLOBAL & LAYOUT SYSTEM --- */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    background-color: #f4f4f4;
    color: #333;
    display: flex;
    flex-direction: column; 
    height: 100vh;          
}

main {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex-grow: 1;
    padding: 30px 5%;
    overflow: auto;
}

main section {
    width: 100%;
    max-width: 800px;
    margin: auto;
}

.main-limit {
    max-width: 800px;
    margin: auto;
}

main p { line-height: 1.6; margin-bottom: 1.5em; }

/* --- 2. HEADER & FOOTER INTERFACES --- */
header {
    background-color: #564ac1; 
    color: white;
}

.header-container {
    max-width: 800px;
    margin: auto;
    padding: 20px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center; 
}

.menu-container { display: flex; align-items: center; gap: 10px; }
header a { text-decoration: none; }

header button {
    background-color: white;
    color: #564ac1; 
    border: none;
    padding: 10px 20px;
    font-size: 1em;
    cursor: pointer;
    border-radius: 5px;
    transition: 0.2s;
}

header button:hover { background-color: #3f3593; color: white; }
/* --- Main Styles --- */
main a, main .bt {
    display: block;
    padding: 10px;
    background-color: white;
    margin: 10px 0;
    text-decoration: none;
    color: #2f286b;
    border: 1px solid #ddd;
    border-radius: 5px;
    transition: 0.2s;
}

main a:hover, main .bt:hover { background-color: #564ac1; color: white; }

/* Der neue Auth-Switch */
.auth-toggle {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.toggle-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 10px;
    font-size: 1rem;
    cursor: pointer;
    color: #888;
    transition: all 0.3s ease;
}

.toggle-btn.active {
    color: #2196F3;
    border-bottom: 2px solid #2196F3;
    font-weight: bold;
}

/* MAGIE: Felder ein-/ausblenden basierend auf der Formular-Klasse */
#loginForm.mode-login #group-username,
#loginForm.mode-login #group-passwordConfirm {
    display: none;
}

/* --- 3. FORMULAR SYSTEM & PASSPORT STRENGTH --- */
.form-container {
    background: #ffffff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin: 20px 0;
    border: 1px solid #e2e8f0;
}

.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label { font-weight: bold; color: #4a5568; font-size: 0.95em; }

.form-group input {
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 1em;
    background-color: #f8fafc;
    color: #334155;
    transition: 0.2s;
}

.form-group input:focus {
    background-color: #ffffff;
    border-color: #564ac1;
    box-shadow: 0 0 0 3px rgba(86, 74, 193, 0.15);
    outline: none;
}

/* NEU: Passwort-Stärke-Balken */
.password-strength-container {
    margin-top: 2px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.strength-bar {
    height: 6px;
    width: 0%;
    border-radius: 3px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.strength-text { font-weight: bold; font-size: 0.8em; }

/* Dynamische Stärkeklassen (werden via JS gesteuert) */
.strength-bar.weak { width: 33%; background-color: #dc2626; }
.strength-text.weak { color: #dc2626; }

.strength-bar.medium { width: 66%; background-color: #f97316; }
.strength-text.medium { color: #f97316; }

.strength-bar.strong { width: 100%; background-color: #22c55e; }
.strength-text.strong { color: #22c55e; }

.storage-settings-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
}

.form-group-inline { display: flex; align-items: center; gap: 10px; }
.form-group-inline input { width: 80px; padding: 8px; text-align: center; }
.form-group-checkbox { display: flex; align-items: center; gap: 8px; font-weight: bold; color: #4a5568; }

#btnSubmit {
    background-color: #564ac1;
    color: white;
    border: none;
    padding: 14px 28px;
    font-size: 1em;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    transition: 0.1s;
}
#btnSubmit:hover { background-color: #3f3593; }
#btnSubmit:active { transform: scale(0.99); }

/* --- 4. LIVE VALIDATION STATES --- */
.error-message { display: none; color: #dc2626; font-size: 0.85em; font-weight: bold; margin-top: 4px; }
.form-group.has-error input { border-color: #dc2626; background-color: #fef2f2; }
.form-group.has-error .error-message { display: block; }
#btnSubmit:disabled { background-color: #cbd5e1; color: #94a3b8; cursor: not-allowed; }

/* --- 5. JSON PREVIEW AREA & COCKPIT --- */
.preview-container {
    display: none; 
    margin-top: 25px;
    padding: 20px;
    background: #f0effb; 
    border-left: 5px solid #564ac1;
    border-radius: 4px 8px 8px 4px;
}

.preview-container h3 {
    margin: 0 0 15px 0;
    color: #2f286b;
    font-size: 1.15em;
    border-bottom: 1px solid rgba(86, 74, 193, 0.15);
    padding-bottom: 8px;
}

.preview-container p { margin: 8px 0; font-size: 0.95em; color: #475569; }
.preview-container span { font-family: monospace; background: rgba(255, 255, 255, 0.7); padding: 2px 6px; border-radius: 4px; }

/* NEU: Formatiertes JSON-Ausgabefeld */
.json-output-wrapper {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.json-label { font-weight: bold; color: #2f286b; font-size: 0.9em; }

pre {
    background-color: #1e1e2e;
    color: #a6adc8;
    padding: 14px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.2);
}

code { font-family: monospace; font-size: 0.9em; }

.storage-cockpit {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed rgba(86, 74, 193, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.countdown-badge {
    color: white !important;
    background-color: #564ac1;
    padding: 4px 10px !important;
    border-radius: 20px !important;
    font-weight: bold;
    font-family: monospace;
}

.btn-danger {
    background-color: #dc2626;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
}
.btn-danger:hover { background-color: #b91c1c; }


/* --- FOOTER STYLES --- */
footer { background-color: #333; color: white; text-align: center; padding: 15px; }

/* --- RESPONSIVE QUERIES --- */
@media screen and (max-width: 550px) {
    .header-container { padding: 15px 3%; flex-direction: column; gap: 10px; text-align: center; }
    .menu-container { flex-direction: column; width: 100%; }
    .menu-container a, header button { width: 100%; }
    .storage-cockpit { flex-direction: column; align-items: flex-start; }
}