/*
 * Arkkids Ouderportaal — portal.css
 * Mobielvriendelijk, toegankelijk, minimaal afhankelijk van thema-stijlen.
 *
 * Breakpoints:
 *   < 480px  → volledig scherm
 *   480px+   → gecentreerd, max 680px
 */

/* ── Reset / basis ─────────────────────────────────────────────────────────── */
.aop-wrap *,
.aop-wrap *::before,
.aop-wrap *::after {
  box-sizing: border-box;
}

.aop-wrap {
  max-width: min(680px, 96vw);
  margin: 0 auto;
  padding: 1rem;
  font-family: sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: #1a1a2e;
}

/* ── Knoppen ────────────────────────────────────────────────────────────────── */
.aop-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.5rem 1.25rem;
  border: 2px solid transparent;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.aop-btn--primary {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}
.aop-btn--primary:hover,
.aop-btn--primary:focus {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.aop-btn--ghost {
  background: transparent;
  color: #2563eb;
  border-color: #2563eb;
}
.aop-btn--ghost:hover,
.aop-btn--ghost:focus {
  background: #eff6ff;
}

.aop-btn--save {
  background: #16a34a;
  color: #fff;
  border-color: #16a34a;
  font-size: 0.9rem;
  min-height: 40px;
  padding: 0.4rem 1rem;
}
.aop-btn--save:hover,
.aop-btn--save:focus {
  background: #15803d;
  border-color: #15803d;
}

.aop-btn--sm {
  min-height: 36px;
  padding: 0.3rem 0.8rem;
  font-size: 0.875rem;
}

/* Vierkante icoon-knop (bv. help-icoon) */
.aop-btn--icon {
  min-width: 36px;
  padding: 0.3rem;
  font-size: 1.1rem;
  line-height: 1;
}

/* Visueel verborgen, wel voorleesbaar door screenreaders */
.aop-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Invoervelden ───────────────────────────────────────────────────────────── */
.aop-input {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
  color: #1a1a2e;
  background: #fff;
  transition: border-color 0.15s;
}
.aop-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.aop-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  color: #374151;
}

.aop-form-group {
  margin-bottom: 1rem;
}

/* ── Inlogscherm ────────────────────────────────────────────────────────────── */
.aop-login__title {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: #1a1a2e;
}

.aop-login__intro {
  color: #6b7280;
  margin-bottom: 1.25rem;
}

.aop-step {
  padding: 1.5rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  margin-bottom: 1.5rem;
}

.aop-step--hidden {
  display: none;
}

/* 6-cijferige code-invoer */
.aop-code-inputs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: nowrap;
}

