/*
 * Family Hub design tokens
 *
 * Palette: Bootstrap 5 defaults (we stay native)
 *   Primary  #0d6efd  - links, brand chrome, primary chips/badges
 *   Success  #198754  - action green (.btn-primary, money emphasis)
 *   Info     #0dcaf0  - subtle info chips
 *   Border   #e9ecef  - subtle dividers / card borders
 *   Text     #212529  - body text
 *   Muted    #6c757d  - secondary text / labels
 *
 * Type scale (tightened vs Bootstrap defaults for mobile-first density)
 *   h1 2rem    (32px) / 700
 *   h2 1.5rem  (24px) / 600
 *   h3 1.375rem(22px) / 600
 *   h4 1.25rem (20px) / 600
 *   h5 1.125rem(18px) / 600
 *   h6 1rem    (16px) / 600
 *   body 0.9375rem (15px) / 400
 *
 * Radius scale: --bs-border-radius bumped to 0.75rem so cards / inputs feel softer.
 * Shadow: --fh-card-shadow is the standard card shadow (very subtle).
 *
 * Component helpers (in this stylesheet):
 *   .fh-chip                pill button used for filters / view toggles
 *   .fh-chip.active         active pill
 *   .fh-avatar              circular initials chip (sm size)
 *   .fh-brand-chip          square brand chip used in the top-bar
 *   .fh-money               big green money figure (take-home)
 *   .fh-money-strip         icon + label + value rows under a metric card
 *   .fh-money-strip__icon   24px circle with the icon
 *   .fh-page-heading        page H1 (32/700)
 *   .fh-page-subheading     muted subtitle under the H1
 *   .fh-dev-pill            tiny "DEV" pill on the brand to flag dev environments
 *   .fh-topbar              applied to <nav> in place of bg-dark/bg-danger
 *   .fh-topbar-mobile       mobile-only thin top bar (lt-lg)
 */

:root {
    /* Project tokens */
    --fh-bg: #f7f8fa;
    --fh-card-bg: #ffffff;
    --fh-card-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.05);
    --fh-card-radius: 1rem;
    --fh-pill-radius: 9999px;
    --fh-text-muted: #6c757d;
    --fh-money-emphasis: #146c43;
    --fh-money-emphasis-bg: rgba(25, 135, 84, 0.08);
    --fh-dev-accent: #dc3545;
    --fh-topbar-bg: #ffffff;
    --fh-topbar-border: #e9ecef;

    /* Bootstrap variable overrides */
    --bs-body-bg: var(--fh-bg);
    --bs-body-font-size: 0.9375rem;
    --bs-border-radius: 0.75rem;
    --bs-border-radius-sm: 0.5rem;
    --bs-border-radius-lg: 1rem;
    --bs-border-radius-xl: 1.25rem;
}

/*
 * Heading scale. Bootstrap 5 doesn't expose --bs-h*-font-size at the :root level,
 * so we set them directly. font-weight follows the design tokens.
 */
h1, .h1 { font-size: 2rem; font-weight: 700; }
h2, .h2 { font-size: 1.5rem; font-weight: 600; }
h3, .h3 { font-size: 1.375rem; font-weight: 600; }
h4, .h4 { font-size: 1.25rem; font-weight: 600; }
h5, .h5 { font-size: 1.125rem; font-weight: 600; }
h6, .h6 { font-size: 1rem; font-weight: 600; }

/* Cards: softer radius + a real shadow */
.card {
    border-color: var(--bs-border-color);
    border-radius: var(--fh-card-radius);
    box-shadow: var(--fh-card-shadow);
}
.card > .card-header,
.card > .card-body,
.card > .card-footer {
    border-radius: 0;
}
.card > :first-child {
    border-top-left-radius: calc(var(--fh-card-radius) - 1px);
    border-top-right-radius: calc(var(--fh-card-radius) - 1px);
}
.card > :last-child {
    border-bottom-left-radius: calc(var(--fh-card-radius) - 1px);
    border-bottom-right-radius: calc(var(--fh-card-radius) - 1px);
}

