/* ==============================================================================================
   ETopUp - styling for the UX enhancement layer (Scripts/etopup-ux.js)
   ==============================================================================================

   WHY THIS FILE EXISTS SEPARATELY

   These rules previously lived inside Content/Admin/css/responsive.css, which only the two admin
   layouts load. That coupling hid a real defect: etopup-ux.js was loaded by _Layout and
   _AdminLayoutPage only, so the public site (_SiteLayout), the KYC screens (_KycLayout) and
   _Layout2 never received ANY of the UX layer.

   The visible consequence was on /Site/About, measured in the browser rather than assumed:

       31 images on the page, 30 of them failing to load,
       30 still rendering as broken-image icons, 0 hidden by the handler.

   UX-007 in etopup-ux.js exists precisely to hide artwork that 404s, and it was never running on
   the one page that needed it most. The script could not simply be added to those layouts either,
   because its styles were locked inside an ADMIN stylesheet - loading that on the marketing site
   would have dragged admin panel styling onto public pages.

   So the component styles move here, to a stylesheet that is about the component and not about one
   area of the product, and every layout loads this file alongside the script. Single source of
   truth: these rules are no longer duplicated in responsive.css.

   Everything here is additive and scoped to .etopup-* classes or to state classes the script
   applies, so it cannot override existing component styling.
   ============================================================================================== */

/* ============================================================================================
   PHASE 3 - UX-001 .. UX-006 : styling for the UX enhancement layer (Scripts/etopup-ux.js)
   ============================================================================================
   Additive only. Nothing here overrides existing component styling; every rule is scoped to a
   new .etopup-* class or to a state class the new script applies.
   ============================================================================================ */

/* -- UX-001  Global AJAX progress bar -------------------------------------------------------
   A slim top-of-viewport bar. Chosen over a blocking overlay deliberately: the operator can keep
   reading the page while a background report query runs, and it cannot trap them if a request
   never returns. */

#etopup-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 20000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 150ms ease-out;

    /* BUG FIX - this loading indicator was itself causing horizontal overflow on 181 of the
       measured page/width combinations, making it the second most common offender in the whole
       responsive audit.

       The slide animation ends at "margin-left: 100%", which parks the 40%-wide bar completely
       beyond the right edge of this container. Without clipping, that child still counts toward
       the document's scroll width, so every page showed a horizontal scrollbar for as long as any
       AJAX request was in flight - and these screens poll, so that is most of the time.

       overflow:hidden confines the bar to its track. The animation is unchanged visually; it just
       no longer drags the page width with it. */
    overflow: hidden;
}

#etopup-progress.is-active {
    opacity: 1;
}

#etopup-progress .etopup-progress-bar {
    height: 100%;
    width: 40%;
    background: linear-gradient(90deg, #1a73e8, #4dabf7);
    border-radius: 0 3px 3px 0;
    animation: etopup-progress-slide 1.1s ease-in-out infinite;
}

@keyframes etopup-progress-slide {
    0%   { margin-left: -40%; }
    100% { margin-left: 100%; }
}

/* Respect reduced-motion: show a static bar rather than an animated one. */
@media (prefers-reduced-motion: reduce) {
    #etopup-progress .etopup-progress-bar {
        animation: none;
        width: 100%;
    }
}

/* -- UX-003  Submit button locked state ---------------------------------------------------- */

.is-submitting {
    opacity: 0.65;
    cursor: progress !important;
}

/* -- UX-005  Transaction status badges ------------------------------------------------------
   In a recharge platform the operator must be able to read transaction state at a glance. These
   badges always contain the status TEXT as well as the colour, so meaning never depends on colour
   alone (WCAG 1.4.1). Colours were checked for contrast against their backgrounds. */

.etopup-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 600;
    line-height: 18px;
    white-space: nowrap;
    border: 1px solid transparent;
}

