/* ---------------------------------------------------------------------------
   Little Oaks Parent Portal
   Palette drawn from littleoakswaterloo.ca: plum #6b5478 with warm paper
   neutrals and an oak/acorn amber accent. Fraunces for headings, Nunito Sans
   for everything else.
--------------------------------------------------------------------------- */

:root {
    --paper: #f7f4ee;
    --card: #fffdf9;
    --ink: #3a3244;
    --muted: #7c7386;
    --plum: #6b5478;
    --plum-dark: #56425f;
    --plum-tint: #efe9f1;
    --oak: #b9884c;
    --oak-tint: #f4ead9;
    --sage: #63875f;
    --sage-tint: #e7efe4;
    --danger: #a1453e;
    --danger-tint: #f6e6e3;
    --line: #e7e1d6;
    --shadow: 0 1px 2px rgba(58, 50, 68, 0.06), 0 6px 18px rgba(58, 50, 68, 0.07);
    --radius: 16px;
    --radius-small: 10px;
    --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
    --font-body: 'Nunito Sans', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.55;
    color: var(--ink);
    background:
        radial-gradient(1200px 500px at 85% -10%, rgba(107, 84, 120, 0.06), transparent 60%),
        var(--paper);
}

a { color: var(--plum); }

:focus-visible {
    outline: 3px solid var(--oak);
    outline-offset: 2px;
    border-radius: 4px;
}

.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;
}

/* ------------------------------------------------------------------ header */

.site-header {
    background: var(--card);
    border-bottom: 1px solid var(--line);
}

.site-header__inner {
    max-width: 1060px;
    margin: 0 auto;
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.wordmark {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--ink);
}

.wordmark__text {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.05;
    display: flex;
    flex-direction: column;
}

.wordmark__text small {
    font-family: var(--font-body);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--oak);
}

.acorn { flex-shrink: 0; }

.site-nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.site-nav a {
    text-decoration: none;
    font-weight: 600;
    color: var(--ink);
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
}

.site-nav a:hover { background: var(--plum-tint); }

.site-nav a.is-active {
    background: var(--plum);
    color: #fff;
}

.site-nav__user {
    color: var(--muted);
    padding-left: 0.5rem;
    border-left: 1px solid var(--line);
    margin-left: 0.35rem;
}

.site-nav__signout { color: var(--muted); font-weight: 400; }

/* ------------------------------------------------------------------ layout */

.container {
    width: 100%;
    max-width: 1060px;
    margin: 0 auto;
    padding: 1.75rem 1.25rem 3rem;
    flex: 1;
}

.page-head { margin: 0.5rem 0 1.75rem; }

.page-head h1 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.7rem, 3.5vw, 2.3rem);
    margin: 0 0 0.3rem;
}

.page-head h1 em {
    font-style: italic;
    color: var(--plum);
}

.page-head__sub {
    margin: 0;
    color: var(--muted);
    max-width: 55ch;
}

.page-head--row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.section { margin: 2.25rem 0; }

.section__title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.35rem;
    margin: 0 0 0.35rem;
}

.section__sub {
    margin: 0 0 1rem;
    color: var(--muted);
}

.site-footer {
    border-top: 1px solid var(--line);
    padding: 1.25rem;
    text-align: center;
    font-size: 0.82rem;
    color: var(--muted);
}

.site-footer p { margin: 0.15rem 0; }

/* ----------------------------------------------------------------- flashes */

.flash {
    padding: 0.8rem 1rem;
    border-radius: var(--radius-small);
    margin-bottom: 1rem;
    font-weight: 600;
}

.flash--success { background: var(--sage-tint); color: var(--sage); }
.flash--error { background: var(--danger-tint); color: var(--danger); }

/* ------------------------------------------------------------------- cards */

.card-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.child-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.child-card__avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--plum-tint);
    color: var(--plum-dark);
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    flex-shrink: 0;
}

.child-card__meta h3 { margin: 0; font-size: 1.05rem; }
.child-card__meta p { margin: 0.1rem 0 0.35rem; color: var(--muted); font-size: 0.9rem; }

.room-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.18rem 0.6rem;
    border-radius: 999px;
    background: var(--oak-tint);
    color: var(--oak);
}

