/* ============================================================
   SPARC overrides for the oshelpdesk theme (osTicket 1.18.4)
   Loaded AFTER helpdesk-client-portal.css (client) and
   helpdesk-staff-panel.css (staff). The theme's own files are
   untouched; remove the <link> tags to undo.

   Scoping: the same file is loaded by both portals, so every
   CLIENT rule is anchored on client-only markup
   (#logo.pull-left, #header > .flush-right, #nav.flush-left,
   #landing_page, #ticketForm, #clientLogin) or on :has() with
   those anchors. STAFF rules are in their own section at the end
   and only touch colors / the logo image.
   ============================================================ */

/* ---------------- CLIENT: page frame ---------------- */
#container:has(> #nav.flush-left) {
  width: auto;
  max-width: 840px;
}

/* ---------------- CLIENT: header layout ----------------
   Logo pill on the left, user links + dark-mode toggle on the right,
   all vertically centered. (#header is already display:flex via theme.) */
#header:has(> #logo.pull-left) {
  height: auto;
  min-height: 72px;
  align-items: center;
  gap: 8px 12px;
  padding-top: 8px;
  padding-bottom: 8px;
}
#header > #logo.pull-left {
  order: 0;
  float: none;
  margin: 0 auto 0 0;               /* pushes everything else to the right */
  height: auto;
  display: inline-flex;
  align-items: center;
  background: #ffffff;              /* light pill so the dark-text logo is legible */
  border-radius: 12px;
  padding: 6px 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  line-height: 0;
  max-width: 100%;
}
#header > #logo.pull-left .valign-helper { display: none; }
#header > #logo.pull-left img {
  display: block;
  max-height: 44px;
  max-width: 100%;
  width: auto;
  height: auto;
  margin: 0;
  border: 0;
}
#header > .pull-right.flush-right {
  order: 1;
  float: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
#header > .pull-right.flush-right p {
  width: auto;
  margin: 0;
  padding: 0;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
}
#header > .pull-right.flush-right p:empty,
#header > .pull-right.flush-right p:last-child:not(:first-child):not(:has(*)) { display: none; }
#header > .pull-right.flush-right a {
  color: var(--helpdesk-gold-500, #f2a900);
  font-weight: 600;
  text-decoration: none;
}
#header > .pull-right.flush-right a:hover,
#header > .pull-right.flush-right a:focus { color: #ffffff; text-decoration: underline; }
#header:has(> #logo.pull-left) .helpdesk-theme-toggle {
  order: 2;
  flex: 0 0 auto;
  margin-left: 0;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.45);
}
/* Nav is always visible (wrapping tabs), so the theme's hamburger is not needed */
#header:has(> #logo.pull-left) .helpdesk-nav-toggle { display: none !important; }

