/* Programs 4 All Kids — Parent & Coach portal (mobile-first) */

:root {
    --brand: #0b4f8a;
    --brand-dark: #083a66;
    --accent: #f0a500;
    --bg: #f4f7fb;
    --card: #ffffff;
    --text: #1a2433;
    --muted: #5c6b7a;
    --border: #d8e0ea;
    --ok: #1b7f4a;
    --err: #b42318;
    --radius: 14px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
    --nav-h: 4.25rem;
}

* { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100dvh;
    padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 1rem);
}

a {
    color: var(--brand);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

a:hover { text-decoration: underline; }

.portal-header {
    background: linear-gradient(145deg, var(--brand), var(--brand-dark));
    color: #fff;
    padding: calc(0.85rem + var(--safe-top)) 1rem 0.85rem;
    position: sticky;
    top: 0;
    z-index: 30;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.14);
}

.portal-brand {
    font-weight: 700;
    font-size: 1.08rem;
    letter-spacing: 0.01em;
}

.portal-sub {
    font-size: 0.84rem;
    opacity: 0.92;
    margin-top: 0.15rem;
}

.portal-wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: 1rem 1rem 0.5rem;
}

/* Desktop top nav */
.portal-nav-top {
    display: none;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin: 0.85rem 0 0;
}

.portal-nav-top a {
    display: inline-block;
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 0.82rem;
    text-decoration: none;
    min-height: 2rem;
    line-height: 1.2;
}

.portal-nav-top a:hover { text-decoration: none; background: rgba(255, 255, 255, 0.22); }
.portal-nav-top a.active { background: #fff; color: var(--brand); font-weight: 600; }

/* Mobile bottom tab bar */
.portal-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    min-height: var(--nav-h);
    padding-bottom: var(--safe-bottom);
    background: #fff;
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(16, 24, 40, 0.08);
}

.portal-bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.45rem 0.25rem 0.35rem;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 600;
    text-decoration: none;
    min-width: 0;
    touch-action: manipulation;
}

.portal-bottom-nav a:hover { text-decoration: none; color: var(--brand); }
.portal-bottom-nav a.active { color: var(--brand); }
.portal-bottom-nav .nav-icon {
    font-size: 1.25rem;
    line-height: 1;
}

body.portal-no-bottom-nav {
    padding-bottom: calc(var(--safe-bottom) + 1rem);
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.05rem 1.1rem;
    margin-bottom: 0.9rem;
    box-shadow: 0 1px 4px rgba(16, 24, 40, 0.05);
}

.card h2 {
    margin: 0 0 0.5rem;
    font-size: 1.15rem;
    line-height: 1.3;
}

.card h3 {
    margin: 0 0 0.55rem;
    font-size: 1.02rem;
}

.muted { color: var(--muted); font-size: 0.92rem; }

.flash {
    border-radius: var(--radius);
    padding: 0.8rem 0.95rem;
    margin-bottom: 0.9rem;
    font-size: 0.95rem;
}