/* Badges read better as pills in this design language */
.badge {
    border-radius: var(--fh-pill-radius);
    font-weight: 500;
    padding-inline: 0.625em;
}

/*
 * Solid primary buttons use action green so they stand apart from blue primary
 * chrome (e.g. wages card headers, navbar). --bs-primary / links stay default blue.
 */
.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: #198754;
    --bs-btn-border-color: #198754;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #157347;
    --bs-btn-hover-border-color: #146c43;
    --bs-btn-focus-shadow-rgb: 25, 135, 84;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #146c43;
    --bs-btn-active-border-color: #13653f;
    --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: #75b798;
    --bs-btn-disabled-border-color: #75b798;
}

/*
 * Page heading: used at the top of each feature area, replaces the very large default h1.
 * Pair with .fh-page-subheading for muted descriptive text underneath.
 */
.fh-page-heading {
    font-size: 1.75rem;
    line-height: 1.15;
    font-weight: 700;
    margin-bottom: 0.25rem;
}
@media (min-width: 768px) {
    .fh-page-heading {
        font-size: 2rem;
    }
}
.fh-page-subheading {
    color: var(--fh-text-muted);
    font-size: 0.9375rem;
    margin-bottom: 1.25rem;
}

/* Filter / toggle pills used above content (e.g. wages "Pay rise", "Pay spine", view toggle). */
.fh-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.85rem;
    border-radius: var(--fh-pill-radius);
    background-color: var(--fh-card-bg);
    border: 1px solid var(--bs-border-color);
    color: var(--bs-body-color);
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease;
    white-space: nowrap;
}
.fh-chip:hover,
.fh-chip:focus-visible {
    background-color: var(--bs-secondary-bg);
    color: var(--bs-body-color);
}
.fh-chip.active,
.fh-chip[aria-pressed="true"] {
    background-color: var(--bs-primary-bg-subtle);
    border-color: var(--bs-primary-border-subtle);
    color: var(--bs-primary-text-emphasis);
}
.fh-chip .fh-chip-icon {
    display: inline-flex;
    align-items: center;
    line-height: 0;
}

/* Avatar chip: initials in a soft blue circle. */
.fh-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background-color: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    font-weight: 600;
    font-size: 0.875rem;
    flex: 0 0 auto;
    line-height: 1;
}
.fh-avatar--lg {
    width: 2.75rem;
    height: 2.75rem;
    font-size: 1rem;
}
.fh-avatar--sm {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.75rem;
}

/* Top-bar brand chip and dev indicator pill. */
.fh-brand-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.6rem;
    background-color: var(--bs-primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    line-height: 1;
}
.fh-dev-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.15rem 0.45rem;
    border-radius: var(--fh-pill-radius);
    background-color: var(--fh-dev-accent);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1;
    text-transform: uppercase;
}

/* Money emphasis: big take-home figures, success-coloured. */
.fh-money {
    color: var(--fh-money-emphasis);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.fh-money-figure {
    font-size: 1.75rem;
    line-height: 1.1;
}
@media (min-width: 576px) {
    .fh-money-figure {
        font-size: 2rem;
    }
}
.fh-money-caption {
    color: var(--fh-text-muted);
    font-size: 0.75rem;
    line-height: 1.2;
    margin-top: 0.15rem;
}

/* Icon + label + value rows that sit under the money figure on a metric card. */
.fh-money-strip {
    display: grid;
    grid-template-columns: 1fr;
    row-gap: 0.45rem;
    font-size: 0.8125rem;
}
.fh-money-strip__row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}
.fh-money-strip__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 0.5rem;
    background-color: var(--bs-secondary-bg);
    color: var(--fh-text-muted);
    flex: 0 0 auto;
}
.fh-money-strip__icon svg {
    width: 0.95rem;
    height: 0.95rem;
}
.fh-money-strip__label {
    color: var(--fh-text-muted);
    flex: 1 1 auto;
    min-width: 0;
}
.fh-money-strip__value {
    font-variant-numeric: tabular-nums;
    text-align: right;
    margin-left: auto;
    color: var(--bs-body-color);
}

