:root { 
    --p: #2563eb; 
    --p-dark: #1e40af; 
    --bg: #f8fafc; 
    --c: #ffffff; 
    --t: #1e293b; 
    --b: #e2e8f0; 
    --s: #10b981; 
    --muted: #64748b;
}

[data-theme="dark"] { 
    --bg: #0f172a; 
    --c: #1e293b; 
    --t: #f1f5f9; 
    --b: #334155; 
}

body { 
    font-family: 'Inter', sans-serif; 
    background: var(--bg); 
    color: var(--t); 
    margin: 0; 
    transition: 0.3s; 
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- CONTAINER (ZENTRIERUNG) --- */
.app-container { 
    display: flex; 
    justify-content: center; 
    align-items: flex-start; 
    padding: 40px 20px; 
    width: 100%;
    box-sizing: border-box;
}

/* ShareView muss im JS als 'flex' gesetzt werden */
#shareView.app-container {
    display: none; 
}

.card { 
    background: var(--c); 
    padding: 30px; 
    border-radius: 24px; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.05); 
    width: 100%; 
    max-width: 500px; 
    text-align: center; 
}

/* --- AUTH / STARTSEITE --- */
#authOverlay { 
    position: fixed; 
    inset: 0; 
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%); 
    z-index: 2000; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    padding: 20px; 
}

.welcome-card { 
    background: white; 
    padding: 40px; 
    border-radius: 32px; 
    box-shadow: 0 25px 50px rgba(0,0,0,0.4); 
    width: 100%; 
    max-width: 400px; 
    text-align: center; 
    color: #1e293b; 
}

.logo-icon { 
    width: 70px; height: 70px; 
    background: var(--p); color: white; 
    border-radius: 20px; 
    display: flex; align-items: center; justify-content: center; 
    font-size: 35px; margin: 0 auto 20px; font-weight: 800; 
}

.feature-list { 
    text-align: left; background: #f1f5f9; 
    padding: 15px; border-radius: 15px; 
    margin: 20px 0; font-size: 14px; 
}

.feature-item { 
    margin-bottom: 8px; font-weight: 600; 
    color: #475569; display: flex; align-items: center; gap: 10px; 
}

.feature-item span { color: #10b981; font-weight: 800; }

.login-google { 
    background: white !important; color: #374151 !important; 
    border: 1px solid #d1d5db !important; 
    display: flex; align-items: center; justify-content: center; gap: 10px; 
}

/* --- APP UI ELEMENTE --- */
.header-area { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 20px; 
}

.user-info { display: flex; align-items: center; gap: 10px; font-weight: 700; text-align: left; }
.user-info img { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--b); }
.user-controls { display: flex; gap: 8px; }

.control-btn { 
    padding: 8px 12px; border-radius: 10px; 
    border: 1px solid var(--b); background: var(--c); 
    color: var(--t); cursor: pointer; font-weight: 700; font-size: 12px; 
}

/* --- NAVIGATION --- */
.nav-menu { 
    display: flex; background: var(--bg); 
    padding: 5px; border-radius: 12px; 
    margin-bottom: 20px; border: 1px solid var(--b); 
}

.nav-item { 
    flex: 1; padding: 10px; border: none; 
    background: none; border-radius: 8px; 
    cursor: pointer; font-weight: 700; color: var(--muted); 
    transition: 0.2s;
}

.nav-item.active { 
    background: var(--c); color: var(--p); 
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); 
}

/* --- FORMULAR ELEMENTE --- */
textarea { 
    width: 100%; height: 120px; padding: 15px; 
    border-radius: 12px; border: 2px solid var(--b); 
    background: var(--bg); color: var(--t); 
    font-family: inherit; resize: none; box-sizing: border-box; 
    text-align: left;
}

.mode-select { display: flex; gap: 8px; margin: 15px 0; }
.mode-select label { 
    flex: 1; text-align: center; padding: 10px; 
    border: 2px solid var(--b); border-radius: 10px; 
    cursor: pointer; font-weight: 700; font-size: 13px; 
    transition: 0.2s;
}
.mode-select input { display: none; }
.mode-select input:checked + label { background: var(--p); color: white; border-color: var(--p); }

.btn { 
    width: 100%; padding: 16px; background: var(--p); 
    color: white; border: none; border-radius: 14px; 
    font-weight: 800; cursor: pointer; margin-top: 10px; font-size: 15px; 
}

/* --- STATISTIK & LISTEN --- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin: 20px 0; }
.stat-item { 
    background: var(--bg); padding: 15px; border-radius: 14px; 
    text-align: center; border: 1px solid var(--b); 
}
.stat-item small { display: block; color: var(--muted); font-weight: 600; }
.stat-item b { font-size: 18px; color: var(--p); }

#routeList, #shareList { list-style: none; padding: 0; margin-top: 20px; border-top: 1px solid var(--b); padding-top: 20px; text-align: left; }

.route-li { 
    background: var(--bg); border: 1px solid var(--b); 
    padding: 12px; margin-bottom: 8px; border-radius: 12px; 
    display: flex; justify-content: space-between; align-items: center; 
}

.nav-link { 
    background: var(--p); color: white; padding: 6px 12px; 
    border-radius: 8px; text-decoration: none; font-size: 11px; font-weight: 800; 
}

/* --- FREIGABEN (SHARED CARDS) --- */
.shared-route-card {
    background: var(--bg);
    border: 1px solid var(--b);
    padding: 12px 15px;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    text-align: left;
}

.shared-route-card .btn {
    width: auto;
    margin: 0;
    padding: 8px 16px;
    font-size: 12px;
    border-radius: 10px;
}

/* --- MODAL & OVERLAY --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
}

.share-panel {
    position: fixed;
    top: 50%; left: 50%; transform: translate(-50%, -50%);
    z-index: 1001; /* Sicher über dem Overlay */
    width: 90%; max-width: 400px;
    background: var(--c);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.2);
    border: 1px solid var(--b);
    padding: 25px;
    border-radius: 24px;
    display: none;
}

/* Fix für das E-Mail Eingabefeld und den Plus-Button */
#shareEmail {
    flex: 1;
    min-width: 0;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--b);
    background: var(--bg);
    color: var(--t);
    font-size: 14px;
}

.share-panel div[style*="display:flex"] {
    display: flex !important;
    gap: 10px;
    margin-top: 15px;
}

.access-item {
    display: flex; justify-content: space-between;
    padding: 10px 0; border-bottom: 1px solid var(--b);
    font-size: 13px; text-align: left;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--b); border-radius: 10px; }