/* base.css
   Shared layout/components for all customers
*/

:root {
  --bg: #f4f7f7;
  --bg-accent: #e8f0f0;
  --card: #ffffff;
  --card-border: #d7e2e2;

  --text: #102222;
  --muted: #4c6666;

  --field-bg: #ffffff;
  --field-border: #b8cfcf;

  --primary: #0f766e;
  --primary-hover: #0b5e58;
  --secondary: #355e5a;
  --secondary-hover: #294946;

  --ok: #0a7f5a;
  --warn: #a86500;
  --bad: #b42318;

  --pill-bg: #e7f3f2;
  --pill-border: #c8dedd;

  --shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  --radius: 14px;
}

/* RESET */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

html {
  background: linear-gradient(180deg, var(--bg), var(--bg-accent));
}

body {
  font-family: Arial, sans-serif;
  background: transparent;
  color: var(--text);
  padding: 18px;
  max-width: 1100px;
  min-height: 100vh;
  margin-left: auto;
  margin-right: auto;
  overflow-x: hidden;
}

/* TYPOGRAPHY */
h1,
h2,
h3,
h4 {
  margin-top: 0;
  color: var(--text);
}

label {
  display: block;
  margin-top: 12px;
  font-weight: bold;
  color: var(--text);
}

/* FORM ELEMENTS */
input,
select,
button,
textarea {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px;
  margin-top: 6px;
  border-radius: 12px;
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  color: var(--text);
  min-width: 0;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

/* BUTTONS */
button {
  padding: 12px 14px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  background: var(--primary);
  color: #fff;
  transition: background 0.15s ease, transform 0.05s ease;
}

button:hover {
  background: var(--primary-hover);
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* TOP TOOLBAR */
.btnToolbar {
  display: flex;
  gap: 10px;
  align-items: stretch;
  margin-top: 12px;
}

.btnGroup {
  display: flex;
  gap: 10px;
  min-width: 0;
}

.btnGroup.primary {
  flex: 1 1 auto;
}

.btnGroup.primary button {
  flex: 1 1 0;
  min-width: 0;
  font-weight: 600;
}

.btnGroup.secondary {
  flex: 0 0 auto;
  margin-left: auto;
}

.btnGroup.secondary button {
  padding: 10px 12px;
  font-size: 13px;
  white-space: nowrap;
  background: var(--secondary);
}

.btnGroup.secondary button:hover {
  background: var(--secondary-hover);
}

/* LAYOUT */
.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 700px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* CARD */
.card {
  border: 1px solid var(--card-border);
  background: var(--card);
  padding: 14px;
  border-radius: var(--radius);
  margin-top: 12px;
  box-shadow: var(--shadow);
  max-width: 100%;
}

/* TEXT HELPERS */
.small {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.45;
}

.muted {
  color: var(--muted);
}

.ok {
  color: var(--ok);
  font-weight: bold;
}

.warn {
  color: var(--warn);
  font-weight: bold;
}

.bad {
  color: var(--bad);
  font-weight: bold;
}

.msg {
  font-size: 15px;
  margin: 0;
}

/* PILLS */
.pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  font-size: 12px;
  font-weight: 600;
}

.pill.on {
  background: #e7fff6;
  border-color: #b8f1dd;
}

.pill.off {
  background: #fff4f4;
  border-color: #f1b8b8;
}

/* TABLE */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
}

th,
td {
  border-bottom: 1px solid #e8eeee;
  padding: 8px;
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}

th {
  background: rgba(0, 0, 0, 0.03);
}

