/* ================================================================================================
   BRAND-002 — THE ONE FILE THAT CONTROLS THE WHOLE COLOUR SCHEME
   ================================================================================================

   TO RE-SKIN THIS PLATFORM FOR A DIFFERENT OPERATOR, EDIT THE ~15 VALUES IN ":root" BELOW.
   Nothing else. No other stylesheet, no view, no rebuild.

   ------------------------------------------------------------------------------------------------
   WHY THIS EXISTS
   ------------------------------------------------------------------------------------------------
   Colours were previously written as literal hex values scattered through the views and several
   stylesheets, and three different Bootstrap versions each brought their own palette. Changing the
   scheme meant finding every occurrence, and missing one left a stray colour from the old brand on
   some screen nobody checked.

   Custom properties fix that: they cascade, they can be overridden in one place, and unlike a CSS
   preprocessor they need no build step — which matters here, because this project has no asset
   pipeline.

   ------------------------------------------------------------------------------------------------
   HOW THE PALETTE IS BUILT
   ------------------------------------------------------------------------------------------------
   Only FOUR decisions actually matter:

       --brand-primary    the main identity colour: header, primary buttons, active nav
       --brand-secondary  supporting colour for accents and secondary actions
       --brand-success /  --brand-danger    money in / money out, and pass / fail states

   Everything else is derived from those, so a new operator changes four values and gets a
   consistent result rather than having to pick thirty that agree with each other.

   ------------------------------------------------------------------------------------------------
   CONTRAST IS NOT DECORATION
   ------------------------------------------------------------------------------------------------
   This is a financial application: people read balances and transaction states on it, often on a
   phone, often in bad light. Every text/background pair below meets WCAG AA (4.5:1 for body text,
   3:1 for large text and UI boundaries).

   That is also why --brand-danger is a deep red rather than a bright one, and why status text is
   never colour ALONE — each status carries a label as well, because roughly 1 in 12 men has some
   form of colour-vision deficiency and "the red row" is not a usable instruction for them.

   If you change the palette, keep the contrast. A pale-on-white primary will look fine to whoever
   picked it and be unreadable outdoors.
   ================================================================================================ */