.room-badge--saplings { background: var(--sage-tint); color: var(--sage); }
.room-badge--little-oaks { background: var(--oak-tint); color: var(--oak); }
.room-badge--mighty-oaks { background: var(--plum-tint); color: var(--plum-dark); }

.camera-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    text-decoration: none;
    color: var(--ink);
    transition: transform 120ms ease, border-color 120ms ease;
}

.camera-card:hover {
    transform: translateY(-2px);
    border-color: var(--plum);
}

.camera-card__screen {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-small);
    display: grid;
    place-items: center;
    background: var(--plum);
    color: #fff;
    flex-shrink: 0;
}

.camera-card__meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.camera-card__name { font-weight: 700; }
.camera-card__location { color: var(--muted); font-size: 0.88rem; }

.live-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sage);
    background: var(--sage-tint);
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    flex-shrink: 0;
}

.live-pill__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--sage);
    animation: live-breathe 2.4s ease-in-out infinite;
}

@keyframes live-breathe {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
    .live-pill__dot { animation: none; }
    .camera-card { transition: none; }
}

/* ------------------------------------------------------------- empty state */

.empty-state {
    background: var(--card);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    text-align: center;
    color: var(--muted);
}

.empty-state p { margin: 0.25rem 0; }

/* ------------------------------------------------------------------ player */

.player-frame {
    position: relative;
    background: #241d2b;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    aspect-ratio: 16 / 9;
}

.player-frame video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.player-frame video.is-offline { visibility: hidden; }

.player-offline {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    gap: 0.25rem;
    text-align: center;
    color: #efe9f1;
    padding: 1.5rem;
}

/* display:grid above would otherwise override the browser's built-in
   [hidden] rule — this keeps the JS's hidden-toggling authoritative. */
.player-offline[hidden] { display: none; }

/* Configuration landing page tiles. */
.config-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}
.config-tile {
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
    background: #fff;
    border: 1px solid rgba(107, 84, 120, 0.14);
    border-radius: 14px;
    padding: 1.1rem 1.2rem;
    text-decoration: none;
    color: inherit;
    transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}
