/* ═══════════════════════════════════════════════════════════════════
 * PflegePur Portal-Theme
 * Gemeinsame Basis für schulen.pflegepur.com + anleiter.pflegepur.com
 *
 * Performance-Fokus: minimale Filter/Backdrop-Filter, leichte Shadows,
 * System-Font als Fallback wenn DM Sans lädt zu langsam.
 * ═══════════════════════════════════════════════════════════════════ */

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

:root {
    /* Default (Lila = Schulen) */
    --brand-500: #8b5cf6;
    --brand-600: #7c3aed;
    --brand-700: #6d28d9;
    --accent-500: #fb7185;
    --bg-1: #0f0a1f;
    --bg-2: #18122b;
    --surface: #1f1935;
    --surface-2: #2a2244;
    --border: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.18);
    --text-1: #fff;
    --text-2: rgba(255, 255, 255, 0.75);
    --text-3: rgba(255, 255, 255, 0.5);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --danger: #ef4444;
    --warn: #f59e0b;
    --ok: #10b981;
    --info: #06b6d4;
}

/* Anleiter-Portal: grünes Theme */
body.theme-anleiter {
    --brand-500: #10b981;
    --brand-600: #059669;
    --brand-700: #047857;
    --accent-500: #06b6d4;
    --bg-1: #052e23;
    --bg-2: #0a3b30;
    --surface: #123b30;
    --surface-2: #164839;
}

body {
    font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    background: var(--bg-1);
    color: var(--text-1);
    line-height: 1.55;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
/* Performance: keine schweren Background-Gradients auf dem body.
   Stattdessen nur 1 subtiler Farbakzent oben. */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 400px;
    background: radial-gradient(ellipse 80% 100% at 50% 0%, var(--bg-2) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}
body > * { position: relative; z-index: 1; }

a { color: inherit; text-decoration: none; }

.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ─── Navbar ─── */
.navbar {
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1080px;
    margin: 0 auto;
}
.logo {
    font-size: 17px;
    font-weight: 900;
    letter-spacing: -0.02em;
    color: var(--text-1);
}
.logo-accent {
    background: linear-gradient(135deg, var(--brand-500), var(--accent-500));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.nav-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.nav-login, .nav-user {
    padding: 9px 18px;
    background: transparent;
    color: var(--text-1);
    border: 1px solid var(--border);
    border-radius: 99px;
    font-weight: 700;
    font-size: 13px;
    transition: border-color 0.15s;
    font-family: inherit;
    cursor: pointer;
}
.nav-login:hover, .nav-user:hover { border-color: var(--border-strong); }

/* ─── Auth (Login/Register) ─── */
.auth-body { min-height: 100vh; display: flex; flex-direction: column; }
.auth-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 32px 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}
.auth-head {
    text-align: center;
    margin-bottom: 22px;
}
.auth-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 14px;
    background: linear-gradient(135deg, var(--brand-500), var(--accent-500));
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.3);
}
.auth-head h1 {
    font-size: 22px;
    font-weight: 900;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}
.auth-head p {
    font-size: 13px;
    color: var(--text-3);
}
.auth-banner {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 14px;
    line-height: 1.45;
}
.auth-banner-error   { background: rgba(239, 68, 68, 0.12);  border: 1px solid rgba(239, 68, 68, 0.4);   color: #fecaca; }
.auth-banner-success { background: rgba(16, 185, 129, 0.12); border: 1px solid rgba(16, 185, 129, 0.35); color: #6ee7b7; }
.auth-banner-info    { background: rgba(6, 182, 212, 0.12);  border: 1px solid rgba(6, 182, 212, 0.35);  color: #67e8f9; }

.field { margin-bottom: 14px; }
.field label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-2);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="tel"],
.field input[type="date"],
.field select,
.field textarea {
    width: 100%;
    padding: 13px 14px;
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    color: var(--text-1);
    font-family: inherit;
    transition: border-color 0.15s, background 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--brand-500);
    background: rgba(139, 92, 246, 0.06);
}
.field input::placeholder { color: var(--text-3); }
html[data-theme="dark"] .field input[type="date"] { color-scheme: dark; }

.pin-input {
    font-size: 28px !important;
    text-align: center;
    letter-spacing: 0.35em !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
    text-transform: uppercase;
}
.btn-submit {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--brand-500), var(--accent-500));
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    margin-top: 6px;
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.35);
    transition: transform 0.15s;
}
.btn-submit:hover { transform: translateY(-1px); }
.btn-submit:active { transform: translateY(0); }

.mode-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 18px;
}
.mode-tab {
    padding: 10px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-2);
    font-family: inherit;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: color 0.15s, background 0.15s;
}
.mode-tab.active {
    background: var(--brand-500);
    color: white;
}

.auth-hint {
    font-size: 12px;
    color: var(--text-3);
    text-align: center;
    margin-top: 16px;
    line-height: 1.6;
}
.auth-hint a { color: var(--brand-500); font-weight: 600; }

.back-link {
    display: block;
    text-align: center;
    font-size: 13px;
    color: var(--text-3);
    margin-top: 20px;
}
.back-link:hover { color: var(--text-1); }

/* ─── Dashboard Layout ─── */
.app-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}
@media (max-width: 768px) {
    .app-shell { grid-template-columns: 1fr; }
}

