/**
 * Presentation rules for controls. Theme variables keep colors consistent; media queries adapt
 * the same components to smaller screens.
 * File: public/assets/controls.css
 */
/* Shared controls load after page styles so older page rules cannot hide labels. */
html[data-theme]
  body
  :is(main, .main)
  :is(
    :where(
      button:not(.table-sort-button):not(.avatar-button):not(.account-menu-toggle):not(
          .nav button
        ):not(.segmented button):not(.auth-tabs button)
    ),
    a.primary,
    a.secondary,
    a.gold-action,
    a.button,
    a.btn,
    input[type="submit"],
    input[type="button"]
  ) {
  min-height: 44px;
  max-width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--green);
  border-radius: 10px;
  font: 650 14px/1.4 var(--pjs-ui-font);
  color: var(--on-surface, var(--ink));
  background: var(--white);
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  text-decoration: none;
  vertical-align: middle;
}
html[data-theme]
  body
  :is(main, .main)
  :is(a.primary, a.gold-action, button.primary, input[type="submit"]) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--green);
  color: var(--on-accent, #111111) !important;
}
html[data-theme]
  body
  :is(main, .main)
  :is(
    button,
    a.primary,
    a.secondary,
    a.gold-action,
    a.button,
    a.btn,
    input[type="submit"],
    input[type="button"]
  ):is(:hover, :focus-visible) {
  color: var(--on-raised, var(--ink)) !important;
  background: var(--mint);
  filter: none;
}
html[data-theme]
  body
  :is(main, .main)
  :is(button, input[type="submit"], input[type="button"]):disabled {
  opacity: 0.82;
  cursor: not-allowed;
  translate: none;
  box-shadow: none;
}
html[data-theme] body :is(main, .main) .table-sort-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 4px;
  border: 0;
  border-radius: 5px;
  color: var(--ink);
  background: transparent;
  font: 700 13px/1.4 system-ui;
  text-align: left;
  white-space: normal;
}
html[data-theme] body :is(main, .main) .table-sort-button:hover {
  color: var(--ink);
  background: var(--mint);
  translate: none;
  box-shadow: none;
}
html[data-theme] body :is(main, .main) :is(button, a, input):focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
}
@media screen {
  .table-wrap,
  .table-scroll {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--white);
    scrollbar-gutter: stable;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }
  main table {
    width: 100%;
    border-collapse: collapse;
    color: var(--ink);
    font-size: 14px;
    line-height: 1.5;
  }
  main th,
  main td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
  }
  main thead th {
    background: var(--mint);
    color: var(--ink);
    font-weight: 700;
  }
  main tbody tr:last-child td {
    border-bottom: 0;
  }
  main tbody tr:hover {
    background: var(--mint);
  }
  main td :is(input, select, textarea) {
    color: var(--ink);
    background: var(--white);
  }
  .form-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
  }
  html[data-theme] body :is(main, .main) .account-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
  }
  html[data-theme] body :is(main, .main) .account-row-actions form {
    margin: 0;
    display: inline-flex;
  }
  html[data-theme] body :is(main, .main) .account-row-actions :is(a, button) {
    margin: 0;
    min-width: 108px;
  }
  .account-id {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
  }
  .accounts-table {
    table-layout: fixed;
  }
  .accounts-table td {
    overflow-wrap: anywhere;
  }
  .accounts-table th:first-child {
    width: 40%;
  }
  @media (max-width: 600px) {
    .admin-page section {
      padding: 16px 12px;
    }
    .accounts-table thead {
      display: table;
      width: 100%;
      table-layout: fixed;
    }
    .accounts-table thead tr {
      display: table-row;
    }
    .accounts-table thead th {
      display: table-cell;
      padding: 8px 4px;
    }
    .accounts-table,
    .accounts-table tbody,
    .accounts-table tr,
    .accounts-table td {
      display: block;
      width: 100%;
    }
    .accounts-table tr {
      padding: 12px;
      border-bottom: 1px solid var(--line);
    }
    .accounts-table td {
      padding: 6px 0;
      border: 0;
    }
    .accounts-table td:first-child {
      font-size: 16px;
    }
    .accounts-table td:nth-child(2)::before {
      content: "Email: ";
      font-weight: 650;
    }
    .accounts-table td:nth-child(3)::before {
      content: "Store / role / theme: ";
      display: block;
      font-weight: 650;
    }
  }
}

@media screen {
  main td :is(button, a.gold-action, a.primary, a.secondary) {
    min-width: 100px;
    word-break: normal;
    overflow-wrap: normal;
  }
}

html[data-theme] body main .employee-rule-actions {
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin-top: 12px;
}
html[data-theme] body main .employee-rule-actions > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
}

.driver-role-options {
  min-width: 150px;
  border: 0;
  padding: 0;
  margin: 0;
}
.driver-role-options legend {
  font-size: 12px;
}
.driver-role-options label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0;
}
.driver-role-options input[type="checkbox"] {
  width: auto;
  margin: 0;
}

/* Space submit controls below their form fields without disturbing table actions. */
html[data-theme]
  body
  main
  form:not(.inline-form):not(.theme-management)
  > :is(button[type="submit"], button.primary, input[type="submit"], .form-actions) {
  margin-top: 20px;
}
html[data-theme] body main .theme-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
  padding-top: 10px;
}
html[data-theme] body main .theme-edit-actions button {
  margin-top: 0;
}

/* The same typeface and action geometry across dashboard and standalone shells. */
:root {
  --pjs-ui-font: system-ui, -apple-system, "Segoe UI", sans-serif;
}

:root body,
:root body :is(h1, h2, h3, h4, h5, h6, button, input, select, textarea),
#weatherStudio[data-mode="pjstips"],
#weatherStudio[data-mode="pjstips"] :is(button, input, select, textarea) {
  font-family: var(--pjs-ui-font);
}

/* Tabs, sort controls, navigation, and preview controls have their own states. */
:root body :is(main, .main, .public-header-slot, #weatherStudio[data-mode="pjstips"] .ws-actions)
  :is(button, input[type="submit"], input[type="button"], a.primary, a.secondary, a.gold-action, a.button, a.btn):not(
    .table-sort-button,.avatar-button,.account-menu-toggle,.dismiss-notice,.nav button,
    .segmented button,.auth-tabs button,[role="tab"],.ws-tabs button,.ws-preview button,.date-trigger,.pjs-calendar button,.admin-tool-card
  ) {
  box-sizing: border-box;
  min-height: 44px;
  max-width: 100%;
  border-radius: 10px;
  font-family: var(--pjs-ui-font);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.4;
  padding: 10px 16px;
  border-width: 1px;
  border-style: solid;
  white-space: normal;
  text-align: center;
  text-decoration: none;
}

/* Standalone shells use the same primary and secondary action treatment. */
:root:not([data-theme]) body main .layout-toolbar button {
  border-color: var(--accent, var(--orange, var(--line, #526178)));
  background: var(--raised, var(--panel, #182234));
  color: var(--ink, var(--text, #eef4ff));
  cursor: pointer;
}

:root:not([data-theme]) body main .layout-toolbar button.primary {
  background: var(--green, var(--accent, var(--orange, #2764cf)));
  color: var(--pjs-primary-text, #fff);
}

.public-header-slot ~ main {
  --pjs-primary-text: #111;
}

/* Retain Pizza Kitchen's distinct filled actions and keep their labels readable. */
html[data-theme="pizza_kitchen"] body :is(main, .main)
  :is(a.primary, a.gold-action, button.primary, input[type="submit"]):not(:hover):not(:focus-visible) {
  color: #fff9f1 !important;
  background: #b72c24;
}
