/* ============================================================
   components.css — reusable UI: nav shell, buttons, tables, cards.
   New mobile-first shell (top bar + bottom tab bar + More sheet)
   lives here; legacy menu-strip styles are kept (unused by the new
   nav) so nothing that still references them regresses.
   ============================================================ */

/* ---------- Top bar (slim, always visible) ---------- */
.lr-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}

.lr-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    min-height: var(--topbar-h);
}

.lr-topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.lr-topbar-actions .lr-userline {
    font-weight: 700;
    color: var(--c-text-muted);
    white-space: nowrap;
}

.lr-logout-btn {
    border: 1px solid var(--c-border);
    background: #f8fafc;
    color: var(--c-text);
    border-radius: var(--radius-pill);
    padding: 6px 16px;
    font-weight: 700;
    min-height: var(--tap-min);
}

.lr-logout-btn:hover { background: #eef2f7; }

/* ---------- Desktop role nav (horizontal sub-bar) ---------- */
.lr-desktop-nav {
    background: linear-gradient(180deg, #f8fbff 0%, #eaf2ff 100%);
    border-bottom: 1px solid #dbeafe;
}

.lr-desktop-nav-inner {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: 12px 0;
}

.lr-nav-group-label {
    align-self: center;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-right: var(--space-2);
}

.lr-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: var(--radius-pill);
    font-weight: 700;
    padding: 9px 16px;
    min-height: var(--tap-min);
    background: #f8fafc;
    color: #374151;
    border: 1px solid #d1d5db;
    text-decoration: none;
    transition: transform 0.16s ease, box-shadow 0.16s ease;
    position: relative;
}

.lr-nav-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.1);
}

.lr-nav-link.active {
    color: #ffffff;
    background: linear-gradient(135deg, #2563eb, var(--c-kid-accent));
    border-color: transparent;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
}

.lr-nav-link.lr-nav-chat {
    background: linear-gradient(135deg, #6c63ff 0%, #3b7bff 55%, #00d4ff 100%);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
    font-weight: 900;
}

/* ---------- Mobile bottom tab bar ---------- */
.lr-tabbar {
    display: none; /* shown only on mobile */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    background: var(--c-surface);
    border-top: 1px solid var(--c-border);
    box-shadow: var(--shadow-pop);
    padding-bottom: var(--safe-bottom); /* clears the iOS home indicator */
}

.lr-tabbar-inner {
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    min-height: var(--tabbar-h);
}

.lr-tab {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: var(--c-text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    background: none;
    border: none;
    position: relative;
    min-height: var(--tap-kid);
}

.lr-tab .lr-tab-icon { font-size: 1.4rem; line-height: 1; }

.lr-tab.active { color: var(--c-kid-accent); }

.lr-parent-mode .lr-tab.active,
.lr-parent-mode .lr-nav-link.active { background-image: none; }

.lr-parent-mode .lr-nav-link.active {
    background: linear-gradient(135deg, #0284c7, var(--c-parent-accent));
}

.lr-parent-mode .lr-tab.active { color: var(--c-parent-accent); }

/* Tab + nav chat unread badge */
.lr-tab-badge,
.family-chat-menu-badge {
    position: absolute;
    top: -7px;
    right: -7px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--radius-pill);
    background: #ef4444;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.35);
}

.lr-tab .family-chat-menu-badge { top: 4px; right: 50%; margin-right: -26px; }

/* ---------- "More" sheet (mobile) ---------- */
.lr-more-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.lr-more-backdrop.open { opacity: 1; pointer-events: auto; }

.lr-more-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1060;
    background: var(--c-surface);
    border-radius: 22px 22px 0 0;
    box-shadow: var(--shadow-pop);
    padding: var(--space-4) var(--space-3) calc(var(--space-4) + var(--safe-bottom));
    transform: translateY(110%);
    transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
    max-height: 80dvh;
    overflow-y: auto;
}

.lr-more-sheet.open { transform: translateY(0); }

.lr-more-grabber {
    width: 44px;
    height: 5px;
    border-radius: var(--radius-pill);
    background: #d1d5db;
    margin: 0 auto var(--space-3);
}

.lr-more-title {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: var(--space-3) 0 var(--space-2);
}

.lr-more-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px;
    border-radius: var(--radius-card);
    text-decoration: none;
    color: var(--c-text);
    font-weight: 700;
    min-height: var(--tap-min);
}

.lr-more-link:hover { background: #f8fafc; }
.lr-more-link .lr-more-ico { font-size: 1.3rem; }

/* ---------- Landing splash (anonymous) ---------- */
.lr-splash {
    text-align: center;
    padding: clamp(24px, 8vw, 64px) 16px;
}

.lr-splash-star {
    font-size: clamp(3rem, 14vw, 5rem);
    line-height: 1;
}

.lr-splash-title {
    font-size: var(--font-display);
    font-weight: 900;
    color: var(--c-text-strong);
    margin: var(--space-3) 0 var(--space-1);
}

.lr-splash-tag {
    color: var(--c-text-muted);
    font-weight: 700;
    margin-bottom: var(--space-4);
}

.lr-splash .btn-signin {
    background: linear-gradient(135deg, var(--c-brand-1), var(--c-brand-2));
    color: #fff;
    border: none;
    border-radius: var(--radius-pill);
    font-weight: 800;
    padding: 14px 40px;
    min-height: var(--tap-kid);
    box-shadow: 0 10px 24px rgba(79, 70, 229, 0.3);
}

/* ---------- Responsive list (A.2): table on desktop, cards on mobile ---------- */
.lr-card-list { display: none; } /* desktop uses the real <table>; mobile flips */

.lr-mobile-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-card);
    padding: var(--space-3);
    box-shadow: var(--shadow-card);
    margin-bottom: var(--space-2);
}