.aop-code-digit {
  flex: 1 1 0;
  min-width: 0;
  min-height: 60px;
  max-width: 60px;
  padding: 0;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  color: #1a1a2e;
  background: #fff;
  transition: border-color 0.15s;
}
.aop-code-digit:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ── Berichten (feedback) ─────────────────────────────────────────────────── */
.aop-message {
  margin-top: 0.75rem;
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  font-size: 0.9rem;
  min-height: 1.5rem;
}
.aop-message:empty { display: none; }
.aop-message--success { background: #dcfce7; color: #166534; }
.aop-message--error   { background: #fee2e2; color: #991b1b; }
.aop-message--info    { background: #dbeafe; color: #1e40af; }

.aop-notice {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: #fef9c3;
  border: 1px solid #fde047;
  color: #713f12;
  margin-bottom: 1rem;
}
.aop-notice--error {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

/* ── Portaal: header ────────────────────────────────────────────────────────── */
.aop-portal__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.aop-portal__greeting {
  flex: 1;
  font-size: 1rem;
  color: #1e40af;
}

.aop-session-timer {
  font-size: 0.8rem;
  color: #6b7280;
}

/* ── Kind-kaart ─────────────────────────────────────────────────────────────── */
.aop-child-card {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 2rem;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.aop-child-card__header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  margin: -1.1rem -1.5rem 1.1rem;
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  border-bottom: 1px solid #e5e7eb;
}

.aop-child-card__photo-wrap {
  flex-shrink: 0;
}

.aop-child-card__photo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.aop-child-card__emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #dbeafe;
  font-size: 2.2rem;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.aop-child-card__name {
  margin: 0 0 0.35rem;
  font-size: 1.3rem;
  font-weight: 700;
  color: #1a1a2e;
}

.aop-child-card__meta {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* Groep-tags */
.aop-tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
  background: #e5e7eb;
  color: #374151;
}
.aop-tag--rood   { background: #fee2e2; color: #991b1b; }
.aop-tag--oranje { background: #ffedd5; color: #9a3412; }
.aop-tag--geel   { background: #fef9c3; color: #713f12; }
.aop-tag--groen  { background: #dcfce7; color: #166534; }
.aop-tag--blauw  { background: #dbeafe; color: #1e40af; }
.aop-tag--paars  { background: #ede9fe; color: #5b21b6; }

/* ── Secties binnen kind-kaart ───────────────────────────────────────────────── */

/* ── Aanwezigheid ────────────────────────────────────────────────────────────── */
.aop-presence-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}
.aop-presence-table th {
  text-align: left;
  padding: 0.3rem 0.5rem;
  color: #6b7280;
  font-weight: 600;
  font-size: 0.8rem;
  border-bottom: 1px solid #e5e7eb;
}
.aop-presence-table td {
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid #f3f4f6;
}

.aop-presence-total {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: #374151;
}

/* ── Checkboxes allergieën ───────────────────────────────────────────────────── */
.aop-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.4rem 0.75rem;
  margin-bottom: 0.75rem;
}

.aop-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.9rem;
  user-select: none;
}

.aop-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #2563eb;
}

/* ── Radio-buttons mediatoestemming ─────────────────────────────────────────── */
.aop-radio-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-right: 1rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.aop-radio-label input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #2563eb;
}

/* ── Save-status ─────────────────────────────────────────────────────────────── */
.aop-save-status {
  display: inline-block;
  margin-left: 0.75rem;
  font-size: 0.85rem;
  color: #16a34a;
  vertical-align: middle;
  min-height: 1.2em;
}
.aop-save-status--error { color: #dc2626; }

/* ── Alleen-lezen blok ──────────────────────────────────────────────────────── */
.aop-readonly-block {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: #374151;
  white-space: pre-wrap;
}

/* ── Jeugdwerkers ────────────────────────────────────────────────────────────── */
.aop-workers-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.aop-worker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.aop-worker__name { font-weight: 600; }

.aop-worker__phone {
  color: #2563eb;
  text-decoration: none;
  font-size: 0.875rem;
}
.aop-worker__phone:hover { text-decoration: underline; }

/* ── Berichten ───────────────────────────────────────────────────────────────── */
.aop-messages-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.aop-message-item {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  transition: box-shadow 0.15s;
}
.aop-message-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

.aop-message-item--unread {
  border-color: #93c5fd;
  background: #eff6ff;
}

/* Korte highlight wanneer een bericht via de kalender wordt geopend */
.aop-message-item--highlight {
  animation: aop-msg-flash 1.5s ease-out;
}
@keyframes aop-msg-flash {
  0%   { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.45); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

/* Berichtitem is een <details>; <summary> = header */
.aop-msg-collapsible > summary.aop-message-item__header {
  list-style: none;
  cursor: pointer;
  -webkit-appearance: none;
}
.aop-msg-collapsible > summary.aop-message-item__header::-webkit-details-marker {
  display: none;
}
.aop-msg-collapsible[open] > summary.aop-message-item__header {
  border-bottom: 1px solid #e5e7eb;
}

.aop-message-item__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.9rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.aop-message-item__subject {
  font-weight: 600;
  font-size: 0.95rem;
  color: #1a1a2e;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
/* Pijltje dat aangeeft of het bericht open/dicht is */
.aop-message-item__subject::before {
  content: '›';
  display: inline-block;
  font-size: 1.1rem;
  color: #9ca3af;
  transform: rotate(0deg);
  transition: transform 0.2s;
  margin-right: 0.1rem;
}
.aop-msg-collapsible[open] .aop-message-item__subject::before {
  transform: rotate(90deg);
}

.aop-message-item__date {
  font-size: 0.8rem;
  color: #6b7280;
  white-space: nowrap;
}

.aop-message-item__body {
  padding: 0.75rem 0.9rem;
  font-size: 0.9rem;
  color: #374151;
  white-space: pre-line;
}

.aop-badge {
  display: inline-block;
  background: #2563eb;
  color: #fff;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  vertical-align: middle;
}

/* ── Diverse hulpklassen ────────────────────────────────────────────────────── */
.aop-muted {
  color: #9ca3af;
  font-style: italic;
}

/* ── Responsief < 480px ─────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .aop-wrap {
    padding: 0.75rem 0.5rem;
    max-width: 100%;
  }

  .aop-child-card__header {
    padding: 1rem;
  }

  .aop-code-digit {
    max-width: none;
  }

  .aop-portal__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .aop-checkbox-grid {
    grid-template-columns: 1fr 1fr;
  }

  .aop-radio-label {
    display: flex;
    margin-right: 0;
    margin-bottom: 0.4rem;
  }

  .aop-btn {
    width: 100%;
    margin-bottom: 0.5rem;
  }

  .aop-message-item__header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Tabbladen per kind (v1.5.0)
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Tabbalk (desktop) ── */
.aop-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.6rem 0.75rem 0;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.aop-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.85rem;
  border-radius: 8px 8px 0 0;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  color: #6b7280;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  margin-bottom: -1px;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.aop-tab:hover {
  background: #f3f4f6;
  color: #374151;
}
.aop-tab:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.aop-tab__icon {
  font-size: 1rem;
  line-height: 1;
}

/* Actieve tab: lijkt op het paneel ervan, "vastgeplakt" aan de panel-rand */
.aop-tab.aop-tab--active {
  background: #fff;
  color: #1d4ed8;
  border-color: #e5e7eb;
  box-shadow: 0 -2px 6px rgba(0,0,0,0.03);
}

.aop-badge--tab {
  background: #2563eb;
  color: #fff;
  border-radius: 99px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.05rem 0.4rem;
  line-height: 1.4;
}

/* ── Tab-dropdown (mobiel) ── */
.aop-tabs-mobile {
  display: none;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.aop-tabs-mobile__select {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a2e;
  background: #fff;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.1rem;
  padding-right: 2.25rem;
}
.aop-tabs-mobile__select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ── Tab-panels ── */
.aop-tab-panels {
  padding: 1.1rem 1.5rem;
}

.aop-tab-panel {
  display: none;
}
.aop-tab-panel.aop-tab-panel--active {
  display: block;
  animation: aop-tab-fade 0.15s ease-out;
}
@keyframes aop-tab-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Sub-kopjes binnen een tab-panel (bv. geboortedatum binnen Profiel) */
.aop-panel-section {
  margin-top: 1rem;
}
.aop-panel-section__title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #6b7280;
  margin: 0 0 0.5rem;
}
.aop-panel-intro {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: #6b7280;
}

/* ── Mobiel: tabbalk verbergen, dropdown tonen ── */
@media (max-width: 640px) {
  .aop-tabs {
    display: none;
  }
  .aop-tabs-mobile {
    display: block;
  }
  .aop-tab-panels {
    padding: 1rem;
  }
  .aop-child-card__header {
    margin: -1rem -1rem 1rem;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Berichten-kalender (v1.2.0)
   ══════════════════════════════════════════════════════════════════════════ */

.aop-calendar {
  margin-bottom: 1.25rem;
  user-select: none;
  max-width: 280px;
}

/* Header: ‹ Maand Jaar › */
.aop-cal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.aop-cal__title {
  font-weight: 700;
  font-size: 0.82rem;
  color: #1a1a2e;
}

.aop-cal__nav {
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  width: 24px;
  height: 24px;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  color: #374151;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
}
.aop-cal__nav:hover { background: #f3f4f6; }

/* 7-koloms grid */
.aop-cal__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}

.aop-cal__dayname {
  text-align: center;
  font-size: 0.62rem;
  font-weight: 700;
  color: #9ca3af;
  padding: 0.15rem 0;
  text-transform: uppercase;
}

.aop-cal__cell {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  font-size: 0.7rem;
  color: #374151;
  transition: background 0.1s;
}

.aop-cal__cell--empty { pointer-events: none; }

.aop-cal__cell--today {
  background: #eff6ff;
  font-weight: 700;
  color: #1d4ed8;
}

.aop-cal__cell--has-msg {
  cursor: pointer;
}
.aop-cal__cell--has-msg:hover,
.aop-cal__cell--has-msg:focus-visible {
  background: #dbeafe;
  outline: none;
}

/* Dagnummer */
.aop-cal__day-num {
  line-height: 1;
}

/* Blauw bolletje */
.aop-cal__dot {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #2563eb;
  margin-top: 1px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Help-modal (v1.4.0)
   ══════════════════════════════════════════════════════════════════════════ */

.aop-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}

.aop-modal-overlay[hidden] {
  display: none;
}

.aop-modal {
  background: #fff;
  border-radius: 14px;
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}

.aop-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.aop-modal__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #1a1a2e;
}

.aop-modal__close {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: #6b7280;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  transition: background 0.12s, color 0.12s;
}
.aop-modal__close:hover,
.aop-modal__close:focus-visible {
  background: #f3f4f6;
  color: #1a1a2e;
  outline: none;
}

.aop-modal__body {
  padding: 1rem 1.25rem 1.25rem;
  overflow-y: auto;
}

.aop-modal__body > p:first-child {
  margin-top: 0;
  color: #374151;
  font-size: 0.9rem;
}

/* Help-items: zelfde visuele taal als de hoofdsecties, maar compacter */
.aop-help-item {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  overflow: hidden;
}
.aop-help-item:last-child { margin-bottom: 0; }

.aop-help-item > summary {
  list-style: none;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: #1a1a2e;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  background: #f9fafb;
}
.aop-help-item > summary::-webkit-details-marker { display: none; }
.aop-help-item > summary::before {
  content: '›';
  display: inline-block;
  font-size: 1.1rem;
  color: #9ca3af;
  margin-right: 0.4rem;
  transform: rotate(0deg);
  transition: transform 0.2s;
}
.aop-help-item[open] > summary::before {
  transform: rotate(90deg);
}
.aop-help-item[open] > summary {
  border-bottom: 1px solid #e5e7eb;
}

.aop-help-item__body {
  padding: 0.7rem 0.9rem;
  font-size: 0.85rem;
  color: #374151;
  line-height: 1.5;
}
.aop-help-item__body p {
  margin: 0;
}

@media (max-width: 480px) {
  .aop-modal {
    max-height: 90vh;
    border-radius: 12px;
  }
  .aop-modal__body {
    padding: 0.75rem 1rem 1rem;
  }
}
