/* --- Dark Theme (default) --- */
:root {
    --bg: #1a1a2e;
    --surface: #16213e;
    --surface2: #0f3460;
    --accent: #e94560;
    --text: #eee;
    --text-dim: #999;
    --border: #333;
}

/* --- Light Theme --- */
[data-theme="light"] {
    --bg: #f5f5f7;
    --surface: #ffffff;
    --surface2: #e8e8ed;
    --accent: #d63050;
    --text: #1d1d1f;
    --text-dim: #6e6e73;
    --border: #d2d2d7;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); -webkit-text-size-adjust: 100%; }

.hidden { display: none !important; }
.screen { width: 100vw; height: 100vh; overflow: hidden; }

.login-box { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; }
.login-box h1 { font-size: 2rem; color: var(--accent); margin-bottom: 0.5rem; }

header { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border); height: 48px; }
header h1 { font-size: 1rem; color: var(--accent); white-space: nowrap; }
.header-right { display: flex; align-items: center; gap: 0.5rem; }
.badge { background: var(--accent); color: white; border-radius: 10px; padding: 2px 8px; font-size: 0.75rem; }
.btn-small { background: none; border: 1px solid var(--border); color: var(--text-dim); padding: 4px 10px; border-radius: 4px; cursor: pointer; font-size: 0.85rem; }

/* --- Layout: Desktop + iPad Landscape --- */
.main-layout { display: flex; height: calc(100vh - 48px); }
#map { flex: 1; min-height: 0; }
/* Basemap entsättigen damit Kurven-Farben hervorstechen */
.leaflet-tile-pane { filter: saturate(0.3) brightness(0.85); }
[data-theme="light"] .leaflet-tile-pane { filter: saturate(0.4) brightness(0.95); }
#sidebar { width: 360px; background: var(--surface); border-left: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }

.tabs { display: flex; border-bottom: 1px solid var(--border); }
.tab { flex: 1; padding: 10px; background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 0.85rem; }
.tab.active { color: var(--accent); border-bottom: 2px solid var(--accent); }
#tab-content { flex: 1; overflow-y: auto; padding: 1rem; -webkit-overflow-scrolling: touch; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.btn { background: var(--accent); color: white; border: none; padding: 10px 16px; border-radius: 6px; cursor: pointer; width: 100%; margin-bottom: 1rem; font-size: 0.9rem; -webkit-appearance: none; }
.btn:hover { opacity: 0.9; }

.curve-info { margin-bottom: 1rem; }
.curve-info h3 { color: var(--accent); margin-bottom: 0.5rem; }
.field { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.field .label { color: var(--text-dim); }

.correction-form select, .correction-form input, .correction-form textarea {
    width: 100%; padding: 10px; margin-bottom: 8px; background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 6px; font-size: 16px; /* 16px prevents iOS auto-zoom */
}

.list-item { padding: 12px 10px; border-bottom: 1px solid var(--border); cursor: pointer; }
.list-item:hover { background: var(--surface2); }
.status { font-size: 0.75rem; padding: 2px 6px; border-radius: 4px; }
.status-pending { background: #f0ad4e; color: black; }
.status-approved { background: #5cb85c; color: white; }
.status-rejected { background: #d9534f; color: white; }

.stat-card { background: var(--surface2); padding: 14px; border-radius: 8px; margin-bottom: 8px; }
.stat-card .number { font-size: 1.5rem; font-weight: bold; color: var(--accent); }
.stat-card .label { color: var(--text-dim); font-size: 0.8rem; }

.hint { color: var(--text-dim); font-style: italic; font-size: 0.85rem; }

/* --- iPad Portrait (< 820px) --- */
@media (max-width: 820px) {
    .main-layout { flex-direction: column; }
    #map { height: 55vh; flex: none; }
    #sidebar { width: 100%; height: 45vh; border-left: none; border-top: 1px solid var(--border); }
    header h1 { font-size: 0.9rem; }
    #user-info { display: none; }
}

/* --- iPhone / small screens (< 500px) --- */
@media (max-width: 500px) {
    #map { height: 50vh; }
    #sidebar { height: 50vh; }
    .header-right { gap: 0.3rem; }
    .btn-small { padding: 4px 8px; font-size: 0.8rem; }
}