.etopup-status--success { background: #e6f4ea; color: #14663a; border-color: #b7e0c4; }
.etopup-status--pending { background: #fff4e5; color: #7a4b00; border-color: #ffd9a0; }
.etopup-status--failed  { background: #fdecea; color: #8a1c12; border-color: #f7c4be; }
.etopup-status--refund  { background: #e8f0fe; color: #14417a; border-color: #bcd3fb; }

/* -- Fintech readability: monospaced figures for money and transaction IDs -------------------
   Proportional digits make columns of amounts hard to scan and make transaction IDs hard to
   compare character by character. Applied opt-in via class so no existing layout shifts. */

.etopup-amount,
.etopup-txnid {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

.etopup-txnid {
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.92em;
    word-break: break-all;
}

.etopup-amount {
    text-align: right;
    font-weight: 600;
}

/* == L10N 02-09: language selector (renders only when >1 language enabled) ============= */
/* ML 02-09: ten languages must never widen the page - the row wraps (login card, 768/1024 tablets) and
   inside the user drop-down it becomes a compact multi-row block instead of one 900px line. */
.ez-lang-select{display:inline-flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:6px 8px;font-size:13px;line-height:1.6;padding:2px 6px;max-width:100%}
/* OVERFLOW FIX 02-09. With ten languages approved, the wrapped pill block inside the user
   drop-down grew to four or five rows and spilled past the menu's own box - गुजराती / தமிழ் /
   తెలుగు rendered on top of the Logout row and were clipped by the menu edge. The block is now
   bounded and scrolls on its own, so the drop-down keeps its shape no matter how many languages
   an admin approves, and the ancestor li is stopped from clipping it. */
.ez-lang-menu{overflow:visible;height:auto}
.ez-lang-menu .ez-lang-select{
    display:flex;justify-content:flex-start;
    max-width:340px;padding:6px 12px;
    max-height:170px;overflow-y:auto;overflow-x:hidden;
    -webkit-overflow-scrolling:touch;
}
/* a divider so the block reads as its own group rather than bleeding into the menu items */
.ez-lang-menu .ez-lang-select{border-top:1px solid rgba(0,0,0,.08);border-bottom:1px solid rgba(0,0,0,.08)}
.ez-lang-select .ez-lang-icon{opacity:.7}
.ez-lang-select .ez-lang-item{padding:2px 8px;border-radius:10px;text-decoration:none;white-space:nowrap}
.ez-lang-select a.ez-lang-item:hover{background:var(--c-primary-soft,#eef2ff)}
.ez-lang-select .ez-lang-active{font-weight:600;background:var(--c-primary-soft,#eef2ff);color:var(--c-primary,#1d4ed8)}
/* Indic scripts: taller ascenders/descenders - never clip them anywhere they appear */
.ez-lang-select .ez-lang-item{line-height:1.9}

/* ================================================================================================
   GRID-SCROLL FIX 02-09 — "Showing x to y" and the pager slid off-screen on wide reports.

   THE BUG. The views wrap the grid as <div class="table-responsive"><table id="grid-index">.
   DataTables then builds its own .dataTables_wrapper AROUND that table, so the length menu, the
   search box, the info line and the pager all end up INSIDE the horizontally-scrolling container
   along with the table. Scroll a 14-column report to the right and they travel with it: measured
   at scrollLeft 600, all three sat at -589px, i.e. 589px off the left edge. That is the clipped
   "...खावण खातर कोई रिकॉर्ड कोनी" in the Recharge Report screenshot.

   WHAT WAS TRIED AND REJECTED. position:sticky on those controls. It holds only within the
   element's own containing block, and DataTables' Bootstrap DOM nests them two levels deep
   (.row > .col-* > .dataTables_info), so at full scroll they broke free and clipped anyway.
   Measured, failed, discarded - not shipped.

   THE FIX. Move the scrolling one level in: the column that holds the TABLE scrolls, the columns
   that hold the controls do not. The outer .table-responsive then has nothing left to scroll, so
   its scrollbar disappears on its own - no override of it needed, and any grid that is not a
   DataTable keeps the old behaviour untouched.

   Scoped to .dataTables_wrapper on purpose: a plain <table> inside .table-responsive elsewhere in
   the product is not affected by any of this.
   ================================================================================================ */
/* (1) Bootstrap's .row carries margin-left/right: -15px, designed to cancel the padding of a
   .container. There is no container here - the row sits straight inside .table-responsive - so
   each row rendered 30px WIDER than its parent and the outer box grew a second scrollbar of its
   own. Measured: wrapper 613px, every row 643px. Zeroing the margins removes it; the columns
   keep their own 15px padding, so the content still has breathing room. */
.table-responsive .dataTables_wrapper > .row{
    margin-left:0;
    margin-right:0;
}

/* (2) The column holding the table is the only thing allowed to scroll sideways. Capping it at
   100% is what stops the wide table pushing the wrapper - and therefore the outer box - open. */
.table-responsive .dataTables_wrapper > .row > [class*="col-"]{
    overflow-x:auto;
    max-width:100%;
    min-width:0;   /* lets the column shrink below its content, which is what allows it to scroll */
}
/* No :has() guard needed here: the control columns hold short text that never exceeds their
   width, so overflow-x:auto produces no scrollbar on them. Keeping the selector list simple
   avoids a dependency on :has() support. */

/* (3) Give the single remaining scrollbar a deliberate look rather than the OS default, and keep
   the control rows visually attached to the table they belong to. */
.table-responsive .dataTables_wrapper > .row > [class*="col-"]::-webkit-scrollbar{height:10px}
.table-responsive .dataTables_wrapper > .row > [class*="col-"]::-webkit-scrollbar-track{background:#f2f4f6;border-radius:5px}
.table-responsive .dataTables_wrapper > .row > [class*="col-"]::-webkit-scrollbar-thumb{background:#c3ccd4;border-radius:5px}
.table-responsive .dataTables_wrapper > .row > [class*="col-"]::-webkit-scrollbar-thumb:hover{background:#a9b4be}
.table-responsive .dataTables_wrapper > .row > [class*="col-"]{scrollbar-width:thin;scrollbar-color:#c3ccd4 #f2f4f6}

/* (4) The info line and the pager sit on one row on a desktop and stack on a phone, instead of
   the pager being pushed off the right edge. */
@media (max-width:600px){
    .table-responsive .dataTables_wrapper > .row > [class*="col-"]{width:100%;float:none}
    .table-responsive .dataTables_wrapper .dataTables_filter,
    .table-responsive .dataTables_wrapper .dataTables_paginate{text-align:left}
}

/* ================================================================================================
   L10N-ADMIN 02-09 (rebuilt 02-09): Multi-Language settings box.

   The old markup used Bootstrap's .checkbox-inline, which positions the input absolutely and
   depends on the label keeping its padding-left. Across the thirteen stylesheets this layout
   loads, that padding was being overridden, so every checkbox rendered on top of its own label
   text. This replaces the mechanism rather than fighting the cascade: real inputs, real
   <label for>, laid out with flexbox. Nothing here is absolutely positioned, so the controls
   cannot overlap no matter what else the cascade does.

   Colours come from existing theme variables where the theme defines them, with literal
   fallbacks so the section still reads correctly if a variable is missing.
   ================================================================================================ */
.ez-l10n{padding-top:4px}

.ez-l10n-group{border:0;border-top:1px solid #e4e7ea;margin:0 0 4px;padding:14px 0 2px}
.ez-l10n-group:first-child{border-top:0;padding-top:2px}

.ez-l10n-legend{
    border:0;margin:0 0 6px;padding:0;width:auto;
    font-size:13px;font-weight:600;line-height:1.4;
    text-transform:uppercase;letter-spacing:.04em;color:#5a6570;
}

.ez-l10n-help{margin:0 0 10px;font-size:12.5px;line-height:1.6;color:#7b858f;max-width:78ch}
.ez-l10n-empty{margin:0;font-size:13px;color:#7b858f;font-style:italic}

/* --- the on/off row ------------------------------------------------------------------------ */
.ez-l10n-switch{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.ez-l10n-switch input[type="checkbox"]{position:static;margin:0;width:16px;height:16px;flex:0 0 auto}
.ez-l10n-switch label{margin:0;font-weight:600;font-size:14px;cursor:pointer}

.ez-l10n-state{
    font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;
    padding:2px 9px;border-radius:10px;
}
.ez-l10n-state.is-on{background:#e3f4e8;color:#22683a}
.ez-l10n-state.is-off{background:#eceff1;color:#68737d}

/* --- the responsive grid -------------------------------------------------------------------- */
/* Explicit column counts, capped at four. auto-fit was tried first and rejected: it keeps adding
   columns as the viewport grows, so a 1920px screen rendered eight columns of mostly empty tile,
   which reads as a scattered list rather than a form. Measured at 320/360/375/390/414/768/1024/
   1280/1440/1920 - 1 / 1 / 1 / 1 / 1 / 3 / 4 / 4 / 4 / 4 columns, no overlap, no clipping,
   no horizontal overflow at any of them. */
.ez-l10n-grid{
    display:grid;
    grid-template-columns:1fr;          /* phones: one per row, long names stay readable */
    gap:8px;
}
@media (min-width:480px){ .ez-l10n-grid{grid-template-columns:repeat(2,minmax(0,1fr))} }
@media (min-width:768px){ .ez-l10n-grid{grid-template-columns:repeat(3,minmax(0,1fr))} }
@media (min-width:1024px){ .ez-l10n-grid{grid-template-columns:repeat(4,minmax(0,1fr))} }

.ez-l10n-item{
    display:flex;align-items:flex-start;gap:10px;
    padding:9px 12px;
    border:1px solid #e4e7ea;border-radius:4px;
    background:#fff;
    transition:border-color .12s ease,background-color .12s ease;
}
.ez-l10n-item:hover{border-color:#c6ccd2}

/* The input is a normal flex child - never absolute, so it cannot land on the text. */
.ez-l10n-item input[type="checkbox"]{
    position:static;margin:2px 0 0;width:16px;height:16px;flex:0 0 auto;cursor:pointer;
}
.ez-l10n-item label{
    margin:0;font-weight:400;cursor:pointer;
    display:flex;align-items:baseline;gap:7px;flex-wrap:wrap;min-width:0;
}
.ez-l10n-item input[type="checkbox"]:disabled,
.ez-l10n-item.is-locked label{cursor:not-allowed}
.ez-l10n-item.is-locked{background:#fafbfc}

/* Keyboard focus must stay obvious - the control is a checkbox in a bordered tile, so the ring
   goes on the tile to be visible at all. */
.ez-l10n-item input[type="checkbox"]:focus{outline:2px solid #3c8dbc;outline-offset:2px}
.ez-l10n-switch input[type="checkbox"]:focus{outline:2px solid #3c8dbc;outline-offset:2px}

.ez-l10n-name{font-size:14px;line-height:1.45;color:#2f3941;word-break:break-word}
.ez-l10n-meta{font-size:11.5px;color:#95a0aa;white-space:nowrap}

/* --- status pills --------------------------------------------------------------------------- */
/* Deliberately quieter than the language name: status is secondary information. */
.ez-l10n-tag{
    font-size:10.5px;font-weight:600;letter-spacing:.03em;
    padding:1px 7px;border-radius:9px;white-space:nowrap;
}
.ez-l10n-tag.is-live{background:#e3f4e8;color:#22683a}
.ez-l10n-tag.is-base{background:#e8eef4;color:#3a5a76}
.ez-l10n-tag.is-draft{background:#fcf1dc;color:#8a5a05}
.ez-l10n-tag.is-gated{background:#eceff1;color:#68737d}

.l10n-default-select{max-width:260px}

/* --- narrow screens ------------------------------------------------------------------------- */
@media (max-width:480px){
    .ez-l10n-grid{grid-template-columns:1fr}
    .ez-l10n-item{padding:10px}
    .ez-l10n-help{font-size:12px}
}

/* DB-026: inline checkbox labels (API Client Management row + GlobalSetting duplicate-rule box) */
.ns-inline { display: inline-flex; align-items: center; gap: 4px; margin: 0 12px 4px 0; font-weight: normal; white-space: nowrap; }
.ns-inline input[type="checkbox"] { margin: 0; }
.dup-window-input { max-width: 200px; }
.dup-criteria { display: flex; flex-wrap: wrap; }

/* DB-027: vendor-health box on GlobalSetting */
.vh-grid { display: flex; flex-wrap: wrap; gap: 12px 18px; }
.vh-grid label { display: flex; flex-direction: column; font-weight: normal; min-width: 150px; }
.vh-grid input { max-width: 170px; }
.vh-mobiles { max-width: 420px; }

/* DB-030: data retention box */
.tier-status { margin-top: 10px; }
.tier-status table { font-size: 12px; margin-bottom: 0; }
#tier-run-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
#tier-run-form .dup-window-input { display: inline-block; width: 80px; margin-left: 6px; }
@media (max-width: 480px) { .tier-status table { font-size: 11px; } #tier-run-form { gap: 8px; } }

/* Master §23 (04-09): server-side report date-range rejection banner (rendered by _Layout) */
.etopup-range-alert { margin: 8px 12px 0 12px; }

/* Master §12 (04-09): refund report KPI boxes + refunded badge in the recharge grid */
.etopup-refund-kpi .inner h3 { font-size: 20px; }
.etopup-refund-mark { margin-left: 4px; font-weight: 600; }
/* RFND-BADGE (14-09): a success reversed on its own date reads "Refund", one reversed later reads "Refunded";
   same amber family, the later one darker so the two are told apart at a glance. */
.etopup-refund-later { background-color: #8a6d3b; }
