/* ==========================================================================
   GLOBAL CONSTANTS & THEME VARIABLES (KFC Minimal Look)
   ========================================================================== */
:root {
    /* Farbpalette */
    --color-bg: #f8fafc;          
    --color-surface: #ffffff;     
    --color-text: #1e293b;        
    --color-muted: #64748b;       
    
    /* Akzentfarben */
    --color-primary: #198754;     
    --color-primary-hover: #146c43;
    --color-secondary: #0d6efd;   
    --color-danger: #dc3545;      
    --color-dark: #1e252b;        
    
    /* Layout-Konstanten */
    --max-width: 1200px;
    --radius: 6px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --transition: all 0.2s ease-in-out;
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
}

h1, h2, h3 {
    color: #0f172a;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

p {
    color: var(--color-muted);
    margin-bottom: 1rem;
}

/* ==========================================================================
   THE STRUCTURAL GRID & UTILITIES
   ========================================================================== */
.site-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1.5rem;
}

/* Info- und Statusboxen */
.msg-box {
    padding: 12px;
    margin-bottom: 1.25rem;
    border-left: 4px solid var(--color-danger);
    background: #f8d7da;
    color: #842029;
    font-size: 0.85rem;
    font-weight: bold;
    border-radius: var(--radius);
}

.msg-box-success {
    border-left: 4px solid var(--color-primary);
    background: #e8f5e9;
    color: #1b5e20;
}

.info-box {
    margin-top: 2.5rem;
    background-color: #e8f4fd;
    border-left: 4px solid var(--color-secondary);
    padding: 1rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: #1c3d5a;
}

.warning-box {
    margin: 20px 0;
    padding: 12px;
    background-color: #fff8db;
    border-left: 4px solid #ffc107;
    border-radius: var(--radius);
}

/* ==========================================================================
   RESPONSIVE NAVIGATION BAR
   ========================================================================== */
.main-nav {
    background-color: var(--color-dark);
    padding: 0.75rem 1.5rem;
    box-shadow: var(--shadow);
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
}

.nav-brand {
    color: #fff;
    font-weight: bold;
    font-size: 1.2rem;
    text-decoration: none;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
    align-items: center;
}

.nav-links a {
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-links a:hover, .nav-links a.active {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
}

.private-user-info {
    color: #cbd5e1;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
}

.user-divider { 
    color: #475569; 
}

.badge-admin { 
    background-color: #ffc107; 
    color: #000; 
    padding: 3px 8px; 
    border-radius: 4px; 
    font-size: 11px; 
    font-weight: 700; 
    line-height: 1;
    display: inline-block;
}

@media (min-width: 992px) {
    .nav-container {
        flex-direction: row;
        justify-content: space-between;
        gap: 0;
    }
    .nav-links {
        gap: 1rem;
    }
}

/* ==========================================================================
   BUTTONS & FORMS
   ========================================================================== */
.form-group { 
    margin-bottom: 1.25rem; 
}

.form-group label { 
    display: block; 
    font-weight: 600; 
    font-size: 0.9rem; 
    margin-bottom: 0.4rem; 
    color: #334155; 
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.8rem;
    font-size: 0.95rem;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius);
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--color-secondary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

/* Schlichter, unbunter Rahmen-Button nach Vorbild der Startseite */
.btn-sekundaer {
    display: inline-block;
    padding: 8px 16px;
    color: #000000 !important;
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.btn-sekundaer:hover {
    background-color: #f1f5f9 !important;
    border-color: #94a3b8 !important;
}

.btn-small {
    padding: 4px 8px !important;
    font-size: 0.85rem !important;
    line-height: 1.2 !important;
}

.form-actions { margin-top: 25px; display: flex; gap: 10px; }
.form-wide { max-width: 600px; }

/* ==========================================================================
   KRYPTO, AUTH & LOGIN COMPONENTS
   ========================================================================== */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 85vh;
    padding: 1rem;
}

.login-card {
    background: var(--color-surface);
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid #e2e8f0;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 420px;
}

.login-header-group { text-align: center; margin-bottom: 1.5rem; }
.login-form-group-last { margin-bottom: 1.75rem; }
.login-back-link { text-align: center; margin-top: 1.25rem; font-size: 0.8rem; }
.login-back-link a { color: var(--color-muted); text-decoration: none; transition: var(--transition); }
.login-back-link a:hover { color: var(--color-secondary); }

/* Passwort-Checkliste */
.password-checklist-box {
    margin-top: 8px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius);
    padding: 12px;
    font-size: 0.8rem;
}

