/* ─── Reset & Variables ───────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary:      #1a1a2e;
    --accent:       #c0392b;
    --success:      #27ae60;
    --warning:      #e67e22;
    --border:       #e0e0e0;
    --bg-page:      #f0f2f5;
    --bg-card:      #ffffff;
    --text:         #1a1a2e;
    --text-muted:   #666;
    --radius:       12px;
    --shadow:       0 2px 8px rgba(0,0,0,0.08);
}

/* ─── Base (mobile-first) ─────────────────────── */
html { font-size: 16px; }

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

/* ─── Header ──────────────────────────────────── */
header {
    background: var(--primary);
    background-image: url("../images/bg_area.jpg");
    background-size: cover;
    background-position: center;
    padding: 2rem 1rem;
    text-align: center;
}

h1 {
    font-size: 1.6rem;
    color: white;
    text-shadow: 0 2px 6px rgba(0,0,0,0.6);
}

/* ─── Navigation ──────────────────────────────── */
.nav-bar {
    background: var(--primary);
    display: flex;
    align-items: center;
    position: relative;
    border-bottom: 3px solid var(--accent);
}

.nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--primary);
    box-shadow: var(--shadow);
    z-index: 20;
}

.nav-links.open { display: flex; }

.nav-bar a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 0.85rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
}

.nav-bar a:hover,
.nav-bar a.active {
    background: var(--accent);
    color: white;
}

.nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 48px;
    height: 48px;
    margin-left: auto;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: white;
}

/* ─── Main Layout ─────────────────────────────── */
main {
    padding: 1rem;
    max-width: 960px;
    margin: 0 auto;
}

/* ─── Info Article ────────────────────────────── */
article {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
}

h2 {
    font-size: 1.15rem;
    color: var(--primary);
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

h2:first-child { margin-top: 0; }

p { margin-bottom: 0.6rem; font-size: 0.95rem; }

ul {
    padding-left: 1.4rem;
    margin-bottom: 0.5rem;
}

li { margin-bottom: 0.35rem; font-size: 0.9rem; }

/* ─── Overview Table ──────────────────────────── */
.overview-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
}

.more {
    display: inline-block;
    padding: 0.55rem 1rem;
    border: 2px solid var(--primary);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    background: white;
    color: var(--primary);
    transition: background 0.15s, color 0.15s;
}

.more:hover { background: var(--primary); color: white; }

.container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    min-width: 580px;
}

th {
    background: var(--primary);
    color: white;
    padding: 0.5rem 0.35rem;
    font-size: 0.8rem;
    white-space: nowrap;
}