.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
@media (max-width: 768px) {
    .sidebar {
        position: static;
        height: auto;
        padding: 14px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
}
.sidebar-logo {
    font-size: 16px;
    font-weight: 900;
    letter-spacing: -0.02em;
    padding: 4px 8px 18px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-2);
    transition: background 0.12s, color 0.12s;
}
.sidebar-item:hover {
    background: var(--surface-2);
    color: var(--text-1);
}
.sidebar-item.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(251, 113, 133, 0.1));
    color: var(--text-1);
    box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.3);
}
.sidebar-icon { font-size: 16px; line-height: 1; }
.sidebar-section {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 14px 12px 6px;
}
.sidebar-footer {
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.main-content {
    padding: 24px;
    overflow-x: auto;
}
@media (max-width: 600px) {
    .main-content { padding: 16px; }
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}
.page-title {
    font-size: clamp(22px, 3vw, 30px);
    font-weight: 900;
    letter-spacing: -0.02em;
    margin: 0 0 4px;
}
.page-sub {
    font-size: 14px;
    color: var(--text-3);
}

/* ─── Cards / Stats ─── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.stat-card {
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.stat-label {
    font-size: 11px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    margin-bottom: 6px;
}
.stat-value {
    font-size: 30px;
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1;
}
.stat-trend {
    font-size: 12px;
    margin-top: 6px;
    color: var(--text-3);
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}
.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.card-title {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.01em;
}
.card-sub {
    font-size: 12px;
    color: var(--text-3);
}

/* ─── Tables ─── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    text-align: left;
    padding: 8px 12px;
    font-weight: 700;
    color: var(--text-3);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}
.data-table tr:hover td { background: var(--surface-2); }
.data-table tr:last-child td { border-bottom: none; }

/* Status-Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.badge-green  { background: rgba(16, 185, 129, 0.18); color: #6ee7b7; }
.badge-yellow { background: rgba(245, 158, 11, 0.18); color: #fcd34d; }
.badge-red    { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }
.badge-blue   { background: rgba(6, 182, 212, 0.18); color: #67e8f9; }
.badge-purple { background: rgba(139, 92, 246, 0.18); color: #c4b5fd; }

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 99px;
    font-weight: 700;
    font-size: 13px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.12s, box-shadow 0.12s;
    text-decoration: none;
}
.btn-primary {
    background: linear-gradient(135deg, var(--brand-500), var(--accent-500));
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-secondary {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-1);
}
.btn-secondary:hover { border-color: var(--border-strong); }
.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ─── Footer ─── */
.portal-footer {
    padding: 28px 20px 36px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 12px;
    color: var(--text-3);
    margin-top: 40px;
}
.footer-links {
    display: flex;
    gap: 18px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 8px;
}
.footer-links a { color: var(--text-2); }
.footer-links a:hover { color: var(--text-1); }

/* ─── Cookie-Dialog (self-contained) ─── */
.pp-cookie-dialog { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 16px; }
.pp-cookie-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.7); }
.pp-cookie-sheet {
    position: relative;
    width: 100%;
    max-width: 540px;
    max-height: 85vh;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}
.pp-cookie-head {
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--brand-500), var(--accent-500));
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.pp-cookie-head h2 { font-size: 16px; font-weight: 900; margin: 0; }
.pp-cookie-close {
    width: 30px; height: 30px; border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white; border-radius: 50%; cursor: pointer;
    font-size: 14px; font-family: inherit;
}
.pp-cookie-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.pp-cookie-intro { font-size: 13px; color: var(--text-2); margin-bottom: 16px; line-height: 1.6; }
.pp-cookie-group {
    padding: 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
}
.pp-cookie-group-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 6px; gap: 12px;
}
.pp-cookie-group strong { font-size: 14px; font-weight: 800; }
.pp-cookie-group p { font-size: 12px; color: var(--text-3); line-height: 1.55; }
.pp-cookie-badge {
    display: inline-block; margin-left: 8px;
    padding: 2px 8px; background: rgba(139, 92, 246, 0.2); color: #c4b5fd;
    border-radius: 99px; font-size: 10px; font-weight: 800;
    text-transform: uppercase; letter-spacing: 0.05em;
}
.pp-cookie-toggle {
    position: relative; display: inline-block;
    width: 40px; height: 22px; cursor: pointer; flex-shrink: 0;
}
.pp-cookie-toggle input { opacity: 0; width: 0; height: 0; }
.pp-cookie-toggle-slider {
    position: absolute; inset: 0;
    background: var(--border-strong); border-radius: 99px;
    transition: background 0.2s;
}
.pp-cookie-toggle-slider::before {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 18px; height: 18px; background: white;
    border-radius: 50%; transition: transform 0.2s;
}
.pp-cookie-toggle input:checked + .pp-cookie-toggle-slider { background: var(--brand-500); }
.pp-cookie-toggle input:checked + .pp-cookie-toggle-slider::before { transform: translateX(18px); }
.pp-cookie-actions {
    display: flex; gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}
.pp-cookie-actions button {
    flex: 1; padding: 11px;
    border: none; border-radius: var(--radius);
    font-size: 13px; font-weight: 700;
    cursor: pointer; font-family: inherit;
}
.pp-cookie-btn-secondary {
    background: var(--surface);
    border: 1px solid var(--border) !important;
    color: var(--text-1);
}
.pp-cookie-btn-primary {
    background: linear-gradient(135deg, var(--brand-500), var(--accent-500));
    color: white;
}