/* ---------------- CLIENT: nav tabs ---------------- */
#nav.flush-left {
  display: flex;
  flex-direction: row;              /* theme switches it to a hidden column at <=900px */
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  position: static;
  height: auto;
  margin: 0;
  padding: 8px 14px;
  white-space: normal;
  border-top: 0;
  box-shadow: none;
  background-image: none;
}
#nav.flush-left li {
  display: block;
  margin: 0;
  padding: 0;
  list-style: none;
}
#nav.flush-left li a {
  display: inline-flex !important;
  align-items: center;
  height: auto;
  min-height: 38px;
  margin: 0;
  padding: 8px 16px 8px 36px !important;   /* left room for the 16px icon */
  line-height: 1.2;
  border-radius: 999px;
  white-space: nowrap;
  color: #ffffff !important;
  font-weight: 600;
  text-decoration: none;
  background-color: rgba(255, 255, 255, 0.08);
  background-repeat: no-repeat;
  background-position: 12px 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
}
/* the theme's generic .status badge rule (uppercase/0.78rem) also hits a.status — undo it here */
#nav.flush-left li a.status {
  text-transform: none;
  letter-spacing: normal;
  font-size: inherit !important;
  font-weight: 600 !important;
  border-radius: 999px !important;
}
#nav.flush-left li a:hover,
#nav.flush-left li a:focus {
  background-color: rgba(255, 255, 255, 0.2);
  color: #ffffff !important;
}
#nav.flush-left li a.active,
#nav.flush-left li a.active:hover {
  background-color: var(--helpdesk-gold-500, #f2a900);
  border-color: var(--helpdesk-gold-500, #f2a900);
  color: var(--helpdesk-navy-900, #0a1f44) !important;
  font-weight: 700 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ---------------- CLIENT: content ---------------- */
#nav.flush-left ~ #content img { max-width: 100%; height: auto; }

/* ---------------- CLIENT: mobile (<= 768px) ---------------- */
@media (max-width: 768px) {
  #container:has(> #nav.flush-left) {
    max-width: 100%;
    box-shadow: none;
  }
  #header:has(> #logo.pull-left) {
    flex-wrap: wrap;
    padding: 10px 12px;
  }
  #header > #logo.pull-left {
    max-width: calc(100% - 52px);  /* leave room for the toggle on the same row */
    padding: 5px 10px;
  }
  #header > #logo.pull-left img { max-height: 36px; }
  #header:has(> #logo.pull-left) .helpdesk-theme-toggle { order: 1; }
  #header > .pull-right.flush-right {
    order: 2;
    flex: 1 0 100%;
    text-align: left;
  }
  #header > .pull-right.flush-right p { white-space: normal; }

  #nav.flush-left { padding: 8px 12px; }
  #nav.flush-left li { flex: 1 1 auto; }
  #nav.flush-left li a { width: 100%; justify-content: center; }

  #nav.flush-left ~ #content {
    margin: 0 12px;
    padding: 16px 0;
  }
  #landing_page .sidebar,
  #landing_page .main-content {
    float: none;
    width: auto;
    margin: 0 0 16px 0;
  }
  #landing_page .front-page-button a.button {
    max-width: none;
    width: 100%;
  }
  #ticketForm table,
  #clientLogin {
    width: 100% !important;
    max-width: 100%;
    padding: 8px;
    background-image: none;           /* the decorative lock would sit on top of the inputs */
  }
  /* login / check-status box: stack the two table cells */
  #clientLogin > div[style*="table-row"],
  #clientLogin > div[style*="table-row"] > div {
    display: block !important;
    width: auto !important;
    box-shadow: none;
  }
  #clientLogin > div[style*="table-row"] > div { padding: 12px !important; }
  #clientLogin > div[style*="table-row"] > div + div {
    border-top: 1px solid var(--helpdesk-gray-200, #dde1e7);
  }
  #ticketForm table td { display: block; width: auto !important; }
  #ticketForm input[type="text"],
  #ticketForm input[type="email"],
  #ticketForm input[type="tel"],
  #ticketForm select,
  #ticketForm textarea,
  #clientLogin input[type="text"],
  #clientLogin input[type="email"],
  #clientLogin input[type="password"] {
    width: 100% !important;
    max-width: 100%;
  }
  #ticketForm .buttons input,
  #ticketForm p.buttons input,
  #clientLogin input[type="submit"],
  #nav.flush-left ~ #content .btn,
  #nav.flush-left ~ #content input[type="submit"],
  #nav.flush-left ~ #content input[type="reset"],
  #nav.flush-left ~ #content input[type="button"] {
    width: 100%;
    margin: 4px 0;
  }
}

/* ---------------- STAFF panel (conservative; logged-in pages not visually verified) ----------------
   Colors + logo image only; no layout that the SCP JS measures.
   Anchors are staff-only markup: #header > p#info and #header > a#logo.no-pjax.
   - stock scp.css draws the "Welcome, … | Profile | Log Out" line in a light
     #eee box, but the theme forces #header text white (!important), which makes
     "Welcome, <name>." white-on-light. Restore dark text inside that box. */
#header > p#info { color: #1a1d23 !important; }
#header > p#info strong { color: #0a1f44 !important; }
/* - dark-text logo on the theme's navy bar: give the image a white pill */
#header > a#logo.no-pjax img {
  background: #ffffff;
  border-radius: 8px;
  padding: 3px 8px;
  box-sizing: border-box;
}