/* ---------- Tables inside reports ---------- */
.table { background: var(--c-surface); }
.table thead th { vertical-align: middle; }

/* ---------- weekday checkbox (automation rules) ---------- */
.weekday-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 8px;
    background: #f8fafc;
    border: 1px solid var(--c-border);
    border-radius: 14px;
    padding: 12px;
}

.weekday-checkbox-grid label {
    font-weight: 700;
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ---------- Responsive switch ---------- */
@media (min-width: 769px) {
    .lr-tabbar, .lr-more-sheet, .lr-more-backdrop { display: none !important; }
}

@media (max-width: 768px) {
    .lr-desktop-nav { display: none; }
    .lr-tabbar { display: block; }
    .lr-topbar-actions .lr-userline { display: none; }

    /* A.2 — hide wide tables, show stacked cards */
    .lr-responsive-table { display: none; }
    .lr-card-list { display: block; }
}

/* ============================================================
   Legacy menu-strip styles — retained from the pre-Phase-2 shell.
   The new nav does not use these, but they are kept (in their
   original specificity order) so any lingering reference and the
   documented `.app-menu-btn.wechat-menu-btn` override still hold.
   Candidate for removal in Phase 5.
   ============================================================ */
.main-menu-strip { background: linear-gradient(180deg, #f8fbff 0%, #eaf2ff 100%); border-bottom: 1px solid #dbeafe; }
.admin-menu-strip { background: #f8fafc; }
.menu-section-title {
    font-size: 0.78rem; font-weight: 800; color: var(--c-text-muted);
    text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 10px;
}

.app-menu-btn {
    border-radius: var(--radius-pill);
    font-weight: 700;
    opacity: 1;
    padding: 10px 16px;
    min-width: 145px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
    transition: all 0.18s ease-in-out;
}

.app-menu-btn:hover { transform: translateY(-1px); box-shadow: 0 9px 20px rgba(15, 23, 42, 0.12); }

.app-menu-btn.active-menu {
    color: #ffffff !important;
    background: linear-gradient(135deg, #2563eb, #7c3aed) !important;
    border-color: transparent !important;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
    transform: translateY(-1px);
}

.app-menu-btn.inactive-menu {
    background: #f8fafc !important;
    color: #374151 !important;
    border-color: #d1d5db !important;
}

/* WeChat button — two-class selector matches .app-menu-btn.inactive-menu specificity. */
.app-menu-btn.wechat-menu-btn,
.app-menu-btn.wechat-menu-btn.inactive-menu {
    background: linear-gradient(135deg, #6c63ff 0%, #3b7bff 55%, #00d4ff 100%) !important;
    color: #ffffff !important;
    border: 1.5px solid rgba(255, 255, 255, 0.30) !important;
    font-weight: 900 !important;
    letter-spacing: 0.04em;
    box-shadow: 0 5px 20px rgba(108, 99, 255, 0.60), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.20);
    animation: wechat-float 3s ease-in-out infinite;
}

.app-menu-btn.wechat-menu-btn:hover,
.app-menu-btn.wechat-menu-btn.inactive-menu:hover {
    background: linear-gradient(135deg, #5b52ef 0%, #2a6aff 55%, #00bce8 100%) !important;
    box-shadow: 0 10px 32px rgba(108, 99, 255, 0.80), inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
    transform: translateY(-3px) scale(1.06) !important;
    animation: none !important;
}

@keyframes wechat-float {
    0%, 100% { transform: translateY(0px); box-shadow: 0 5px 20px rgba(108, 99, 255, 0.60), inset 0 1px 0 rgba(255,255,255,0.25); }
    50% { transform: translateY(-5px); box-shadow: 0 12px 32px rgba(108, 99, 255, 0.80), inset 0 1px 0 rgba(255,255,255,0.25); }
}
