/* ============================================================================
   kids-menu.css — shared child-selector badge + dropdown for Kids pages
   ----------------------------------------------------------------------------
   The top-right trigger shows the active child's avatar + first name as a soft
   white pill; tapping it opens a dropdown with the child switcher (rows appear
   only with 2+ kids) and a Settings entry (Settings leaves Kids Mode, so it's
   gated behind the parent math challenge). Markup is built by js/kids-menu.js.

   Used by the kids home (kids.html) and the kids coloring page
   (coloring/kids-coloring.html). Relies on the --ink / --sun / --coral /
   --soft-shadow tokens, which both pages' stylesheets define.
   ============================================================================ */

/* Pinned to the very top-right of the screen (mirrors the bottom-right sky
   picker). Fixed positioning also anchors the dropdown panel below it. */
.kids-menu {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 70;
}

/* ---- Trigger: a soft white pill (avatar + first name) -------------------- */
.kids-menu-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.82);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 2px solid #fff;
    border-radius: 100px;
    padding: 5px 14px 5px 6px;
    box-shadow: var(--soft-shadow);
    cursor: pointer;
    font-family: 'Baloo 2', cursive;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.kids-menu-badge:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 10px 22px rgba(52, 70, 107, 0.22); }
.kids-menu-badge:active { transform: translateY(0) scale(0.98); }
.kids-menu-badge--compact { padding: 5px; }   /* no name → round avatar button */

.kids-menu-badge-avatar {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: #EAF6FF;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(52, 70, 107, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
}
.kids-menu-badge-avatar img,
.kids-menu-badge-avatar svg { width: 100%; height: 100%; object-fit: contain; display: block; }

.kids-menu-badge-name {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
    max-width: 9ch;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kids-menu-badge-name:empty { display: none; }

/* ---- Dropdown panel: child switcher + Settings -------------------------- */
.kids-menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 16px 42px rgba(52, 70, 107, 0.28);
    padding: 8px;
    z-index: 50;
    animation: kidsMenuPop 0.16s ease both;
}
@keyframes kidsMenuPop {
    from { opacity: 0; transform: translateY(-6px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}

/* Child rows (only present when there are 2+ kids) */
.kids-switcher { display: flex; flex-direction: column; gap: 2px; }
.kids-switcher:not(:empty) {
    padding-bottom: 6px;
    margin-bottom: 6px;
    border-bottom: 2px solid #F0F2F7;
}
.kids-menu-kid {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 7px 10px;
    border-radius: 12px;
    font-family: 'Baloo 2', cursive;
    font-weight: 700;
    font-size: 15px;
    color: var(--ink);
    text-align: left;
    transition: background 0.12s ease;
}
.kids-menu-kid:hover { background: #F4F6FB; }
.kids-menu-kid.active { background: rgba(255, 216, 107, 0.28); }
.kids-menu-kid-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kids-menu-kid-check { color: var(--coral); font-size: 16px; }

.kids-switcher-avatar {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    background: #fff;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(52, 70, 107, 0.18);
}
.kids-menu-kid.active .kids-switcher-avatar {
    border-color: var(--sun);
    box-shadow: 0 0 0 3px rgba(255, 216, 107, 0.6);
}
.kids-switcher-avatar img,
.kids-switcher-avatar svg { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Settings row → routes to the parent section through the math gate */
.kids-menu-settings {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 9px 10px;
    border-radius: 12px;
    font-family: 'Baloo 2', cursive;
    font-weight: 700;
    font-size: 15px;
    color: var(--ink);
    text-align: left;
    transition: background 0.12s ease;
}
.kids-menu-settings:hover { background: #F4F6FB; }
.kids-menu-gear { font-size: 18px; }
