/* ============================================================
   parent-dashboard.css — Parent Dashboard + Child Profiles (Phase 7).
   NEW file. Offline dashboard styling; inherits app theme tokens
   when present, otherwise ships sensible defaults.
   ============================================================ */

.pd {
  --pd-surface: var(--c-surface, #fff);
  --pd-bg: var(--c-bg, #f6f4ff);
  --pd-border: var(--c-border, #e6e6ef);
  --pd-primary: var(--c-primary, #5b6bff);
  --pd-accent: var(--c-accent, #ff6b9d);
  --pd-muted: var(--c-muted, #8a8aa3);
  --pd-text: var(--c-text, #2b2b3a);
  --pd-danger: var(--c-danger, #ff5a5a);
  font-family: "Noto Kufi Arabic", system-ui, sans-serif; color: var(--pd-text);
  background: var(--pd-bg); min-height: 100%;
}
.pd * { box-sizing: border-box; }

/* header */
.pd-header { padding: 16px 20px 8px; }
.pd-brand { display: flex; align-items: center; gap: 10px; }
.pd-brand__logo { font-size: 26px; }
.pd-brand__title { font-size: 22px; font-weight: 700; color: var(--pd-accent); }
.pd-brand__sub { font-size: 12px; color: var(--pd-muted); margin-top: 2px; }

/* child strip */
.pd-strip { display: flex; gap: 12px; overflow-x: auto; padding: 10px 20px 14px; }
.pd-childcard {
  --child: var(--pd-primary);
  flex: 0 0 auto; width: 120px; background: var(--pd-surface); border: 2px solid var(--pd-border);
  border-radius: 18px; padding: 12px; cursor: pointer; font: inherit; text-align: center; position: relative;
  transition: transform .12s ease;
}
.pd-childcard:hover { transform: translateY(-3px); }
.pd-childcard.is-active { border-color: var(--child); box-shadow: 0 8px 20px color-mix(in srgb, var(--child) 30%, transparent); }
.pd-childcard__avatar { font-size: 40px; display: block; }
.pd-childcard__name { font-weight: 700; margin-top: 4px; }
.pd-childcard__age { font-size: 12px; color: var(--pd-muted); }
.pd-childcard__edit { position: absolute; top: 6px; inset-inline-start: 6px; font-size: 13px; color: var(--pd-muted); }
.pd-childcard--add { border-style: dashed; color: var(--pd-primary); display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* content */
.pd-content { padding: 0 20px 40px; }

/* overview header */
.pd-overview {
  --child: var(--pd-primary);
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: linear-gradient(135deg, color-mix(in srgb, var(--child) 22%, #fff), var(--pd-surface));
  border: 1px solid var(--pd-border); border-radius: 22px; padding: 16px 20px; margin-bottom: 16px;
}
.pd-overview__avatar { font-size: 56px; }
.pd-overview__info { flex: 1; min-width: 140px; }
.pd-overview__name { font-size: 22px; font-weight: 700; }
.pd-overview__meta { font-size: 13px; color: var(--pd-muted); margin-top: 2px; }
.pd-overview__actions { display: flex; gap: 8px; }

/* stat tiles */
.pd-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; margin-bottom: 18px; }
.pd-tile {
  --tile: var(--pd-primary);
  background: var(--pd-surface); border: 1px solid var(--pd-border); border-radius: 18px;
  padding: 14px; text-align: center; border-top: 4px solid var(--tile);
}
.pd-tile__icon { font-size: 24px; }
.pd-tile__value { font-size: 26px; font-weight: 700; color: var(--tile); }
.pd-tile__label { font-size: 12px; color: var(--pd-muted); }

/* card grid */
.pd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.pd-card { background: var(--pd-surface); border: 1px solid var(--pd-border); border-radius: 20px; padding: 16px; }
.pd-card__title { margin: 0 0 12px; font-size: 16px; font-weight: 700; }
.pd-chartcard .pd-chart { width: 100%; }

/* achievements */
.pd-badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.pd-badge { text-align: center; padding: 10px 6px; border-radius: 16px; background: var(--pd-bg); border: 1px solid var(--pd-border); }
.pd-badge.is-locked { opacity: .5; filter: grayscale(1); }
.pd-badge.is-unlocked { background: linear-gradient(160deg, #fff7e6, #fff); border-color: #ffe0a3; }
.pd-badge__icon { font-size: 30px; }
.pd-badge__title { font-size: 11px; font-weight: 700; margin-top: 4px; }

/* favorite colors / categories */
.pd-favcolors { display: flex; gap: 10px; flex-wrap: wrap; }
.pd-favcolor { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.pd-favcolor__sw { width: 38px; height: 38px; border-radius: 12px; border: 2px solid rgba(0,0,0,.12); }
.pd-favcolor__n { font-size: 12px; font-weight: 700; color: var(--pd-muted); }
.pd-catlist, .pd-items { display: flex; flex-direction: column; gap: 8px; }
.pd-catrow { display: flex; align-items: center; gap: 10px; }
.pd-catrow__emoji { font-size: 22px; }
.pd-catrow__title { flex: 1; font-weight: 700; }
.pd-catrow__count { color: var(--pd-muted); font-weight: 700; }

/* item lists */
.pd-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: start; background: var(--pd-bg); border: 1px solid var(--pd-border); border-radius: 14px; padding: 10px 12px; cursor: pointer; font: inherit; }
.pd-item:hover { border-color: var(--pd-primary); }
.pd-item__emoji { font-size: 24px; }
.pd-item__title { font-weight: 700; }

/* empty */
.pd-empty { display: flex; align-items: center; gap: 8px; color: var(--pd-muted); font-size: 14px; padding: 10px 2px; }
.pd-empty__emoji { font-size: 22px; }

/* no profiles */
.pd-noprofiles { text-align: center; padding: 60px 20px; }
.pd-noprofiles__emoji { font-size: 64px; }
.pd-noprofiles h2 { margin: 12px 0 6px; }
.pd-noprofiles p { color: var(--pd-muted); max-width: 420px; margin: 0 auto 18px; }

/* buttons */
.pd-btn { font: inherit; font-weight: 700; cursor: pointer; border: none; border-radius: 30px; padding: 9px 16px; background: var(--pd-bg); color: var(--pd-text); }
.pd-btn--primary { background: var(--pd-primary); color: #fff; }
.pd-btn--ghost { background: var(--pd-surface); border: 2px solid var(--pd-border); color: var(--pd-primary); }
.pd-btn--danger { background: #fff; border: 2px solid #ffd0d0; color: var(--pd-danger); }
.pd-btn--lg { padding: 13px 26px; font-size: 17px; }

/* editor / dialog */
.pd-backdrop { position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(20,20,40,.5); opacity: 0; transition: opacity .2s ease; }
.pd-backdrop.is-open { opacity: 1; }
.pd-dialog { background: var(--pd-surface); color: var(--pd-text); border-radius: 22px; width: 100%; max-width: 440px; padding: 22px; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.pd-dialog__title { margin: 0 0 14px; color: var(--pd-accent); }
.pd-field { display: block; margin-bottom: 14px; }
.pd-field > span { display: block; font-size: 13px; font-weight: 700; color: var(--pd-muted); margin-bottom: 6px; }
.pd-field__input { width: 100%; font: inherit; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--pd-border); outline: none; }
.pd-field__input:focus { border-color: var(--pd-primary); }
.pd-avatars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.pd-avatar { font-size: 24px; padding: 6px; border-radius: 12px; border: 2px solid var(--pd-border); background: var(--pd-surface); cursor: pointer; }
.pd-avatar.is-active { border-color: var(--pd-primary); background: color-mix(in srgb, var(--pd-primary) 12%, #fff); }
.pd-colors { display: flex; gap: 6px; flex-wrap: wrap; }
.pd-color { width: 34px; height: 34px; border-radius: 10px; border: 2px solid rgba(0,0,0,.12); cursor: pointer; }
.pd-color.is-active { outline: 3px solid var(--pd-text); }
.pd-editor__err { color: var(--pd-danger); font-size: 13px; font-weight: 700; min-height: 18px; }
.pd-dialog__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 10px; }
.pd-confirm__text { color: var(--pd-muted); }

@media (max-width: 620px) {
  .pd-tiles { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .pd-grid { grid-template-columns: 1fr; }
}
