/*
 * df-shell.css: the frame of every signed-in page (layouts.app and the AgriControl layout).
 *
 * WR-21 (owner, 3 Dec 2026): a white top bar with one search box, the country switch (DigiFarmer team), the bell, help
 * and the profile menu (with the theme switch); the other buttons moved to where they are used. Every colour is a
 * token of css/df-tokens.css, so the bar follows the light and the dark look (WR-22). Loaded after theme.css.
 * The side menu's own look is printed with the menu (App\Http\AdminlteCustomPresenter).
 */

/* ---- The bar ---- */
.dfc-topbar {
  position: relative;
  z-index: 30;
  background: var(--df-surface);
  border-bottom: 1px solid var(--df-outline);
  color: var(--df-ink);
  font-family: var(--df-font-family);
}
.dfc-topbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--df-space-m);
  min-height: 68px;
  box-sizing: border-box;
  padding: var(--df-space-m) var(--df-space-xl);
}
.dfc-topbar-start {
  display: flex;
  align-items: center;
  gap: var(--df-space-s);
  flex: 1 1 320px;
  min-width: 0;
}
.dfc-topbar-end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--df-space-s);
  margin-left: auto;
}

/* An icon button (44px to tap) and a pill button with words. */
.dfc-tb-icon,
.dfc-tb-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--df-tap-target);
  box-sizing: border-box;
  border: 1px solid var(--df-outline);
  border-radius: var(--df-radius-md);
  background: var(--df-surface);
  color: var(--df-ink-soft);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--df-motion-fast) ease, color var(--df-motion-fast) ease;
}
.dfc-tb-icon { width: var(--df-tap-target); padding: 0; }
.dfc-tb-pill { padding: 0 12px; white-space: nowrap; }
.dfc-tb-icon:hover,
.dfc-tb-pill:hover,
details[open] > summary.dfc-tb-pill {
  background: var(--df-background);
  color: var(--df-ink);
  text-decoration: none;
}
.dfc-topbar summary { list-style: none; }
.dfc-topbar summary::-webkit-details-marker { display: none; }
.dfc-tb-caret { width: 16px; height: 16px; }
/* The sidebar buttons keep their old classes for the scripts (small-view-button, side-bar-collapse). */
.dfc-topbar .small-view-button.dfc-tb-icon { display: inline-flex; }
@media (min-width: 1024px) {
  .dfc-topbar .small-view-button.dfc-tb-icon { display: none; }
}

