/* ==========================================================================
   Prosper Digital — shared portal UI layer (portal-ui.css / portal-ui.js)
   Accessibility, mobile tab bar, stacked mobile tables.
   Loaded by every layout after pwa.css. Nothing here changes the default
   look except accessibility fixes (focus ring, reduced motion).
   ========================================================================== */

/* ── Accessibility ───────────────────────────────────────────────────────── */
.pd-skip {
    position: absolute; left: -9999px; top: 0; z-index: 3000;
    background: #1C2340; color: #fff; padding: 10px 16px;
    border-radius: 0 0 10px 0; font-weight: 700; text-decoration: none;
}
.pd-skip:focus { left: 0; }
:focus-visible { outline: 3px solid #2563EB; outline-offset: 2px; }
.pd-sidebar a:focus-visible, [class*="sidebar"] a:focus-visible { outline-color: #FFB27A; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important; animation-iteration-count: 1 !important;
        transition-duration: .01ms !important; scroll-behavior: auto !important;
    }
}

/* ── Mobile bottom tab bar (student portal) ──────────────────────────────── */
.pd-tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035;
    display: flex; background: #fff; border-top: 1px solid #E2E8F0;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -6px 20px rgba(15, 22, 41, .08);
}
.pd-tabbar a {
    flex: 1 1 0; min-width: 0; min-height: 56px; padding: 8px 2px 6px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: #64748B; text-decoration: none; font-size: .75rem; font-weight: 600;
}
.pd-tabbar a i { font-size: 1.25rem; line-height: 1; }
.pd-tabbar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-tabbar a.active { color: #FF6B00; }
@media (max-width: 767.98px) {
    body.has-tabbar { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
    body.has-tabbar .pd-pwa-bar { bottom: calc(72px + env(safe-area-inset-bottom)); }
}

/* ── Tables become cards on phones (opt-in with data-pd-stack) ───────────── */
@media (max-width: 575.98px) {
    table.pd-stacked, table.pd-stacked tbody, table.pd-stacked tr, table.pd-stacked td { display: block; width: 100%; }
    table.pd-stacked thead { position: absolute; left: -9999px; }
    table.pd-stacked tr {
        border: 1px solid #E2E8F0; border-radius: 12px; margin-bottom: 12px;
        padding: 8px 12px; background: #fff;
    }
    table.pd-stacked td {
        display: flex; justify-content: space-between; align-items: center; gap: 12px;
        border: 0 !important; padding: 6px 0 !important; text-align: right;
    }
    table.pd-stacked td::before {
        content: attr(data-label); font-weight: 600; color: #64748B; text-align: left; flex: 0 0 auto;
    }
    table.pd-stacked td:first-child { display: block; text-align: left; }
    table.pd-stacked td:first-child::before, table.pd-stacked td[data-label=""]::before { display: none; }
    table.pd-stacked td:last-child { justify-content: flex-end; flex-wrap: wrap; }
}