.flash.ok { background: #e8f6ee; color: var(--ok); border: 1px solid #b8e6cc; }
.flash.err { background: #fdecec; color: var(--err); border: 1px solid #f5c2c0; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 3rem;
    text-align: center;
    padding: 0.85rem 1rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); text-decoration: none; color: #fff; }
.btn-secondary { background: #e8eef5; color: var(--brand); }
.btn-secondary:hover { text-decoration: none; background: #dce6f2; color: var(--brand-dark); }
.btn-ghost {
    background: transparent;
    color: var(--muted);
    min-height: 2.5rem;
    font-size: 0.9rem;
}
.btn-danger {
    background: #fdecec;
    color: var(--err);
}
.btn-danger:hover {
    background: #f8d7da;
    color: #842029;
    text-decoration: none;
}
.btn-compact {
    width: auto;
    min-height: 2.4rem;
    padding: 0.45rem 0.85rem;
    font-size: 0.9rem;
}

.btn-row { display: grid; gap: 0.6rem; margin-top: 0.8rem; }

.program-reg-item { display: grid; gap: 0.65rem; }
.program-reg-head {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
}
.program-reg-check {
    display: inline-flex;
    align-items: center;
    padding-top: 0.2rem;
}
.program-reg-check input {
    width: 1.15rem;
    height: 1.15rem;
}
.program-reg-main { flex: 1; min-width: 0; }
.program-reg-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0);
    white-space: nowrap; border: 0;
}

.badge.due { background: #fff3cd; color: #856404; }
.badge.paid { background: #e8f6ee; color: var(--ok); }

.calendar-subscribe-card .cal-copy-label {
    margin: 1rem 0 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.cal-copy-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
    align-items: center;
}

.cal-copy-input {
    font-size: 0.85rem;
    min-height: 2.75rem;
}

.cal-instructions {
    margin-top: 0.85rem;
    font-size: 0.88rem;
}

.cal-instructions p {
    margin: 0 0 0.35rem;
}

label {
    display: block;
    font-weight: 600;
    margin: 0.7rem 0 0.35rem;
    font-size: 0.92rem;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="tel"],
textarea,
select {
    width: 100%;
    padding: 0.8rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    background: #fff;
    min-height: 3rem;
}

textarea { min-height: 8rem; resize: vertical; }

input:focus, textarea:focus, select:focus {
    outline: 2px solid rgba(11, 79, 138, 0.35);
    outline-offset: 1px;
    border-color: var(--brand);
}

.list-item {
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border);
}

.list-item:last-child { border-bottom: none; padding-bottom: 0; }

a.list-item-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

a.list-item-link:hover,
a.list-item-link:focus {
    background: #f4f8fc;
    text-decoration: none;
}

.badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    background: #e8eef5;
    color: var(--brand);
    vertical-align: middle;
}

.badge.unread { background: #fff3cd; color: #856404; }

.empty {
    text-align: center;
    padding: 1.35rem 0.5rem;
    color: var(--muted);
}

.meta {
    font-size: 0.86rem;
    color: var(--muted);
    margin-top: 0.3rem;
    line-height: 1.4;
}

.schedule-block {
    margin-top: 1.15rem;
}

.schedule-block:first-of-type {
    margin-top: 0.65rem;
}

.schedule-day {
    margin: 0 0 0.15rem;
    font-size: 1.05rem;
    color: var(--brand);
}

.card-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.card-heading-row h3 {
    margin: 0;
    flex: 1 1 auto;
}

.card-heading-row .btn {
    width: auto;
    min-width: 8.5rem;
    flex: 0 0 auto;
    min-height: 2.6rem;
    padding: 0.55rem 0.9rem;
}

.player-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    margin: 0.45rem 0;
    padding: 0.85rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    font-weight: 600;
    min-height: 3.25rem;
}

.player-toggle input {
    width: 1.25rem;
    height: 1.25rem;
    min-height: 0;
    flex: 0 0 auto;
}

.player-toggle.is-present {
    background: #e7f6ec;
    border-color: #1b7f4a;
}

.recipient-box {
    margin: 1rem 0 0;
    padding: 0.75rem 0.85rem 0.35rem;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.recipient-box legend {
    font-weight: 700;
    padding: 0 0.35rem;
}

.check-row {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    font-weight: 500;
    margin: 0.45rem 0;
}

.check-row input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
    min-height: 0;
    margin-top: 0.15rem;
    flex: 0 0 auto;
}

.portal-footer {
    text-align: center;
    font-size: 0.8rem;
    color: var(--muted);
    margin: 1.25rem 0 0.5rem;
    padding: 0 1rem;
}

/* Install / add-to-home-screen card */
.install-card {
    background: linear-gradient(135deg, #eef4fb 0%, #fff 100%);
    border: 1px dashed #9bb8d9;
}

.install-card summary {
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    touch-action: manipulation;
}

.install-card summary::-webkit-details-marker { display: none; }

.install-steps {
    margin: 0.75rem 0 0;
    padding-left: 1.2rem;
}

.install-steps li {
    margin-bottom: 0.55rem;
    font-size: 0.92rem;
}

.install-dismiss {
    margin-top: 0.75rem;
}

.install-platform { display: none; margin-top: 0.65rem; }
.install-platform.is-visible { display: block; }

@media (min-width: 768px) {
    body {
        padding-bottom: 1.5rem;
    }

    .portal-bottom-nav {
        display: none;
    }

    .portal-nav-top {
        display: flex;
    }

    .btn-row.two {
        grid-template-columns: 1fr 1fr;
    }
}

/* Coach Earnings / Rewards */
.earnings-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 0.85rem;
}
.earnings-stat {
    background: #f0f6ff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
}
.earnings-stat--total {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #0b4f8a, #1470c0);
    color: #fff;
    border-color: transparent;
}
.earnings-stat--total .earnings-stat__label { color: rgba(255,255,255,.85); }
.earnings-stat__label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}
.earnings-stat__value {
    display: block;
    margin-top: 4px;
    font-size: 1.35rem;
    font-weight: 800;
}
.earnings-level-name {
    font-size: 1.25rem;
    font-weight: 800;
    margin: 0 0 0.35rem;
    color: var(--brand);
}
.earnings-level-current {
    border-color: var(--brand);
    background: #eef6ff;
}
.earnings-code-box {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 0.75rem;
}
.earnings-code-box code {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    padding: 10px 14px;
    background: #111827;
    color: #fff;
    border-radius: 10px;
}
.earnings-big-pct {
    font-size: 2rem;
    font-weight: 900;
    margin: 0 0 0.35rem;
    color: var(--brand);
}
.earnings-req-list {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
}
.earnings-req-list li {
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}
.earnings-req-list li.done { color: var(--ok); font-weight: 600; }
.earnings-score-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 0.5rem;
}
.chip {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eef2ff;
    border: 1px solid #e0e7ff;
    font-size: 0.85rem;
}
.earnings-achievements {
    display: grid;
    gap: 10px;
}
.earnings-achievement {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 10px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fafbfd;
    opacity: 0.55;
}
.earnings-achievement.is-earned {
    opacity: 1;
    background: #fff8e8;
    border-color: #f0d48a;
}
.earnings-achievement__icon { font-size: 1.4rem; grid-row: span 2; }
.earnings-tips {
    font-size: 0.95rem;
    line-height: 1.55;
    white-space: normal;
}
.earnings-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.earnings-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.earnings-table th,
.earnings-table td {
    text-align: left;
    padding: 8px 6px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.earnings-table th { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.earnings-table .num { text-align: right; white-space: nowrap; font-weight: 700; }

@media (min-width: 640px) {
    .earnings-summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .earnings-stat--total { grid-column: auto; }
}

