/* ============================================
   KLASSENDIENST - Stylesheet
   ============================================ */

.kd-container {
    max-width: 920px;
    margin: 0 auto;
    width: 100%;
}

.kd-loading {
    text-align: center;
    color: var(--text-medium);
    padding: 60px 0;
}

/* ---------- Banner ---------- */
.kd-banner {
    background: #FFF7EC;
    border: 1px solid #F4D7A8;
    color: #8a5a00;
    border-radius: var(--radius-md, 12px);
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
}

/* ---------- Deze week hero ---------- */
.kd-hero {
    background: linear-gradient(135deg, #6C63FF 0%, #8B7BFF 100%);
    border-radius: var(--radius-xl, 20px);
    padding: 28px;
    color: #fff;
    box-shadow: var(--shadow-md, 0 8px 24px rgba(108, 99, 255, 0.25));
    margin-bottom: 24px;
}

.kd-hero-top {
    text-align: center;
    margin-bottom: 24px;
}

.kd-week-pill {
    display: inline-block;
    background: rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    padding: 4px 14px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.kd-hero-title {
    font-size: clamp(22px, 4vw, 30px);
    font-weight: 800;
    margin: 12px 0 4px;
}

.kd-hero-date {
    font-size: 16px;
    opacity: 0.9;
    margin: 0;
}

.kd-hero-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 24px;
    align-items: start;
}

.kd-duty-people {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
}

/* ---------- Personen met monster-avatars ---------- */
.kd-person {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
}

.kd-avatar {
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kd-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Initialen-fallback: standaard verborgen, zichtbaar via onerror */
.kd-avatar-initials {
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-weight: 800;
    color: var(--primary);
    position: absolute;
    inset: 0;
}

.kd-person-big .kd-avatar {
    width: 84px;
    height: 84px;
    font-size: 30px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.kd-person-big .kd-avatar-initials {
    font-size: 30px;
}

.kd-person-big .kd-person-name {
    font-size: 17px;
    font-weight: 700;
}

.kd-person-big .kd-person-nr {
    font-size: 12px;
    opacity: 0.85;
}

.kd-person-small .kd-avatar {
    width: 50px;
    height: 50px;
    background: var(--bg-light, #F3F4F8);
}

.kd-person-small .kd-avatar-initials {
    font-size: 18px;
    color: var(--primary);
}

.kd-person-small .kd-person-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.kd-person-small .kd-person-nr {
    font-size: 11px;
    color: var(--text-light);
}

/* ---------- Taken panel ---------- */
.kd-tasks-panel {
    background: rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-lg, 16px);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ---------- Dag-header met tabs ---------- */
.kd-day-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.kd-today-label {
    font-size: 13px;
    opacity: 0.9;
    white-space: nowrap;
}

.kd-today-label strong {
    font-weight: 700;
}

.kd-day-tabs {
    display: flex;
    gap: 4px;
}

.kd-day-tab {
    background: rgba(255, 255, 255, 0.15);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.85);
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    position: relative;
    line-height: 1.4;
}

.kd-day-tab:hover {
    background: rgba(255, 255, 255, 0.28);
    color: #fff;
}

.kd-day-tab.active {
    background: #fff;
    border-color: #fff;
    color: var(--primary, #6C63FF);
    font-weight: 800;
}

/* Kleine stip onder de tab die overeenkomt met vandaag */
.kd-day-tab.is-today::after {
    content: '';
    display: block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    margin: 2px auto 0;
}

.kd-day-tab.is-today.active::after {
    background: var(--primary, #6C63FF);
}

/* ---------- Takenlijst (in hero) ---------- */
.kd-task-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.kd-task-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    line-height: 1.4;
}

/* Interactieve afvinkknop */
.kd-task-check {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 1.5px solid rgba(255, 255, 255, 0.5);
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
    padding: 0;
    line-height: 1;
}

.kd-task-check:hover {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.8);
    color: #fff;
}

.kd-task-check.done {
    background: #6BCB77;
    border-color: #6BCB77;
    color: #fff;
    transform: scale(1.1);
}

.kd-task-text {
    flex: 1;
    transition: opacity 0.15s, text-decoration 0.15s;
}

.kd-task-done .kd-task-text {
    opacity: 0.55;
    text-decoration: line-through;
}

/* Dag-badge "elke dag" */
.kd-task-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    padding: 2px 8px;
    opacity: 0.8;
    white-space: nowrap;
    flex-shrink: 0;
}

.kd-empty-inline {
    font-size: 14px;
    opacity: 0.85;
    margin: 0;
}

/* ---------- Sneak preview volgende week ---------- */
.kd-next {
    background: var(--bg-white, #fff);
    border: 2px dashed #D6D3FF;
    border-radius: var(--radius-lg, 16px);
    padding: 20px 24px;
    margin-bottom: 24px;
    text-align: center;
}

.kd-next-head {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.kd-next-icon {
    font-size: 20px;
}

.kd-next-date {
    font-size: 14px;
    color: var(--text-medium);
    margin: 4px 0 16px;
}

.kd-next-people {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    justify-content: center;
}

/* ---------- Jaaroverzicht ---------- */
.kd-overview {
    background: var(--bg-white, #fff);
    border: 1px solid #E8E8F0;
    border-radius: var(--radius-lg, 16px);
    padding: 20px 24px;
    box-shadow: var(--shadow-sm, 0 2px 8px rgba(0, 0, 0, 0.05));
}

.kd-overview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.kd-overview-head h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.kd-pdf-btn {
    white-space: nowrap;
}

.kd-table-wrap {
    overflow-x: auto;
}

.kd-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.kd-table th,
.kd-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid #EEF0F6;
}

.kd-table th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    font-weight: 700;
}

.kd-table th:first-child,
.kd-table td:first-child {
    width: 56px;
    text-align: center;
    color: var(--text-medium);
}

.kd-table tbody tr:hover {
    background: #FAFAFE;
}

.kd-row-current {
    background: #EEF0FF !important;
}

.kd-row-current td {
    font-weight: 700;
    color: var(--primary);
}

/* ---------- Lege staten ---------- */
.kd-empty {
    text-align: center;
    padding: 60px 20px;
    max-width: 460px;
    margin: 0 auto;
}

.kd-empty-icon {
    font-size: 56px;
    display: block;
    margin-bottom: 12px;
}

.kd-empty h2 {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-dark);
    margin: 0 0 8px;
}

.kd-empty p {
    font-size: 15px;
    color: var(--text-medium);
    line-height: 1.5;
    margin: 0 0 18px;
}

/* ---------- Instellingen modal ---------- */
.kd-tasks-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.kd-tasks-edit {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kd-task-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 8px;
}

.kd-task-input {
    padding: 8px 12px;
    border: 1px solid #E0E0EA;
    border-radius: 8px;
    font-size: 14px;
    min-width: 0;
}

.kd-day-select {
    padding: 8px 10px;
    border: 1px solid #E0E0EA;
    border-radius: 8px;
    font-size: 13px;
    background: #fff;
    color: var(--text-dark);
    cursor: pointer;
    white-space: nowrap;
}

.kd-task-del {
    flex-shrink: 0;
    font-size: 18px;
    line-height: 1;
    padding: 4px 10px;
}

.kd-settings-hint {
    font-size: 13px;
    color: var(--text-medium);
    line-height: 1.5;
    margin: 16px 0 0;
}

.kd-settings-hint a {
    color: var(--primary);
    font-weight: 600;
}

/* ---------- Klasseprestatie koppeling ---------- */
.kd-link-group {
    background: #F7F6FF;
    border: 1px solid #DDD9FF;
    border-radius: var(--radius-md, 12px);
    padding: 14px 16px;
}

.kd-link-toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.kd-link-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--primary, #6C63FF);
    cursor: pointer;
    flex-shrink: 0;
}

.kd-link-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    cursor: pointer;
}

