/* ==========================================================================
   App chrome for Rails-served pages using the redesigned look.
   Loaded after site-new.css (which defines the design tokens in :root).
   Styles page content — tables, forms, buttons, alerts — for the admin and
   other internal pages, so they match the new design without Bootstrap.
   ========================================================================== */

/* App/admin pages have no dark hero behind the sticky nav. A translucent nav
   over the white page renders as a washed-out grey bar, so render it solid. */
.site-nav { background: var(--hero-1); -webkit-backdrop-filter: none; backdrop-filter: none; }

.app-main { padding: clamp(28px, 5vw, 60px) 0; min-height: 62vh; }
.app-main > .container > :first-child { margin-top: 0; }

.app-main h1 { font-size: clamp(1.55rem, 3vw, 2.1rem); margin: 0 0 .7rem; }
.app-main h2 { font-size: 1.35rem; margin: 1.9rem 0 .7rem; }
.app-main h3 { margin: 1.4rem 0 .5rem; }

/* ---- Tables ------------------------------------------------------------- */
.app-main table { width: 100%; border-collapse: collapse; margin: 0 0 1.6rem; font-size: .95rem; }
.app-main th, .app-main td {
  padding: 9px 12px; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.app-main thead th {
  font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); border-bottom: 2px solid var(--border); white-space: nowrap;
}
.app-main tbody tr:hover { background: var(--surface-alt); }

/* ---- Forms -------------------------------------------------------------- */
.app-main fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px 20px 20px; margin: 0 0 1.6rem; }
.app-main legend { padding: 0 8px; font-weight: 700; color: var(--ink); font-size: 1.05rem; }
.app-main .form-group { margin-bottom: 14px; }
.app-main label { display: inline-block; font-weight: 600; color: var(--ink); margin: 0 8px 4px 0; }
.app-main input[type=text],
.app-main input[type=password],
.app-main input[type=number],
.app-main input[type=email],
.app-main input[type=search],
.app-main select,
.app-main .form-control {
  font: inherit; color: var(--ink); background: #fff;
  padding: 8px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  max-width: 100%;
}
.app-main input:focus, .app-main select:focus, .app-main .form-control:focus {
  outline: 3px solid var(--accent-bright); outline-offset: 1px; border-color: var(--accent);
}

/* ---- Buttons: the .btn pill base comes from site-new.css; these only add the
   colours for the Bootstrap-style variants the views use (.btn-primary etc.),
   plus class-less submit inputs (e.g. the login form). -------------------- */
.app-main input[type=submit]:not(.btn) {
  display: inline-block; font: inherit; font-weight: 700; line-height: 1.25;
  cursor: pointer; padding: .55em 1.3em; border-radius: 999px;
  border: 1.5px solid transparent; background: var(--accent); color: #fff;
  text-decoration: none; transition: background-color .15s ease;
}
.app-main input[type=submit]:not(.btn):hover { background: var(--accent-strong); color: #fff; }
.app-main .btn-primary { background: var(--accent); color: #fff; }
.app-main .btn-primary:hover { background: var(--accent-strong); color: #fff; }
.app-main .btn-warning { background: #e0962f; color: #fff; }
.app-main .btn-warning:hover { background: #c9831f; color: #fff; }
.app-main .btn-light { background: #fff; color: var(--ink); border-color: var(--border); }
.app-main .btn-light:hover { background: var(--surface-alt); color: var(--ink); }
.app-main .btn-danger { background: #d64545; color: #fff; }
.app-main .btn-danger:hover { background: #b93a3a; color: #fff; }
.app-main form.button_to { display: inline; margin: 0; }

/* ---- Alerts (flash + Bootstrap-style) ----------------------------------- */
.app-main .alert { padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid transparent; margin: 0 0 1.4rem; }
.app-main .alert-success { background: #e7f6ec; border-color: #b7e3c5; color: #185c32; }
.app-main .alert-danger  { background: #fdebeb; border-color: #f2c2c2; color: #8c2222; }

/* ---- Misc --------------------------------------------------------------- */
.app-main code { background: var(--surface-alt); padding: 2px 6px; border-radius: 6px; font-size: .9em; color: var(--ink); }
.app-main hr { border: 0; border-top: 1px solid var(--border); margin: 1.6rem 0; }
.app-main .chart { margin: 0 0 1.6rem; }

/* Pages that hand server data to JS put it in a hidden #init-data element
   (the admin dashboard charts, the store order/subscription pages, etc.). */
#init-data { display: none; }
.hide { display: none !important; }   /* utility: must win over component display (e.g. .spinner-border) */
.invisible { visibility: hidden; }
.clear { clear: both; }

/* ---- Store / order pages ------------------------------------------------ */
.app-main .alert-info { background: #e8f1fb; border-color: #bcd7f5; color: #1a4a73; }
.app-main .btn-secondary { background: #fff; color: var(--ink); border-color: var(--border); }
.app-main .btn-secondary:hover { background: var(--surface-alt); color: var(--ink); }
.app-main .text-danger { color: #c0392b; }
.app-main .is-invalid { border-color: #d64545 !important; }
.modal.modal--wide { max-width: 680px; }
.order-notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin: 0 0 28px; }
.order-notes .alert { margin: 0; }
.spinner-border {
  display: inline-block; width: 1.3rem; height: 1.3rem; vertical-align: -.25em;
  border: 3px solid var(--accent); border-right-color: transparent;
  border-radius: 50%; animation: btn-spin .7s linear infinite;
}
/* The order form uses float-based rows (order_desktop.css); contain them so the
   modal footer buttons sit below the form, not floated up beside it. */
.app-main .modal__body { display: flow-root; }
/* Lay out each form row (label beside field) as a flex row, with the label
   baseline-aligned to the field text. Overrides the float-based row layout. */
.app-main .control-group { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.app-main .control-group > label { flex: 0 0 130px; margin: 0; }
.app-main .control-group .form-control { flex: 1 1 auto; min-width: 0; margin: 0; }
.app-main .control-group select.form-control { flex: 0 0 auto; }
/* Checkbox + label on one line (override the global float/clear/width label rule). */
.app-main .form-check { display: flex; align-items: center; gap: 7px; }
.app-main .form-check-input { float: none; margin: 0; }
.app-main .form-check-label { float: none; clear: none; width: auto; margin: 0; }
