/* =====================================================================
   e-PriceScan - "Light grey & blue" theme for jQuery Mobile 1.2
   Drop-in override. Load it LAST (after css/eps1.css, js/blue/style.css and style.css).

   Install:
     1. copy this file to  W:\php8\ep8\css\eps-blue.css
     2. headerlinks.php - see "Theme switch" in SUGGESTIONS.md
   Every colour is a variable below, so the palette can be tuned in one place.
   ===================================================================== */

:root {
  --bg:            #eef1f5;  /* page background - light grey            */
  --surface:       #ffffff;  /* cards, lists, popups                     */
  --surface-2:     #f6f8fa;  /* alternate rows, input fill               */
  --border:        #d5dbe3;
  --text:          #1f2a37;
  --text-muted:    #5b6675;
  --blue:          #1f6fd1;  /* primary action                            */
  --blue-dark:     #1859a8;  /* hover / pressed                           */
  --blue-tint:     #e6f0fb;  /* selected / secondary buttons              */
  --blue-tint-2:   #cfe1f7;
  --green:         #1e8e5a;  /* Buy / sold                                */
  --red:           #c2412d;  /* Force closed / delete                     */
  --amber:         #b7791f;  /* Suspended / needs attention               */
  --radius:        8px;
  --shadow:        0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .10);
}

/* ---------- base ---------- */
html, body, .ui-page, .ui-overlay-c, .ui-overlay-d, .ui-overlay-e {
  background: var(--bg) !important;
  color: var(--text);
  text-shadow: none !important;
}
body, .ui-btn-text, .ui-input-text, input, select, textarea {
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}
body { font-size: 14px; line-height: 1.4; }
.ui-content {
  background: var(--bg) !important;
  color: var(--text) !important;
  padding: 10px 12px 80px 12px;         /* room for the bottom tab bar */
}
/* scan page has an inline black background */
#scan, #scan .ui-content { background: var(--bg) !important; }

a, a:visited { color: var(--blue); }