.kd-link-detail {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kd-link-select {
    padding: 8px 10px;
    border: 1px solid #E0E0EA;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    color: var(--text-dark);
    cursor: pointer;
    width: 100%;
}

.kd-link-hint {
    font-size: 12px;
    color: var(--text-medium);
    line-height: 1.5;
    margin: 0;
}

/* ---------- Toast notificatie ---------- */
.kd-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #2D2D3A;
    color: #fff;
    padding: 12px 22px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    max-width: 90vw;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 9999;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.kd-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .kd-hero {
        padding: 20px;
    }

    .kd-hero-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .kd-day-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .kd-task-row {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
    }

    .kd-day-select {
        grid-column: 1;
    }

    .kd-task-del {
        grid-column: 2;
        grid-row: 1;
    }
}

/* ---------- Zelf het groepje kiezen ---------- */
.kd-hero-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}
.kd-choose-btn, .kd-reset-btn {
    border: none;
    border-radius: 999px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, transform 0.08s;
}
.kd-choose-btn { background: #fff; color: var(--primary, #6C63FF); }
.kd-choose-btn:hover { background: #F3F2FF; }
.kd-reset-btn { background: rgba(255, 255, 255, 0.22); color: #fff; }
.kd-reset-btn:hover { background: rgba(255, 255, 255, 0.32); }
.kd-choose-btn:active, .kd-reset-btn:active { transform: translateY(1px); }
.kd-manual-note { margin: 12px 0 0; font-size: 13px; opacity: 0.92; text-align: center; }

/* Keuze-modal */
.kd-choose-sub { color: var(--text-medium, #636E72); font-size: 14px; margin: 0 0 10px; line-height: 1.5; }
.kd-choose-count {
    display: inline-block; font-size: 13px; font-weight: 700;
    color: var(--text-medium, #636E72); background: var(--bg-light, #F1F0FA);
    border-radius: 999px; padding: 5px 14px; margin-bottom: 14px;
}
.kd-choose-count.is-complete { background: #DFF5E3; color: #1E7B3A; }
.kd-choose-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 10px; max-height: 52vh; overflow-y: auto; padding: 2px;
}
.kd-choose-chip {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    border: 2px solid var(--border, #E8E8F0); background: var(--bg-white, #fff);
    border-radius: 14px; padding: 12px 8px 10px; cursor: pointer;
    font-family: inherit; transition: border-color 0.15s, background 0.15s, transform 0.08s;
}
.kd-choose-chip:hover { border-color: #C9C5F0; }
.kd-choose-chip:active { transform: translateY(1px); }
.kd-choose-chip.selected { border-color: var(--primary, #6C63FF); background: #F3F2FF; }
.kd-choose-monster { width: 46px; height: 46px; object-fit: contain; }
.kd-choose-name { font-size: 13px; font-weight: 700; color: var(--text-dark, #2D3436); text-align: center; line-height: 1.2; }
.kd-choose-nr { font-size: 11px; color: var(--text-medium, #636E72); }
.kd-choose-footer { display: flex; gap: 10px; justify-content: flex-end; }
.kd-choose-cancel {
    border: none; background: var(--bg-light, #F1F0FA); color: var(--text-dark, #2D3436);
    border-radius: 10px; padding: 10px 18px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.kd-choose-cancel:hover { background: #E7E5F6; }

/* Instellingen: groepje zelf kiezen */
.kd-settings-status { font-size: 13px; color: var(--text-medium, #636E72); margin: 0 0 10px; line-height: 1.5; }
.kd-settings-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.kd-pick-btn { font-size: 14px; padding: 9px 16px; }
.kd-reset-inline {
    background: var(--bg-light, #F1F0FA); color: var(--text-dark, #2D3436); border: none;
    border-radius: 10px; padding: 9px 16px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.kd-reset-inline:hover { background: #E7E5F6; }