:root {
    /* ============================================================
       THE FOUR DECISIONS — change these to re-skin
       ============================================================ */
    --brand-primary: #1d4ed8;      /* headers, primary buttons, active nav — royal blue from the EzyTM mark */
    --brand-secondary: #475569;      /* accents, secondary actions — neutral slate */
    --brand-success: #15803d;      /* credit, success, completed             */
    --brand-danger: #b3261e;      /* debit, failure, destructive actions    */

    /* The EzyTM magenta from the logo. An ACCENT, not a workhorse: notification dots, count
       badges, small highlights. Large magenta surfaces are what made the old UI feel noisy. */
    --brand-accent: #c60d59;
    --brand-accent-light: #fdeaf2;

    /* Supporting states. Amber is deliberately dark enough for white text. */
    --brand-warning: #a16207;      /* pending, needs attention               */
    --brand-info: #0369a1;      /* neutral information                    */

    /* ============================================================
       DERIVED — usually no need to touch these
       ============================================================ */
    --brand-primary-dark: #1e40af;
    --brand-primary-light: #e8effd;
    --brand-primary-contrast: #ffffff;   /* text ON primary                  */

    --brand-secondary-dark: #334155;
    --brand-secondary-light: #eef2f7;

    --brand-success-light: #e7f6ec;
    --brand-danger-light: #fdeceb;
    --brand-warning-light: #fdf5e3;
    --brand-info-light: #e6f2fa;

    /* ============================================================
       SURFACES AND TEXT
       ============================================================ */
    --surface-page: #f4f6f9;      /* app background                         */
    --surface-card: #ffffff;      /* cards, panels, tables                  */
    --surface-sunken: #eef1f5;      /* table headers, wells                   */
    --surface-border: #d8dee7;

    --text-primary: #1f2933;      /* body text            — 13.6:1 on card  */
    --text-secondary: #52606d;      /* labels, help text    —  7.1:1 on card  */
    --text-muted: #6b7784;      /* timestamps, hints    —  4.8:1 on card  */
    --text-inverse: #ffffff;

    /* ============================================================
       SHAPE AND DEPTH
       ============================================================ */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
    --shadow-md: 0 2px 8px rgba(16, 24, 40, .10);
    --shadow-lg: 0 8px 24px rgba(16, 24, 40, .14);

    /* Single place to change motion. Also the hook for reduced-motion below. */
    --transition-fast: 120ms ease;
    --transition-base: 200ms ease;

    /* ============================================================
       MAIN NAVIGATION MENU — COLOUR, FONT AND SIZE, ALL FROM HERE

       Change --menu-bg and the entire menu changes, at EVERY screen
       width. That was not true before: the menu colour was written
       three different times inside a <style> block in
       Views/Shared/_MenuBar1.cshtml —

           #b6a208            gold, applied above 768px
           #ea116a  !important  pink, applied at 768px and below
           #ea116a12 !important  pink tint on the bar itself
           yellow             on the .rec badge

       — so the SAME menu was gold on a desktop and pink on a laptop
       or tablet, and none of it could be changed from one place.
       Those values now live here as tokens and nowhere else.

       Defaults below reproduce the gold menu exactly as it looks
       today, so nothing changes visually until you change a token.
       ============================================================ */
    /* --- the bar itself ------------------------------------------------ */
    /* 2026-08 modernisation: the gold #b6a208 bar (and its olive hover ladder) is replaced by a
       deep-navy bar — the standard idiom for a B2B/fintech admin product. Active item carries the
       brand primary so "where am I" reads at a glance. */
    /* OWNER (31-08): "menu default colour black ke alawa professional" - the near-black navy read
       as black. Moved to a corporate DEEP BLUE (classic B2B/fintech header blue), same light text,
       hover/open steps lightened in the same hue so the whole menu stays one professional family. */
    --menu-bg: #1f4e79;                    /* the menu bar background        */
    --menu-header-bg: transparent;         /* strip behind the logo          */

    /* --- TOP-LEVEL ITEMS: every state has its OWN background AND its own
           font colour, so each can be set independently ------------------ */
    --menu-text: #e7ecf7;                  /* normal   - font                */
    --menu-item-bg: transparent;           /* normal   - background          */

    --menu-bg-hover: #2a629a;              /* hover    - background          */
    --menu-text-hover: #ffffff;            /* hover    - font                */

    --menu-bg-open: #33719f;               /* OPEN (its submenu is showing)  */
    --menu-text-open: #ffffff;

    /* OWNER (31-08): selected item "alag se dikhta hai / chubhta hai" - the bright royal blue clashed
       with the new deep-blue bar. Active is now one clear step LIGHTER in the SAME hue family
       (bar #1f4e79 -> hover #2a629a -> open #33719f -> active #3f81b5), so it stands out without clashing. */
    --menu-bg-active: #3f81b5;             /* SELECTED (you are on this page)*/
    --menu-text-active: #ffffff;

    /* --- SUBMENU ITEMS: same idea, separately settable ------------------ */
    --menu-dropdown-bg: #ffffff;           /* submenu panel background       */
    --menu-dropdown-text: var(--text-primary);
    --menu-dropdown-hover-bg: var(--brand-primary-light);
    --menu-dropdown-hover-text: var(--text-primary);
    --menu-dropdown-active-bg: var(--brand-primary);
    --menu-dropdown-active-text: #ffffff;

    --menu-badge-bg: var(--brand-accent);  /* the little count bubbles — EzyTM magenta, white text */
    --menu-badge-text: #ffffff;

    /* Typography and metrics — font and style, also from one place. */
    --menu-font-family: inherit;
    --menu-font-size: 14px;
    --menu-font-weight: 600;
    --menu-letter-spacing: normal;
    --menu-text-transform: none;
    --menu-item-padding-y: 8px;
    --menu-item-padding-x: 12px;
    --menu-logo-height: 48px;              /* fixed — never scales with the viewport */
    --menu-logo-height-sm: 40px;           /* phones only                    */
}

/* ================================================================================================
   ACCESSIBILITY BASELINE
   ================================================================================================ */