/* A menu that opens under a bar button: plain links and buttons (2-W-05: no menu roles). */
.dfc-tb-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 1050;
  min-width: 15rem;
  max-width: calc(100vw - 24px);
  margin: 0;
  padding: var(--df-space-s);
  list-style: none;
  background: var(--df-surface);
  color: var(--df-ink);
  border: 1px solid var(--df-outline);
  border-radius: var(--df-radius-md);
  box-shadow: 0 12px 32px rgba(16, 35, 26, .14);
}
.dfc-tb-menu-head {
  margin: 0;
  padding: var(--df-space-xs) var(--df-space-m) var(--df-space-s);
  color: var(--df-ink-muted);
  font-size: var(--df-font-size-small);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.dfc-tb-menu-form { margin: 0; }
.dfc-tb-menu-row {
  display: flex;
  align-items: center;
  gap: var(--df-space-s);
  width: 100%;
  min-height: var(--df-tap-target);
  box-sizing: border-box;
  padding: 0 var(--df-space-m);
  border: 0;
  border-radius: var(--df-radius-sm);
  background: none;
  color: var(--df-ink-soft);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.dfc-tb-menu-row:hover {
  background: var(--df-background);
  color: var(--df-ink);
  text-decoration: none;
}
.dfc-tb-menu-row[aria-pressed="true"] {
  background: var(--df-primary-container);
  color: var(--df-on-primary-container);
  font-weight: 700;
}
.dfc-tb-menu-row[aria-pressed="true"]::after {
  content: "\2713";
  margin-left: auto;
}

/* ---- The search box ---- */
.dfc-find {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--df-space-s);
  flex: 1 1 auto;
  max-width: 560px;
  min-width: 0;
  min-height: var(--df-tap-target);
  box-sizing: border-box;
  padding: 0 var(--df-space-m);
  border: 1px solid var(--df-outline);
  border-radius: var(--df-radius-md);
  background: var(--df-background);
  color: var(--df-ink-soft);
}
.dfc-find:focus-within {
  border-color: var(--df-primary);
  box-shadow: 0 0 0 1px var(--df-primary);
}
.dfc-find .dfc-sa-label {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.dfc-find-icon { width: 18px; height: 18px; flex: none; }
.dfc-topbar .dfc-find-input,
.dfc-topbar .dfc-find-input:focus {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  width: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--df-ink);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  outline: none !important;
}
.dfc-topbar .dfc-find-input::placeholder { color: var(--df-ink-muted); font-weight: 500; }
.dfc-find-key {
  flex: none;
  padding: 1px 8px;
  border: 1px solid var(--df-outline);
  border-radius: 6px;
  background: var(--df-surface);
  color: var(--df-ink-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  box-shadow: none;
}
.dfc-find-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 1060;
  max-height: min(70vh, 520px);
  overflow-y: auto;
  padding: var(--df-space-s);
  background: var(--df-surface);
  border: 1px solid var(--df-outline);
  border-radius: var(--df-radius-md);
  box-shadow: 0 12px 32px rgba(16, 35, 26, .14);
}
.dfc-find-panel[hidden],
.dfc-find-panel [hidden] { display: none !important; }
.dfc-find .dfc-sa-status {
  padding: var(--df-space-xs) var(--df-space-s) var(--df-space-s);
  color: var(--df-ink-muted);
  font-size: 13px;
  font-weight: 600;
}
.dfc-find-group + .dfc-find-group { margin-top: var(--df-space-s); padding-top: var(--df-space-s); border-top: 1px solid var(--df-outline); }
.dfc-find-head {
  margin: 0;
  padding: var(--df-space-xs) var(--df-space-s);
  color: var(--df-ink-muted);
  font-size: var(--df-font-size-small);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.dfc-find-hit {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 6px;
  min-height: var(--df-tap-target);
  box-sizing: border-box;
  padding: 10px var(--df-space-s);
  border-radius: var(--df-radius-sm);
  color: var(--df-ink);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.dfc-find-hit:hover,
.dfc-find-hit:focus,
.dfc-find-hit.is-best {
  background: var(--df-primary-container);
  color: var(--df-on-primary-container);
  text-decoration: none;
}
.dfc-find-sub { color: var(--df-ink-muted); font-size: 13px; font-weight: 600; }
.dfc-find-list { color: var(--df-primary-strong); }

/* The Superadmin menu's own copy of the matches stays under the menu (no box there any more). */
.dfc-nav .dfc-sa-search { padding: 0 4px; }

/* ---- Country switch ---- */
.dfc-country-name { max-width: 12rem; overflow: hidden; text-overflow: ellipsis; }
.dfc-country-locked { cursor: default; }
.dfc-country-menu { min-width: 13rem; }

/* ---- Bell, help, DigiFarmer AI ---- */
.dfc-bell-box { position: relative; }
.dfc-bell { position: relative; }
.dfc-topbar .dfc-bell .notifications_count {
  position: absolute;
  top: 4px;
  right: 2px;
  min-width: 18px;
  padding: 2px 5px;
  border-radius: var(--df-radius-pill);
  background: var(--df-error);
  color: var(--df-on-primary);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}
.dfc-topbar .dfc-bell .notifications_count:empty { display: none; }
.dfc-topbar .dfc-help-button {
  min-height: var(--df-tap-target);
  min-width: var(--df-tap-target);
  justify-content: center;
  padding: 0 10px;
  border: 1px solid var(--df-outline);
  border-radius: var(--df-radius-md);
  background: var(--df-surface);
  color: var(--df-ink-soft);
  box-shadow: none;
}
.dfc-topbar .dfc-help-button > span {
  position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap;
}
.dfc-topbar .dfc-help-button:hover { background: var(--df-background); color: var(--df-ink); }
.dfc-ai-button { color: var(--df-primary-strong); }

/* ---- Profile ---- */
.dfc-profile-button { padding: 0 10px 0 4px; }
.dfc-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--df-radius-pill);
  background: var(--df-warning-container);
  color: var(--df-warning);
  font-size: 13px;
  font-weight: 800;
}
.dfc-profile-name { max-width: 12rem; overflow: hidden; text-overflow: ellipsis; color: var(--df-ink); }
.dfc-profile-who { padding: var(--df-space-s) var(--df-space-m) var(--df-space-s); }
.dfc-profile-who p { margin: 0; color: var(--df-ink-muted); font-size: 13px; }
.dfc-profile-who .dfc-profile-who-name { color: var(--df-ink); font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The white menus of the old header partials (business switcher, notifications) follow the dark look too. */
.dfc-topbar .tw-dw-dropdown-content.tw-bg-white,
.dfc-topbar .dropdown-menu {
  background: var(--df-surface) !important;
  color: var(--df-ink);
  border-color: var(--df-outline);
}

/* ---- Phone width: the search box gets its own line; the bar never scrolls sideways ---- */
@media (max-width: 767px) {
  .dfc-topbar-row { padding: var(--df-space-s) var(--df-space-l); }
  .dfc-topbar-start { order: 2; flex-basis: 100%; }
  .dfc-topbar-end { order: 1; margin-left: 0; width: 100%; justify-content: space-between; }
  .dfc-find { max-width: none; }
  .dfc-find-key { display: none; }
  .dfc-country-name { max-width: 6.5rem; }
}