a.config-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(107, 84, 120, 0.14);
    border-color: rgba(107, 84, 120, 0.35);
}
.config-tile__icon {
    flex: 0 0 auto;
    display: grid;
    place-content: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(107, 84, 120, 0.1);
    color: #6b5478;
}
.config-tile__icon .icon { width: 22px; height: 22px; }
.config-tile__body h2 { margin: 0 0 0.25rem; font-size: 1.05rem; }
.config-tile__body p { margin: 0 0 0.6rem; font-size: 0.88rem; color: #6f6770; }
.config-tile--soon { opacity: 0.6; }

/* Icon-only action buttons in listings (tooltip via title, sr-only label). */
.btn--icon {
    padding: 0.42rem 0.55rem;
    line-height: 0;
}
.btn--icon .icon { display: inline-block; vertical-align: middle; }

.player-offline p { margin: 0.2rem 0; }
.player-offline .btn { margin: 0.9rem auto 0; }

.camera-switch {
    margin-top: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.camera-switch__label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.camera-switch__pill {
    text-decoration: none;
    font-weight: 600;
    color: var(--plum-dark);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
}

.camera-switch__pill:hover { border-color: var(--plum); }

/* ----------------------------------------------------------------- buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: var(--radius-small);
    padding: 0.55rem 1.1rem;
    cursor: pointer;
    background: none;
    color: var(--ink);
}

.btn--primary { background: var(--plum); color: #fff; }
.btn--primary:hover { background: var(--plum-dark); }

.btn--secondary {
    background: var(--card);
    border-color: var(--plum);
    color: var(--plum-dark);
}
.btn--secondary:hover { background: var(--plum-tint); }

.btn--ghost { color: var(--plum-dark); }
.btn--ghost:hover { background: var(--plum-tint); }

.btn--danger { color: var(--danger); }
.btn--danger:hover { background: var(--danger-tint); }

.btn--small { font-size: 0.83rem; padding: 0.3rem 0.7rem; }

.btn--block { width: 100%; }

/* ------------------------------------------------------------------- admin */

.admin-nav {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--line);
    margin-bottom: 1.5rem;
}

.admin-nav a {
    text-decoration: none;
    font-weight: 600;
    color: var(--muted);
    padding: 0.55rem 0.9rem;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
}

.admin-nav a:hover { color: var(--ink); }

.admin-nav a.is-active {
    color: var(--plum-dark);
    border-bottom-color: var(--oak);
}

.stat-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    margin-bottom: 1rem;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    text-decoration: none;
    color: var(--ink);
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.stat-card:hover { border-color: var(--plum); }

.stat-card__number {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 600;
    color: var(--plum-dark);
    line-height: 1;
}

.stat-card__number small {
    font-size: 1.1rem;
    color: var(--muted);
    font-weight: 400;
}

.stat-card__label { color: var(--muted); font-weight: 600; }

.quick-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

/* ------------------------------------------------------------------ tables */

.table-wrap {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.94rem;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.data-table thead th {
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--paper);
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table__actions {
    text-align: right;
    white-space: nowrap;
}

.data-table__actions form { display: inline-block; margin-left: 0.25rem; }

.muted { color: var(--muted); }

.code-chip {
    font-size: 0.82rem;
    background: var(--plum-tint);
    color: var(--plum-dark);
    border-radius: 6px;
    padding: 0.12rem 0.45rem;
    word-break: break-all;
}

.status {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}

.status--on { background: var(--sage-tint); color: var(--sage); }
.status--off { background: var(--danger-tint); color: var(--danger); }

/* ------------------------------------------------------------------- forms */

.form-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    max-width: 680px;
}

.form-grid {
    display: grid;
    gap: 0 1rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.form-card div:not(.form-grid):not(.form-actions),
.form-row {
    margin-bottom: 1rem;
}

.form-card label,
.form-row label {
    display: block;
    font-weight: 700;
    font-size: 0.92rem;
    margin-bottom: 0.3rem;
}

.form-card input[type="text"],
.form-card input[type="email"],
.form-card input[type="tel"],
.form-card input[type="password"],
.form-card input[type="date"],
.form-card input[type="number"],
.form-card select,
.form-card textarea,
.form-row input {
    width: 100%;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    padding: 0.6rem 0.75rem;
}

.form-card input:focus,
.form-card select:focus,
.form-card textarea:focus,
.form-row input:focus {
    border-color: var(--plum);
    outline: 3px solid var(--plum-tint);
}

.form-card .help-text,
.form-card .form-help,
.form-card [id$="_help"] {
    display: block;
    font-size: 0.83rem;
    color: var(--muted);
    font-weight: 400;
    margin-top: 0.3rem;
}

/* Symfony renders errors as <ul>; keep them close to the field. */
.form-card ul {
    list-style: none;
    margin: 0.25rem 0 0;
    padding: 0;
    color: var(--danger);
    font-size: 0.86rem;
    font-weight: 600;
}

/* Checkbox groups (children / guardians pickers) */
.form-card input[type="checkbox"] {
    width: auto;
    accent-color: var(--plum);
    margin-right: 0.45rem;
    transform: scale(1.15);
}

.form-card div > div > label { font-weight: 400; }

.form-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
}

/* ------------------------------------------------------------------- login */

.login-page {
    background:
        radial-gradient(900px 420px at 15% -10%, rgba(185, 136, 76, 0.09), transparent 60%),
        radial-gradient(1200px 500px at 85% 110%, rgba(107, 84, 120, 0.10), transparent 60%),
        var(--paper);
}

.login-main {
    display: grid;
    place-items: center;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem 1.75rem;
    margin: 2.5rem 0;
}

.login-card__brand { text-align: center; margin-bottom: 1.5rem; }

.login-card__brand .acorn { width: 44px; height: 44px; }

.login-card__name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.8rem;
    margin: 0.4rem 0 0.15rem;
}

.login-card__tag {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.login-card__tag em { color: var(--plum); }

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.92rem;
    margin: 0.25rem 0 1.25rem;
    cursor: pointer;
}

.checkbox-row input { accent-color: var(--plum); transform: scale(1.15); }

.login-card__help {
    margin: 1.5rem 0 0;
    text-align: center;
    font-size: 0.86rem;
    color: var(--muted);
}

/* ------------------------------------------------------------------ mobile */

@media (max-width: 560px) {
    .site-header__inner { justify-content: center; text-align: center; }
    .page-head--row { align-items: stretch; }
    .page-head--row .btn { align-self: flex-start; }
    .data-table__actions form { margin-top: 0.25rem; }
}