/* ---------- header bar (all swatches) ---------- */
.ui-header, .ui-bar-a, .ui-bar-b, .ui-bar-c, .ui-bar-d, .ui-bar-e {
  background: var(--blue) !important;
  border: 0 !important;
  color: #fff !important;
  text-shadow: none !important;
  box-shadow: 0 1px 0 rgba(0,0,0,.08);
}
.ui-header .ui-title { color: #fff !important; font-weight: 600; font-size: 16px; }
.ui-header .ui-btn { background: rgba(255,255,255,.16) !important; border-color: transparent !important; color: #fff !important; }
#guestname { color: #fff !important; font-weight: 600; letter-spacing: .3px; }

/* ---------- footer / banner ---------- */
.ui-footer, #banner {
  background: var(--surface) !important;
  border-top: 1px solid var(--border) !important;
  color: var(--text-muted) !important;
  text-shadow: none !important;
}

/* ---------- content bodies ---------- */
.ui-body-a, .ui-body-b, .ui-body-c, .ui-body-d, .ui-body-e {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
  text-shadow: none !important;
}

/* ---------- buttons ----------
   b = primary (blue), e = secondary (blue tint, used by the top menu: Items/Close/View),
   a = neutral outline, c/d = plain                                                    */
.ui-btn-up-a, .ui-btn-up-c, .ui-btn-up-d {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  text-shadow: none !important;
}
.ui-btn-hover-a, .ui-btn-hover-c, .ui-btn-hover-d {
  background: var(--surface-2) !important;
  border-color: var(--blue-tint-2) !important;
  color: var(--text) !important;
}
.ui-btn-up-b {
  background: var(--blue) !important;
  border: 1px solid var(--blue) !important;
  color: #fff !important;
  text-shadow: none !important;
}
.ui-btn-hover-b, .ui-btn-down-b {
  background: var(--blue-dark) !important;
  border-color: var(--blue-dark) !important;
  color: #fff !important;
}
.ui-btn-up-e {
  background: var(--blue-tint) !important;
  border: 1px solid var(--blue-tint-2) !important;
  color: var(--blue-dark) !important;
  text-shadow: none !important;
  font-weight: 600 !important;
}
.ui-btn-hover-e, .ui-btn-down-e {
  background: var(--blue-tint-2) !important;
  color: var(--blue-dark) !important;
}
.ui-btn-down-a, .ui-btn-down-c, .ui-btn-down-d {
  background: var(--blue-tint) !important;
  color: var(--blue-dark) !important;
}
.ui-btn-active {
  background: var(--blue) !important;
  border-color: var(--blue) !important;
  color: #fff !important;
  text-shadow: none !important;
}
.ui-btn, .ui-btn-inner { text-shadow: none !important; }
.ui-btn-corner-all, .ui-corner-all { border-radius: var(--radius) !important; }
.ui-shadow { box-shadow: var(--shadow) !important; }
.ui-disabled { opacity: .45 !important; }

/* bigger touch targets for the top menu (initials / Items / Close / View) */
.footer .ui-controlgroup .ui-btn-inner { padding: .7em 14px .7em 30px !important; font-size: 14px; }

/* ---------- date boxes (jqm-datebox): calendar button pinned inside the right end of the box ----------
   The plugin puts the input at 100% width with margin-right:-40px and lets the button share that space,
   so any larger button wrapped to the next line. */
.ui-input-datebox { position: relative !important; min-height: 44px !important; }
html .ui-input-datebox input { min-height: 42px; }
html .ui-input-datebox input { margin-right: 0 !important; padding: 0 40px 0 8px !important; box-sizing: border-box;
  border: 0 !important; background: transparent !important; box-shadow: none !important; } /* one border: the box's */
html .ui-input-datebox .ui-btn-icon-notext, html .ui-input-datebox.ui-mini .ui-btn-icon-notext {
  position: absolute !important; right: 4px; top: 50%; margin: 0 !important; transform: translateY(-50%);
  width: 38px !important; height: 38px !important; }

/* small ▾ pick-list buttons floated left of an input (Occasion, Financing, Terms, Promotion ...):
   the input box has a top margin, the button had none - give it the same so both are centred on one line */
.ui-content a.ui-btn-icon-notext[style*="float:left"] { margin: 6px 4px 0 0 !important; }
.ui-content a.ui-btn-icon-notext[href="#idpromotionoffered"] { margin-top: 0 !important; } /* its input sits in a plain div */

/* "Send Email to customer" (.separator.black): red on a black strip -> section heading like the others */
.separator.black, .separator {
  display: block; background-color: var(--blue-tint) !important; color: var(--blue-dark) !important;
  padding: 6px 10px !important; margin: 8px 0 !important; border-radius: 6px; font-size: 14px; }

/* ---------- inputs ---------- */
.ui-input-text, .ui-input-search, input.ui-input-text, textarea.ui-input-text {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  box-shadow: none !important;
}
.ui-focus, .ui-input-text:focus {
  border-color: var(--blue) !important;
  box-shadow: 0 0 0 3px rgba(31,111,209,.18) !important;
}
#barcode { font-size: 20px !important; height: 44px; letter-spacing: 1px; }
::placeholder { color: #8a94a3; }

/* ---------- lists ---------- */
.ui-listview > li.ui-li, .ui-li-static {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}
.ui-li-divider, .ui-listview > li[data-theme="e"] {
  background: var(--blue-tint) !important;
  color: var(--blue-dark) !important;
  font-weight: 600;
}
.ui-li-count {
  background: var(--blue) !important;
  color: #fff !important;
  border: 0 !important;
  text-shadow: none !important;
}

/* ---------- popups (View, profile menu, Close menu) ---------- */
.ui-popup { background: var(--surface) !important; border-radius: 12px !important; box-shadow: 0 10px 30px rgba(16,24,40,.25) !important; }
.ui-popup-screen.in { background: rgba(31, 42, 55, .45) !important; }
/* the View popup header row used white text on a dark background */
#sessions .labelleft { color: var(--text-muted) !important; font-weight: 600; text-transform: uppercase; font-size: 12px; }
#sessions { min-width: 320px; padding: 8px 6px 4px; }

/* ---------- tables (tablesorter "blue" skin) ---------- */
table.tablesorter { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table.tablesorter thead tr th, table.tablesorter tfoot tr th {
  font-weight: 700; font-size: 13px;
  background-color: var(--blue-tint) !important;
  color: var(--blue-dark) !important;
  border-color: var(--border) !important;
}
table.tablesorter thead tr .headerSortUp, table.tablesorter thead tr .headerSortDown {
  background-color: var(--blue-tint-2) !important;
}
table.tablesorter tbody tr.odd td { background: var(--surface-2) !important; }
table.tablesorter tbody td { color: var(--text) !important; border-color: var(--border) !important; }

/* ---------- status colours (use as class names in views) ---------- */
.st-buy      { color: var(--green) !important; }
.st-open     { color: var(--blue)  !important; }
.st-closed   { color: var(--red)   !important; }
.st-suspend  { color: var(--amber) !important; }
#error       { color: var(--red) !important; }
.columntitle { color: var(--blue-dark) !important; font-weight: 600; }

/* =====================================================================
   TABLET (most users) - 768px and wider
   ===================================================================== */
@media (min-width: 768px) {
  /* 16px, not 15: iOS Safari zooms the whole page when an input under 16px gets focus */
  body, .ui-btn-text, .ui-input-text, input, select, textarea { font-size: 16px !important; }
  .ui-content { padding: 14px 20px 90px 20px; }
  .ui-header .ui-title { font-size: 18px; }

  /* data-mini is used everywhere; on a tablet buttons should be full finger size (44px+) */
  .ui-mini .ui-btn-inner, .ui-btn.ui-mini .ui-btn-inner { padding-top: .75em !important; padding-bottom: .75em !important; font-size: 15px !important; }
  .ui-mini .ui-btn-text { font-size: 15px !important; }
  /* icon-only buttons (data-iconpos="notext": delete ✕, arrows, search): no padding, icon centred, 40px touch target */
  .ui-btn.ui-btn-icon-notext, .ui-btn.ui-mini.ui-btn-icon-notext { width: 40px !important; height: 40px !important; }
  .ui-btn-icon-notext .ui-btn-inner, .ui-mini .ui-btn-icon-notext .ui-btn-inner, .ui-btn.ui-mini.ui-btn-icon-notext .ui-btn-inner {
    padding: 0 !important; height: 100%; }
  .ui-btn-icon-notext .ui-btn-inner .ui-icon { position: absolute !important; top: 50% !important; left: 50% !important;
    margin: -9px 0 0 -9px !important; }
  .footer .ui-controlgroup .ui-btn-inner { padding: .85em 22px .85em 34px !important; font-size: 16px; }

  /* scan box: large and centred, the store image smaller so the result is visible without scrolling */
  #barcode { font-size: 24px !important; height: 54px; }
  #searchsku > div { max-width: 640px; }
  #storeimage { max-height: 220px; width: auto; }

  /* View popup: wide enough for the 4 columns; numbers become big tap targets */
  #sessions { min-width: 640px; max-width: 760px; padding: 14px 14px 8px; }
  #sessions .ui-grid-c, #sessions .ui-grid-b { padding: 4px 6px !important; border-bottom: 1px solid var(--border); }
  #sessions .ui-grid-c > div:first-child, #sessions .ui-grid-b > div:first-child { font-size: 15px; font-weight: 600; color: var(--text); }
  #sessions .ui-btn .ui-btn-text { font-size: 20px !important; font-weight: 700; }
  #sessions .ui-listview li a { padding-top: 14px !important; padding-bottom: 14px !important; font-size: 15px; }

  /* lists and session tables */
  .ui-listview > li.ui-li > .ui-btn-inner > .ui-btn-text > a.ui-link-inherit { padding-top: 1em; padding-bottom: 1em; }
  table.tablesorter tbody td, table.tablesorter thead th { padding: 10px 8px !important; font-size: 14px; }
  .ui-popup { max-width: 90vw; }
}

/* =====================================================================
   iPad PORTRAIT (main use) + camera scanning
   ===================================================================== */
/* iOS: no grey flash on tap, no text-size jump on rotate */
html { -webkit-text-size-adjust: 100%; }
a, .ui-btn { -webkit-tap-highlight-color: transparent; }

/* fixed bottom bars must clear the iPad home indicator (needs viewport-fit=cover, see SUGGESTIONS.md) */
.ui-footer-fixed, #banner { padding-bottom: env(safe-area-inset-bottom) !important; }
.ui-header-fixed { padding-top: env(safe-area-inset-top) !important; }

/* camera reader box (html5-qrcode renders a <video> inside #readerbox) */
#readerbox {
  max-width: 100% !important;
  border-radius: 12px;
  overflow: hidden;
  background: #1b2430;
  border: 0 !important;
}
#readerbox video { width: 100% !important; height: auto !important; object-fit: cover; display: block; }
#readerbox img[alt="Info icon"], #readerbox #qr-shaded-region + div { display: none !important; } /* hide library chrome */

@media (min-width: 700px) and (orientation: portrait) {
  #readerbox { max-width: 640px !important; margin: 6px auto 10px !important; }
  #readerbox video { max-height: 34vh; }           /* camera on top, result + session list visible below */
  #readerbox:not([style*="none"]) ~ #storeimage { display: none; }  /* hide the logo only while the camera is on */
  #sessions { min-width: 0; width: 92vw; max-width: 720px; }
}

/* tablet landscape: use the width - two columns where pages use ui-grid-a */
@media (min-width: 1000px) and (orientation: landscape) {
  .ui-content { padding-left: 28px; padding-right: 28px; }
  #sessions { min-width: 760px; }
}

/* ---------- old classes made for the dark background (style.css) ---------- */
.ybold      { color: var(--amber) !important; font-size: 12px !important; } /* "Sugg. $" was yellow; 12px like ep8 (tablet body is 16px) */
.itemsale   { color: var(--green) !important; font-weight: 700; } /* "Our's $" was white */
.quote      { background-color: var(--blue-tint) !important; color: var(--blue-dark) !important; border-radius: 6px; padding: 0 6px; }
.labelleft  { background-color: var(--blue-tint) !important; color: var(--blue-dark) !important; }
.blackbold  { color: var(--text) !important; }
.size14, .size12 { color: var(--text) !important; }
#itemimage  { background-color: var(--surface) !important; border-radius: var(--radius); }
#itemdata td { background-color: var(--surface) !important; color: var(--text) !important; border-bottom: 1px solid var(--border); }
#itemdata td span { color: var(--text) !important; }
#itemdata td span.ybold { color: var(--amber) !important; } /* keep "Sugg. $" amber - the rule above was turning it the same dark grey as the rest */
#itemdata td:first-child span { color: var(--text-muted) !important; }
/* inline black / dark-green headers in dailyreport.php, stopsession.php, views (style="background-color:#000") */
.ui-content [style*="background-color:#000"], .ui-content [style*="background-color: #000"],
.ui-content [style*="background-color:#2d4438"], .ui-content [style*="background-color:#434544"],
.ui-content .stylesummary thead td {
  background-color: var(--blue-tint) !important; color: var(--blue-dark) !important;
  font-weight: 700; font-size: 13px;
}
/* the narrow "Date in" / "Need by" label cells in the session list (views/customerdetail.php, 50px wide) */
.ui-content span[style*="background-color:#000"], .ui-content [style*="background-color:#000"][style*="width:50px"] {
  font-size: 12px !important; line-height: 1.3; white-space: nowrap; border-radius: 4px; padding: 1px 4px; }
/* white text with no background of its own (it sat on the old dark page) */
.ui-content [style*="color:#fff"]:not([style*="background"]),
.ui-content [style*="color: #fff"]:not([style*="background"]) { color: var(--text) !important; }
/* yellow notes made for the dark page (#f7ec1a, #f4fb02, #f7f009, yellow): dark amber, readable on light grey */
.ui-content [style*="#f7ec1a"], .ui-content [style*="#F7EC1A"], .ui-content [style*="#f4fb02"],
.ui-content [style*="#f7f009"], .ui-content [style*="color:yellow"], .ui-content [style*="color: yellow"] {
  color: #8a5a12 !important;
}
.ui-content [style*="#f7ec1a"], .ui-content [style*="#F7EC1A"] { font-size: 13px !important; font-weight: 600; }
.ui-content label { color: var(--text); }   /* expanded_stopsession.php: label {color:yellow} */
.pageseparate { background-color: var(--blue-tint) !important; color: var(--blue-dark) !important; border-radius: 6px; }
/* mystats.php */
.ui-content .r { background-color: var(--surface-2) !important; color: var(--text) !important; }
.ui-content .yellow { background-color: #fbf1df !important; color: #8a5a12 !important; font-weight: 700; }