/* Respect the operating-system setting. Some people disable animation because motion makes them
   ill, not because they dislike it. */
@media (prefers-reduced-motion: reduce) {
    :root {
        --transition-fast: 0ms;
        --transition-base: 0ms;
    }

    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}

/* A visible keyboard focus ring. Several of the stylesheets in this project remove outlines
   entirely, which makes the app impossible to operate without a mouse. :focus-visible shows the
   ring for keyboard users without putting a box around every mouse click. */
:focus-visible {
    outline: 3px solid var(--brand-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Skip link — first tab stop, hidden until focused. On screens with long sidebars this saves a
   keyboard or screen-reader user tabbing through the whole navigation on every page. */
.skip-to-content {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 10000;
    padding: .75rem 1.25rem;
    background: var(--brand-primary);
    color: var(--brand-primary-contrast);
    border-radius: 0 0 var(--radius-md) 0;
    font-weight: 600;
    text-decoration: none;
}

    .skip-to-content:focus {
        left: 0;
    }

/* ================================================================================================
   SEMANTIC HELPERS
   ------------------------------------------------------------------------------------------------
   Money and status, expressed once. These carry a text label as well as a colour — see the note
   on colour-vision deficiency at the top.
   ================================================================================================ */

.amount-credit {
    color: var(--brand-success);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.amount-debit {
    color: var(--brand-danger);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* tabular-nums keeps digits the same width, so a column of amounts lines up on the decimal point.
   Without it, "1,111.00" is visibly narrower than "8,888.00" and the column looks ragged. */
.amount, .balance, td.text-right {
    font-variant-numeric: tabular-nums;
}

.status-badge {
    display: inline-block;
    padding: .2em .6em;
    border-radius: var(--radius-sm);
    font-size: .8125rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.status-success {
    background: var(--brand-success-light);
    color: var(--brand-success);
}

.status-failed {
    background: var(--brand-danger-light);
    color: var(--brand-danger);
}

.status-pending {
    background: var(--brand-warning-light);
    color: var(--brand-warning);
}

.status-info {
    background: var(--brand-info-light);
    color: var(--brand-info);
}

/* ================================================================================================
   RESPONSIVE: DATA TABLES
   ------------------------------------------------------------------------------------------------
   This platform is mostly reports, and wide tables are what breaks a phone layout: the table forces
   the PAGE wider than the viewport, so the whole layout scrolls sideways and the navigation drifts
   off screen.

   Wrapping the table in its own scroll container keeps the sideways scroll inside the table, where
   it belongs, and leaves the page itself fixed.
   ================================================================================================ */

.table-responsive-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ================================================================================================
   Bootstrap 3 ships `select.input-sm { height: 30px; line-height: 30px; }` while `.input-sm` also
   applies `padding: 5px 10px`. 5px + a 30px line box does not fit inside a 30px control, so the
   text is pushed below the centre line and the descenders are clipped by the bottom border - which
   is exactly what the operation-profile pickers were doing. Normalising line-height lets padding
   and font-size decide, and the text sits centred again.

   Scoped to the provider screens on purpose: this is a Bootstrap defect that affects every
   select.input-sm in the product, but widening the fix is a visual change to screens nobody has
   asked about. Lift the scope deliberately, not by accident.
   ================================================================================================ */

#pw-ops select.form-control.input-sm,
#po-root select.form-control.input-sm {
    line-height: 1.5;
    padding-top: 4px;
    padding-bottom: 4px;
}

@media (max-width: 767px) {
    /* Last-resort guard: nothing should be able to push the page wider than the screen. */
    html, body {
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Touch targets. 44px is the size at which a fingertip reliably hits the right control;
       below that, people mis-tap — which on a recharge form means a wrong transaction. */
    .btn, .nav-link, .dropdown-item, button, [role="button"] {
        min-height: 44px;
    }
}

/* Prevent iOS Safari from zooming in when a field is focused. It does that for any input with a
   font-size under 16px, and the zoom does not reverse on blur, leaving the user stranded on a
   magnified page mid-form. */
@media (max-width: 767px) {
    input, select, textarea {
        font-size: 16px;
    }
}
