/* *AddedByAi* responsive.css — shared sizing rules loaded LAST on every page.
   Goal: buttons and text scale with the screen size and orientation, and
   button groups wrap instead of overlapping (phones/tablets in landscape). */

/* Stop phones/tablets from "inflating" text when rotated to landscape.
   This inflation is what pushed button labels past their buttons. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

*, *::before, *::after { box-sizing: border-box; }
img, svg, video, canvas { max-width: 100%; }

/* Anything marked hidden stays hidden, even if a rule below gives it a display. */
[hidden] { display: none !important; }

/* ---------- Buttons: one sizing system for every page ---------- */
.primary-button,
.outline-button {
  /* Links styled as buttons were display:inline, so their padding overlapped
     the row above/below when they wrapped. inline-flex fixes that. */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
  max-width: 100%;
  min-height: 40px;
  font-size: clamp(10px, calc(0.45rem + 0.35vw), 13px);
  padding: clamp(9px, 1.1vw, 14px) clamp(11px, 1.6vw, 20px);
}
.account-button,
.primary-button.full,
button.full { display: flex; width: 100%; }

/* Any group of buttons wraps with a gap instead of colliding. */
.admin-top-actions,
.hero-actions,
.user-heading-actions,
.row-actions,
.sub-nav,
.section-head,
.panel-heading,
.admin-group > div {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(6px, 1vw, 10px);
}
.row-actions { flex-wrap: wrap; }

/* ---------- Page headers ---------- */
.admin-top,
.sub-head,
.safety-head {
  flex-wrap: wrap;
  gap: 10px 16px;
  padding-left: clamp(14px, 4vw, 5vw);
  padding-right: clamp(14px, 4vw, 5vw);
}
.admin-top-actions { justify-content: flex-end; }
.admin-brand { min-width: 0; }
.admin-brand img { width: clamp(40px, 6vw, 54px); height: clamp(40px, 6vw, 54px); }

/* ---------- Admin Portal home: cards in a responsive grid ---------- */
.admin-groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: clamp(12px, 2vw, 22px);
  margin-bottom: 28px;
}
.admin-group {
  background: #fffaf0;
  border: 1px solid #dac7a9;
  border-radius: 18px;
  padding: clamp(16px, 2.2vw, 26px);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.admin-group > p {
  margin: 0;
  font-size: clamp(9px, 0.9vw, 10px);
  letter-spacing: 0.16em;
  color: var(--brand-copper, #b9753a);
  font-weight: 700;
}
.admin-group > h2 {
  margin: 0 0 8px;
  font-size: clamp(18px, 2vw, 24px);
}
.admin-group > .primary-button { align-self: flex-start; }
.admin-group > div > .primary-button { flex: 1 1 auto; }

/* ---------- Headline text scales with the screen ---------- */
.admin-hero h1,
.sub-hero h1 { font-size: clamp(30px, 5vw, 64px) !important; }
.panel-heading h2,
.dialog-head h2 { font-size: clamp(22px, 3vw, 32px); }

/* Fixed bottom navigation must not cover the last buttons on the page. */
body:has(> .bottom-nav) { padding-bottom: 84px; }

/* ---------- Phones (portrait) ---------- */
@media (max-width: 600px) {
  .admin-top { justify-content: center; }
  .admin-top-actions { justify-content: center; width: 100%; }
  .admin-top-actions > * { flex: 1 1 0; min-width: 0; }
  .admin-hero { padding-bottom: 24px; }
}

/* ---------- Short screens = phones/tablets turned to landscape ---------- */
@media (orientation: landscape) and (max-height: 560px) {
  .admin-top, .sub-head, .safety-head { padding-top: 8px; padding-bottom: 8px; }
  .admin-main { padding-top: 18px; padding-bottom: 18px; }
  .admin-hero { padding: 0 0 16px; }
  .admin-hero h1, .sub-hero h1 { font-size: clamp(24px, 4vw, 40px) !important; margin: 4px 0 6px; }
  .sub-hero { margin: 16px auto 14px; }
  .primary-button, .outline-button { min-height: 36px; }
  .bottom-nav a, .bottom-nav button { padding: 4px; }
  .bottom-nav a span, .bottom-nav button span { font-size: 15px; margin-bottom: 1px; }
  body:has(> .bottom-nav) { padding-bottom: 64px; }
}

/* Header buttons keep a readable size on small screens (overrides older 8px rule). */
.admin-top-actions .outline-button,
.admin-top-actions .primary-button {
  font-size: clamp(10px, calc(0.45rem + 0.35vw), 12px);
  padding: 8px clamp(10px, 1.4vw, 18px);
}