/* CODE / PRE */
pre {
  background: #f7f9f9;
  border: 1px solid var(--card-border);
  padding: 12px;
  overflow: auto;
  border-radius: 12px;
  max-width: 100%;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.timeCell {
  white-space: normal;
  line-height: 1.35;
}

/* BUTTON ROW */
.btnRow {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btnRow button {
  flex: 1;
  min-width: 140px;
}

/* SMALL CONTROLS */
.mini {
  padding: 8px 10px;
  font-size: 13px;
}

.inlineSel {
  padding: 8px 10px;
  font-size: 13px;
}

/* SHOW/HIDE BUTTON */

.cardHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.cardHead h3,
.cardHead h4 {
  margin: 0;
}

.cardHead .toggleCardBtn {
  flex: 0 0 auto;
  min-width: 88px;
}

.is-collapsed {
  display: none;
}

/* GENERIC CHECKBOX */
.checkboxLabel {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  padding: 4px 0;
  max-width: 100%;
}

.checkboxLabel input[type="checkbox"] {
  width: auto;
  margin-top: 3px;
  flex: 0 0 auto;
}

.checkboxLabel span {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* OPTIONAL SOFT BOX */
.optionBox {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  background: var(--bg-accent);
}

/* MANUAL CHECK-IN */
.manualInlineOption {
  margin-top: 10px;
  max-width: 100%;
}

.manualCheckboxInline {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  max-width: 100%;
  min-width: 0;
}

.manualCheckboxInline input[type="checkbox"] {
  width: auto;
  margin: 2px 0 0 0;
  flex: 0 0 auto;
}

.manualCheckboxInline span {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* HEADER */
.app-header {
  margin-bottom: 14px;
}

.app-header h1 {
  margin-bottom: 6px;
}

/* INSTRUCTION */
.instruction {
  margin: 10px 0 14px 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
}

/* CSV PREVIEW TABLE */
.csvPreviewControls {
  margin-bottom: 8px;
  font-size: 13px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.csvPreviewControls .mini {
  padding: 6px 10px;
  font-size: 12px;
}

.csvPreviewWrap {
  max-height: 400px;
  overflow: auto;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: var(--card);
}

.csvPreviewTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 0;
}

.csvPreviewTable th,
.csvPreviewTable td {
  border: 1px solid #e8eeee;
  padding: 6px 8px;
  text-align: left;
  white-space: nowrap;
}

.csvPreviewTable th {
  background: #f5f5f5;
  position: sticky;
  top: 0;
  z-index: 1;
}

.csvPreviewTable tr:nth-child(even) {
  background: #fafafa;
}

/* MOBILE / TABLET */
@media (max-width: 768px) {
  html {
    background-attachment: scroll;
  }

  body {
    padding: 10px;
  }

  .card {
    padding: 12px;
  }

  .row,
  .btnRow {
    flex-direction: column;
  }

  input,
  select,
  button,
  textarea {
    font-size: 16px;
  }

  button {
    min-height: 44px;
  }

  body,
  .card,
  table,
  pre {
    max-width: 100%;
  }

  /* RESULTS TABLES -> card style rows */
  table {
    display: block;
    width: 100%;
  }

  thead {
    display: none;
  }

  tbody {
    display: block;
    width: 100%;
  }

  tr {
    display: block;
    margin-bottom: 14px;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--card-border);
    background: var(--card);
  }

  td {
    display: block;
    padding: 6px 0;
    border: none;
  }

  td::before {
    content: attr(data-label) ": ";
    font-weight: bold;
  }

  td.actions::before {
    content: attr(data-label) ": ";
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
  }

  td.actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px solid var(--card-border);
  }

  td.actions button {
    width: 100%;
    margin: 0;
    display: block;
    text-align: center;
  }

  /* TOP BUTTONS -> 3 neat rows on phone */
  .btnToolbar {
    flex-direction: column;
    gap: 8px;
  }

  .btnGroup.primary,
  .btnGroup.secondary {
    width: 100%;
    margin-left: 0;
  }

  .btnGroup.primary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .btnGroup.secondary {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
  }

  .btnGroup.primary button,
  .btnGroup.secondary button {
    width: 100%;
    min-width: 0;
    white-space: normal;
    text-align: center;
  }

  .btnGroup.secondary button {
    font-size: 14px;
    padding: 10px 8px;
  }

  /* Manual checkbox text stays inside */
  .manualCheckboxInline,
  .checkboxLabel {
    align-items: flex-start;
  }

  .manualCheckboxInline span,
  .checkboxLabel span {
    width: 100%;
  }
}

/* LANDSCAPE PHONE / SMALL TABLET */
@media (max-width: 932px) and (orientation: landscape) {
  body {
    padding: 10px 12px;
  }

  .btnToolbar {
    flex-direction: column;
    gap: 8px;
  }

  .btnGroup.primary,
  .btnGroup.secondary {
    width: 100%;
    margin-left: 0;
  }

  .btnGroup.primary {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 8px;
  }

  .btnGroup.secondary {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
  }

  .btnGroup.primary button,
  .btnGroup.secondary button {
    min-width: 0;
    white-space: nowrap;
    padding-left: 10px;
    padding-right: 10px;
  }

  .btnGroup.secondary button {
    font-size: 13px;
  }

  .manualCheckboxInline span,
  .checkboxLabel span {
    min-width: 0;
    max-width: 100%;
  }
}

/* APP TOP NAV — Organization / Admin / Settings etc. */
.dashNav > a.dashNavLink,
.dashNav > button,
.dashNav a button,
.adminNav > a.dashNavLink,
.adminNav > button,
.adminNav a button,
.topActions a button {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  width: auto;
  margin-top: 0;
  background: #fff !important;
  color: var(--primary) !important;
  border: 2px solid var(--pill-border, #d8ecea) !important;
  font-weight: 700;
  box-shadow: none;
  transform: none;
  opacity: 1;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.dashNav > a.dashNavLink:hover,
.dashNav > button:hover,
.dashNav a button:hover,
.adminNav > a.dashNavLink:hover,
.adminNav > button:hover,
.adminNav a button:hover,
.topActions a button:hover {
  text-decoration: none;
  background: var(--pill-bg, #eef6f6) !important;
  border-color: var(--primary) !important;
  color: var(--primary-hover) !important;
}

.dashNav > span.dashNavLink.active,
.dashNav > button[disabled],
.dashNav a button[disabled],
.adminNav > span.dashNavLink.active,
.adminNav > button[disabled],
.adminNav a button[disabled],
.topActions a button[disabled] {
  background: var(--primary) !important;
  color: #fff !important;
  border: 2px solid var(--primary-hover) !important;
  box-shadow:
    0 0 0 2px #fff,
    0 0 0 4px var(--primary),
    0 4px 12px rgba(0, 0, 0, 0.2) !important;
  opacity: 1 !important;
  cursor: default;
  transform: translateY(-1px);
}

/* UTILITIES */
.hidden {
  display: none !important;
}

/* Org name on logo — under SiteClockr wordmark (1204×450 art coordinates) */
.appHeader {
  text-align: center;
  width: 100%;
}

.appHeaderBrand {
  position: relative;
  display: block;
  width: 100%;
  max-width: 760px;
  margin: 12px auto 8px;
  line-height: 0;
}

.appHeaderBrand .appLogo {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  padding: 0;
}

.appHeaderOrgName {
  position: absolute;
  left: 58.6%;
  top: 72%;
  transform: translate(-50%, -50%);
  width: 54%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent !important;
  color: #ffffff !important;
  font-size: clamp(18px, 8vw, 62px);
  font-weight: 700;
  line-height: 1.05;
  text-align: center;
  letter-spacing: 0.01em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  white-space: nowrap;
}

.appHeaderOrgName:empty {
  display: none;
}