:root {
    color-scheme: light dark;
    --bg: #f5f5f7;
    --card-bg: #ffffff;
    --text: #1c1c1e;
    --muted: #6b7280;
    /* Markenfarben aus dem Logo (public/assets/img/logo.svg): Teal + Amber. */
    --brand: #14b8a6;
    --brand-dark: #0d9488;
    --accent: #f59e0b;
    --brand-contrast: #ffffff;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #b45309;
    --border: #e5e7eb;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #121212;
        --card-bg: #1e1e1f;
        --text: #f3f4f6;
        --muted: #9ca3af;
        --brand-dark: #2dd4bf;
        --border: #2e2e30;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.topbar {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 1rem;
}

.topbar-inner-wide {
    max-width: 1200px;
}

.brand {
    display: block;
    text-decoration: none;
}

.brand-logo {
    width: 100%;
    height: auto;
    display: block;
    background: #fff;
    border-radius: 8px;
    padding: 8px 14px;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 1.5rem 1rem 4rem;
}

.container-wide {
    max-width: 1200px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.narrow-card {
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
}

h1 { margin-top: 0; font-size: 1.5rem; }
h2 { font-size: 1.15rem; }

.hint { color: var(--muted); font-size: 0.85rem; }

label { display: block; margin: 0.75rem 0 0.25rem; font-weight: 600; font-size: 0.9rem; }

input[type="text"], input[type="email"], input[type="password"], input[type="file"] {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font-size: 1rem;
}

button, .button {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.65rem 1.1rem;
    border: none;
    border-radius: 8px;
    background: var(--brand);
    color: var(--brand-contrast);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}

.button-small { padding: 0.35rem 0.7rem; font-size: 0.85rem; margin-top: 0; }
.button-danger { background: var(--danger); }
.button-success { background: var(--success); }

.inline-form { display: inline-block; }

.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
}
.alert-error { background: rgba(220, 38, 38, 0.12); color: var(--danger); }
.alert-warning { background: rgba(180, 83, 9, 0.12); color: var(--warning); }
.alert-success { background: rgba(22, 163, 74, 0.12); color: var(--success); }

.code-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1rem;
}
@media (min-width: 600px) {
    .code-grid { grid-template-columns: 1fr 1fr; }
}

.code-box {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
}
.code-box-admin { border-color: var(--brand); }
.code-box .hint { color: var(--muted); font-size: 0.85rem; }
.code-box .code {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    margin: 0.5rem 0;
}
.code-box .qr { width: 160px; height: 160px; margin: 0.5rem auto; display: block; }

.user-link-details { margin-top: 1rem; }
.user-link-details summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--brand);
}
.user-link-details .code-box { margin-top: 0.75rem; max-width: 320px; }

.role-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}
.role-admin { background: rgba(20, 184, 166, 0.15); color: var(--brand-dark); }
.role-user { background: rgba(107, 114, 128, 0.15); color: var(--muted); }
.role-badge-success { background: rgba(22, 163, 74, 0.15); color: var(--success); }
.role-badge-danger { background: rgba(220, 38, 38, 0.15); color: var(--danger); }

.upload-list { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.upload-row { font-size: 0.85rem; }
.upload-row progress { width: 100%; }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}
.gallery-item {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg);
}
.gallery-item img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}
.gallery-item-processing {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.8rem;
    text-align: center;
    padding: 0.5rem;
}
.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1.5rem;
    text-shadow: 0 0 6px rgba(0,0,0,0.6);
}
.gallery-item-nopreview {
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    text-decoration: none;
    background: var(--bg);
}
.gallery-item-nopreview .file-ext {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--brand);
}
.gallery-item-nopreview .hint {
    color: var(--muted);
    font-size: 0.75rem;
}
.gallery-item-actions {
    display: flex;
    justify-content: space-between;
    gap: 0.25rem;
    padding: 0.4rem;
}

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.lightbox[hidden] { display: none; }

.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-content img,
.lightbox-content video {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: none;
    border-radius: 999px;
    width: 44px;
    height: 44px;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover { background: rgba(255, 255, 255, 0.25); }

.lightbox-close { top: 1rem; right: 1rem; }
.lightbox-prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 1rem; top: 50%; transform: translateY(-50%); }

.table-scroll { overflow-x: auto; }
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    white-space: nowrap;
}
.admin-table th, .admin-table td {
    text-align: left;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--border);
}
.admin-table th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.admin-table tbody tr:hover { background: rgba(20, 184, 166, 0.05); }
.admin-table-actions { display: flex; gap: 0.4rem; }

/* Admin- / Super-Admin-Bereich: geraeumigere, klarer gruppierte Karten. */
.admin-card-grid {
    display: grid;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}
@media (min-width: 760px) {
    .admin-card-grid.two-col { grid-template-columns: 1fr 1fr; align-items: start; }
}

.admin-section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}
.admin-section h2 {
    margin: 0 0 0.3rem;
    font-size: 1.05rem;
    color: var(--brand-dark);
}
.admin-section .section-desc {
    color: var(--muted);
    font-size: 0.88rem;
    margin: 0 0 1rem;
}

.chip {
    display: inline-block;
    background: rgba(20, 184, 166, 0.12);
    color: var(--brand-dark);
    border-radius: 999px;
    padding: 0.15rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 600;
}
.chip-amber { background: rgba(245, 158, 11, 0.18); color: #92400e; }

.button-outline {
    background: transparent;
    border: 1.5px solid var(--brand);
    color: var(--brand-dark);
}
.button-outline:hover { background: rgba(20, 184, 166, 0.08); }
.button-outline.button-danger { border-color: var(--danger); color: var(--danger); background: transparent; }
.button-outline.button-danger:hover { background: rgba(220, 38, 38, 0.08); }
.button-outline.button-success { border-color: var(--success); color: var(--success); background: transparent; }
.button-outline.button-success:hover { background: rgba(22, 163, 74, 0.08); }

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-top: 0.25rem;
}
.admin-actions form,
.admin-actions .inline-form { margin: 0; }
.admin-actions button,
.admin-actions .button { margin-top: 0; }

.download-overlay-box {
    background: var(--card-bg);
    color: var(--text);
    border-radius: 12px;
    padding: 2rem;
    max-width: 320px;
    text-align: center;
}
.download-overlay-box .spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 1rem;
    border: 4px solid var(--border);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: pc-spin 0.8s linear infinite;
}
@keyframes pc-spin {
    to { transform: rotate(360deg); }
}

.site-footer {
    max-width: 720px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
    display: flex;
    gap: 1.5rem;
    font-size: 0.85rem;
}

.site-footer-wide {
    max-width: 1200px;
}
.site-footer a {
    color: var(--muted);
    text-decoration: none;
}
.site-footer a:hover {
    text-decoration: underline;
}