.password-checklist-box p { font-weight: 700; color: #475569; margin-bottom: 6px; }
.checklist-group { list-style: none; }
.checklist-item { font-weight: 600; transition: var(--transition); display: flex; align-items: center; gap: 6px; }

.checklist-item-invalid { color: #ef4444 !important; }
.checklist-item-valid { color: #10b981 !important; }

/* ==========================================================================
   UNIVERSAL MULTI-ROW STATIC HEAD ENGINE (100% Inline-CSS frei)
   ========================================================================== */
.table-scroll-container {
    max-height: 70vh;
    overflow-y: auto;
    border-radius: var(--radius);
    border: 1px solid #e2e8f0;
    box-shadow: var(--shadow);
    margin-top: 1.5rem;
    background: #ffffff;
}

/* Basis für klebrige Tabellenköpfe */
.table-scroll-container th {
    position: sticky;
    z-index: 10;
    background-color: var(--color-dark) !important;
    color: #ffffff !important;
    box-shadow: inset 0 -1px 0 #cbd5e1;
}

/* Zwingt die 1. Kopfzeile (Spaltentitel) stabil ganz nach oben */
#crewTable thead tr:nth-child(1) th {
    top: 0 !important;
    z-index: 12 !important;
}

/* Zwingt die 2. Kopfzeile (Filterzeile) exakt um 40px nach unten versetzt zu kleben */
#crewTable thead tr:nth-child(2) th {
    top: 40px !important;
    z-index: 11 !important;
    border-bottom: 2px solid #cbd5e1;
}

/* Standard-Tabellenstyling */
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.925rem; }
.data-table th { padding: 0.75rem 1rem; font-weight: 700; white-space: nowrap; }
.data-table td { padding: 0.75rem 1rem; border-bottom: 1px solid #e2e8f0; vertical-align: middle; }
.data-table tr:hover td { background-color: #f8fafc; }

.table-cell-bold { font-weight: bold; }
.table-cell-empty-notice { text-align: center; color: var(--color-muted); padding: 20px; }
.table-cell-center { text-align: center !important; }
.table-actions-flex { display: flex; gap: 4px; justify-content: center; }
.table-cell-code { font-family: monospace; font-weight: 700; color: #475569; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { background-color: #e2e8f0 !important; color: var(--color-text) !important; }

/* Status Badges */
.status-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; line-height: 1; white-space: nowrap; }
.status-pending { background-color: #fff8db; color: #533f00; border: 1px solid #ffc107; }
.status-active { background-color: #e8f5e9; color: #1b5e20; border: 1px solid #c8e6c9; }
.status-suspended { background-color: #f8d7da; color: #842029; border: 1px solid #f5c2c7; }

/* ==========================================================================
   AVATARS & LIGHTBOX ZOOM ENGINE
   ========================================================================== */
.table-avatar-frame {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #cbd5e1;
    object-fit: cover;
    vertical-align: middle;
    margin-right: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: var(--transition);
}

.table-avatar-frame:hover {
    transform: scale(1.1);
    border-color: #3b82f6;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

.avatar-lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(17, 24, 39, 0.95);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.avatar-lightbox-overlay.lightbox-active {
    display: flex;
    opacity: 1;
}

.lightbox-big-image {
    max-width: 90%;
    max-height: 85vh;
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    transform: scale(0.95);
    transition: transform 0.25s ease;
}

.avatar-lightbox-overlay.lightbox-active .lightbox-big-image {
    transform: scale(1);
}

/* Profile Image Frames inside Cards */
.preview-img-frame {
    width: 120px;
    height: 120px;
    border-radius: var(--radius);
    border: 1px solid #cbd5e1;
    box-shadow: var(--shadow);
    background: #ffffff;
    object-fit: cover;
}

.image-upload-wrapper {
    background: #fafafa;
    border: 1px dashed #cbd5e1;
    padding: 15px;
    border-radius: var(--radius);
}

.avatar-flex-container {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.avatar-box {
    text-align: center;
}

.avatar-box span {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 6px;
}

/* ==========================================================================
   DASHBOARD GRID KACHELN
   ========================================================================== */
.dash-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; margin-top: 1.5rem; }
.dash-card { background-color: var(--color-surface); border: 1px solid #e2e8f0; border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); text-decoration: none; color: inherit; transition: var(--transition); }
.dash-card:hover { transform: translateY(-2px); box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); }
.dash-card h3 { font-size: 1.15rem; margin-bottom: 0.25rem; }
.dash-card p { font-size: 0.85rem; margin-bottom: 0; }
.dash-card-counter { margin-top: 1.25rem; font-size: 0.8rem; font-weight: bold; }
.dash-card-primary { border-left: 5px solid var(--color-primary); }
.dash-card-primary .dash-card-counter { color: var(--color-primary); }

@media (min-width: 576px) { .dash-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 992px) { .dash-grid { grid-template-columns: repeat(3, 1fr); } }

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer { background-color: #ffffff; border-top: 1px solid #e2e8f0; padding: 1.5rem; text-align: center; font-size: 0.8rem; color: var(--color-muted); }

/* ==========================================================================
   PREMIUM PRINT ENGINE
   ========================================================================== */
@media print {
    body, .table-scroll-container, .data-table { background: #ffffff !important; color: #000000 !important; }
    nav, footer, .form-actions, .filter-row { display: none !important; }
    .table-scroll-container { overflow: visible !important; max-height: none !important; }
    .data-table { width: 100% !important; border-collapse: collapse !important; }
    .data-table th, .data-table td { border: 1px solid #000000 !important; padding: 8px !important; background: transparent !important; color: #000000 !important; }
    .status-badge { background: transparent !important; color: #000000 !important; border: none !important; font-weight: 700 !important; }
}