/*
 * Restyled top bar (replaces navbar-dark + bg-dark / bg-danger).
 * Used by both desktop (familyhub_render_main_nav) and mobile (familyhub_render_mobile_shell).
 */
.fh-topbar {
    background-color: var(--fh-topbar-bg) !important;
    border-bottom: 1px solid var(--fh-topbar-border);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.fh-topbar .navbar-brand,
.fh-topbar .navbar-text,
.fh-topbar .nav-link,
.fh-topbar .navbar-toggler {
    color: var(--bs-body-color);
}
.fh-topbar .navbar-toggler {
    border-color: var(--bs-border-color);
}
.fh-topbar .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23212529' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}
.fh-topbar .nav-link {
    font-weight: 500;
}
.fh-topbar .nav-link:hover,
.fh-topbar .nav-link:focus {
    color: var(--bs-primary);
}
.fh-topbar .nav-link.active,
.fh-topbar .dropdown-toggle.active {
    color: var(--bs-primary);
}
.fh-topbar .navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 700;
}
.fh-topbar .dropdown-menu {
    border-radius: 0.85rem;
    border-color: var(--bs-border-color);
    box-shadow: var(--fh-card-shadow);
    padding: 0.35rem;
}
.fh-topbar .dropdown-menu .dropdown-item {
    border-radius: 0.5rem;
    padding: 0.4rem 0.65rem;
    font-size: 0.875rem;
}
.fh-topbar .dropdown-menu .dropdown-item:hover,
.fh-topbar .dropdown-menu .dropdown-item:focus {
    background-color: var(--bs-secondary-bg);
}
.fh-topbar .dropdown-menu .dropdown-item.active {
    background-color: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
}

/* Subtle dev-only stripe so you can still spot the environment at a glance even with a white bar. */
.fh-topbar.fh-topbar--dev {
    box-shadow: inset 0 -2px 0 var(--fh-dev-accent), 0 1px 2px rgba(15, 23, 42, 0.04);
}

/* Module flyout polish for the new white bar */
.familyhub-navbar-mega.fh-topbar .familyhub-module-trigger {
    color: var(--bs-body-color);
}
.familyhub-navbar-mega.fh-topbar li.familyhub-module-flyout:hover > .familyhub-module-trigger,
.familyhub-navbar-mega.fh-topbar li.familyhub-module-flyout:focus-within > .familyhub-module-trigger {
    background-color: var(--bs-secondary-bg);
}
.familyhub-navbar-mega.fh-topbar .familyhub-module-chevron-desktop,
.familyhub-navbar-mega.fh-topbar .familyhub-module-chevron-mobile {
    color: var(--fh-text-muted);
}
.familyhub-navbar-mega.fh-topbar .dropdown-menu-dark {
    /* Override BS dropdown-menu-dark when the parent bar is light */
    --bs-dropdown-color: var(--bs-body-color);
    --bs-dropdown-bg: #fff;
    --bs-dropdown-link-color: var(--bs-body-color);
    --bs-dropdown-link-hover-bg: var(--bs-secondary-bg);
    --bs-dropdown-link-active-bg: var(--bs-primary-bg-subtle);
    --bs-dropdown-link-active-color: var(--bs-primary-text-emphasis);
    --bs-dropdown-divider-bg: var(--bs-border-color);
}

/* Mobile bottom tabs: lift colours to match the new tokens. */
.familyhub-mobile-bottomnav.fh-bottom-tabs {
    background-color: var(--fh-card-bg);
    border-top: 1px solid var(--bs-border-color);
    box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.04);
}
.familyhub-mobile-bottomnav.fh-bottom-tabs .familyhub-mobile-tab {
    border-radius: 0.65rem;
    color: var(--fh-text-muted);
    transition: color .15s ease, background-color .15s ease;
}
.familyhub-mobile-bottomnav.fh-bottom-tabs .familyhub-mobile-tab:hover {
    color: var(--bs-body-color);
}
.familyhub-mobile-bottomnav.fh-bottom-tabs .familyhub-mobile-tab.familyhub-mobile-tab-active {
    color: var(--bs-primary);
    background-color: var(--bs-primary-bg-subtle);
}