td {
    padding: 0.35rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

thead tr:nth-child(2) td,
thead tr:nth-child(3) td {
    background: #f0f0f0;
    color: var(--text);
    font-size: 0.72rem;
}

.col-name {
    font-weight: 700;
    text-align: left;
    padding-left: 0.6rem;
}

.user {
    font-weight: 600;
    text-align: left;
    padding-left: 0.6rem;
    color: var(--text);
}

.angemeldet { background: #d4edda; }
.offen      { background: #fff3cd; }

#admin-table tbody tr:nth-child(even) { background: #f5f6f8; }

th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 1.3rem;
}

th.sortable:hover { background: var(--accent); }

th.sortable::after {
    content: '⇅';
    position: absolute;
    right: 0.4rem;
    opacity: 0.5;
    font-size: 0.7rem;
}

th.sortable.sort-asc::after  { content: '↑'; opacity: 1; }
th.sortable.sort-desc::after { content: '↓'; opacity: 1; }

#admin-table td { white-space: normal; }
#admin-table th:last-child,
#admin-table td:last-child { text-align: left; }

.dup-badge {
    display: inline-block;
    background: var(--accent);
    color: white;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.1rem 0.45rem;
    border-radius: 20px;
    margin-left: 0.4rem;
    white-space: nowrap;
    vertical-align: middle;
}

tfoot td {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-style: italic;
    padding-top: 0.4rem;
}

.edit-link {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.edit-link:hover { background: var(--accent); }

/* ─── Registration Section ────────────────────── */
.reg-section { margin-bottom: 2rem; }

.reg-section > h2 {
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
    margin-top: 0;
}

/* ─── Form Cards ──────────────────────────────── */
.form-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.form-card h3 {
    font-size: 1.05rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

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

/* ─── Form Groups (inputs) ────────────────────── */
.form-group { margin-bottom: 1rem; }

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

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    color: var(--text);
    transition: border-color 0.2s;
    -webkit-appearance: none;
    background: white;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

/* ─── Day Groups ──────────────────────────────── */
.day-group { margin-bottom: 1.25rem; }

.day-group h4 {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border);
}

/* ─── Shift Items ─────────────────────────────── */
.shift-item {
    border: 2px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    overflow: hidden;
    transition: border-color 0.2s;
}

.shift-item.checked   { border-color: var(--success); }
.shift-item.shift-full { opacity: 0.55; background: #fafafa; }

.shift-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem;
    cursor: pointer;
    min-height: 52px;
    -webkit-tap-highlight-color: transparent;
}

.shift-header input[type=checkbox] {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--success);
}

.shift-info {
    display: flex;
    flex: 1;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.shift-time {
    font-weight: 600;
    font-size: 1rem;
}

.shift-badge {
    font-size: 0.72rem;
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    font-weight: 700;
    white-space: nowrap;
}

.shift-badge.available { background: #d4edda; color: #155724; }
.shift-badge.full      { background: #f8d7da; color: #721c24; }

.shift-note {
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 0 0.875rem 0.6rem;
    margin: 0;
}

/* ─── Bon Selector ────────────────────────────── */
.bon-selector {
    display: none;
    padding: 0.875rem;
    background: #f8f9fa;
    border-top: 1px solid var(--border);
}

.bon-label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
    color: var(--text);
}

.bon-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.bon-qty-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.bon-qty-grid .form-group { margin-bottom: 0; }

.bon-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    background: white;
    font-size: 0.9rem;
    transition: border-color 0.15s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.bon-option:has(input:checked) {
    border-color: var(--primary);
    background: #e8eaf6;
    font-weight: 600;
}

.radio-card:has(input:checked) {
    border-color: var(--primary);
    background: #e8eaf6;
    font-weight: 600;
}

.bon-option input[type=radio] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    flex-shrink: 0;
}

/* ─── Radio Cards (Helferessen) ───────────────── */
.radio-cards {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.radio-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    background: white;
    font-size: 1rem;
    transition: border-color 0.15s, background 0.15s;
    min-height: 52px;
    -webkit-tap-highlight-color: transparent;
}

.radio-card input[type=radio] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    flex-shrink: 0;
}

/* ─── Error / Info Messages ───────────────────── */
.error {
    background: #fff5f5;
    border: 2px solid var(--accent);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    color: var(--accent);
    font-weight: 600;
    font-size: 0.95rem;
}

.info {
    background: #f0fff4;
    border: 2px solid var(--success);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    color: #155724;
    font-weight: 600;
    font-size: 0.95rem;
}

/* ─── Submit Button ───────────────────────────── */
button[type=submit],
input[type=submit] {
    display: block;
    width: 100%;
    padding: 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 0.5rem;
    -webkit-appearance: none;
    transition: background 0.2s;
}

button[type=submit]:hover,
input[type=submit]:hover { background: var(--accent); }

button.btn-danger { background: var(--accent); }
button.btn-danger:hover { background: #a53125; }

.filter-bar {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.filter-row label {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    min-width: 60px;
}

.filter-bar select {
    flex: 1;
    padding: 0.65rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    color: var(--text);
    background: white;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

.filter-bar select:focus {
    outline: none;
    border-color: var(--primary);
}

/* ─── Shift Overview Page ─────────────────────── */
.overview-page-header {
    margin-bottom: 1rem;
}

.overview-page-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.shift-overview-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.shift-overview-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-head {
    background: var(--primary);
    color: white;
    padding: 0.875rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.card-head h3 {
    font-size: 0.95rem;
    margin: 0;
    color: white;
    border: none;
    padding: 0;
    line-height: 1.4;
}

.card-head small { font-size: 0.8rem; opacity: 0.8; }

.card-badge {
    font-size: 0.8rem;
    background: rgba(255,255,255,0.2);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    white-space: nowrap;
    font-weight: 700;
}

.card-badge.full-badge { background: var(--accent); }

.card-body { padding: 0.875rem 1.25rem; }

.progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    margin-bottom: 0.875rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--success);
    border-radius: 3px;
}

.progress-fill.warn { background: var(--warning); }
.progress-fill.full-bar { background: var(--accent); }

.attendee-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.attendee-list li {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    gap: 0.5rem;
}

.attendee-list li:last-child { border-bottom: none; }

.att-num {
    width: 1.4rem;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.att-name { flex: 1; font-weight: 600; font-size: 0.95rem; }

.att-check {
    width: 28px;
    height: 28px;
    border: 2px solid var(--border);
    border-radius: 50%;
    background: white;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
    font-size: 0.9rem;
    color: transparent;
}

.att-check.present {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.empty-shift {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9rem;
    padding: 0.5rem 0;
}

/* ─── Desktop Enhancements ────────────────────── */
@media (min-width: 768px) {
    h1 { font-size: 2.4rem; }
    header { padding: 3rem 1rem; }
    main { padding: 1.5rem; }

    .bon-options { grid-template-columns: repeat(4, 1fr); }
    .bon-qty-grid { grid-template-columns: repeat(4, 1fr); }
    .radio-cards { flex-direction: row; }
    .radio-card  { flex: 1; }

    .shift-overview-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    .nav-toggle { display: none; }

    .nav-links {
        display: flex !important;
        flex-direction: row;
        position: static;
        box-shadow: none;
    }

    .nav-links .logout-link { margin-left: auto; }
}

@media (min-width: 1024px) {
    .shift-overview-grid { grid-template-columns: repeat(3, 1fr); }
}

body.admin-page main {
    max-width: 960px;
}

@media (min-width: 1200px) {
    body.admin-page main { max-width: 1400px; }
}