/* ---------- OMS admin area: sign-in card ---------- */

:root {
  --oms-navy: #1f3a5f;
  --oms-teal: #2b7a78;
  --oms-gold: #d89b3c;
  --oms-text: #26313d;
  --oms-muted: #6c7680;
}

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

body {
  font-family: "Inter", Calibri, Arial, sans-serif;
  color: var(--oms-text);
  background: linear-gradient(180deg, #ffffff 0%, #f3f7f7 45%, #eef4f3 100%);
}

/* ----- sign-in card (unauthenticated) ----- */

.admin-login-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  box-sizing: border-box;
}

.admin-card {
  width: 100%;
  max-width: 380px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(31, 58, 95, 0.10);
  padding: 2rem 2.25rem 2.25rem;
}

.admin-card h1 {
  font-family: "Lora", Georgia, "Times New Roman", serif;
  font-size: 1.5rem;
  color: var(--oms-navy);
  margin: 0 0 1.25rem;
}

.admin-note {
  color: var(--oms-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.admin-email-echo {
  font-weight: 600;
  color: var(--oms-navy);
  margin: 0 0 1rem;
}

.admin-error {
  background: rgba(200, 16, 46, 0.08);
  color: #a3122f;
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
  margin: 0 0 1.25rem;
}

.admin-field {
  display: block;
  font-size: 0.9rem;
  color: var(--oms-muted);
  margin-bottom: 1.25rem;
}

.admin-field input {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.6rem 0.75rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--oms-text);
  border: 1px solid rgba(31, 58, 95, 0.2);
  border-radius: 8px;
  box-sizing: border-box;
}

.admin-field input:focus {
  outline: none;
  border-color: var(--oms-teal);
  box-shadow: 0 0 0 3px rgba(43, 122, 120, 0.15);
}

/* "Keep me logged in" on the sign-in form -- a checkbox next to its own
   label text, not a full-width text field, so this can't just rely on the
   plain ".admin-field input" rule above: that rule's selector has a class
   plus an element, which beats a single ".admin-field--checkbox" class on
   its own, so the override below matches its specificity with a second
   class and an attribute selector rather than losing to it. */
.admin-field--checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.admin-field--checkbox input[type="checkbox"] {
  display: inline-block;
  width: auto;
  margin-top: 0;
  padding: 0;
  border: none;
  box-sizing: content-box;
  accent-color: var(--oms-teal);
  cursor: pointer;
}

.admin-button {
  width: 100%;
  padding: 0.7rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  color: #ffffff;
  background: var(--oms-navy);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.admin-button:hover {
  background: #16283f;
}

.admin-button--secondary {
  background: var(--oms-muted);
}

.admin-button--secondary:hover {
  background: #565f68;
}

.admin-button--danger {
  background: #a3122f;
}

.admin-button--danger:hover {
  background: #7e0e24;
}

/* ----- authenticated admin app: topbar + right-hand nav ----- */

.admin-app {
  min-height: 100vh;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: #ffffff;
  box-shadow: 0 2px 10px rgba(31, 58, 95, 0.08);
}

.admin-topbar-title {
  font-family: "Lora", Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
  color: var(--oms-navy);
  margin: 0;
}

.admin-topbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-logout-form {
  margin: 0;
}

.admin-logout-button {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--oms-navy);
  background: transparent;
  border: 1px solid rgba(31, 58, 95, 0.25);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.admin-logout-button:hover {
  background: rgba(31, 58, 95, 0.06);
  border-color: var(--oms-navy);
}

.admin-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid rgba(31, 58, 95, 0.25);
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
}

.admin-menu-toggle span {
  display: block;
  height: 2px;
  margin: 0 auto;
  width: 20px;
  background: var(--oms-navy);
  border-radius: 2px;
}

.admin-layout {
  display: flex;
  align-items: flex-start;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  gap: 2rem;
}

.admin-main {
  flex: 1 1 auto;
  min-width: 0;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(31, 58, 95, 0.10);
  padding: 2rem 2.25rem 2.25rem;
}

.admin-panel {
  display: none;
}

.admin-panel.active {
  display: block;
}

.admin-panel h2 {
  font-family: "Lora", Georgia, "Times New Roman", serif;
  font-size: 1.4rem;
  color: var(--oms-navy);
  margin: 0 0 1rem;
}

.admin-side-nav {
  flex: 0 0 200px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(31, 58, 95, 0.10);
  padding: 1rem;
}

.admin-nav-item {
  text-align: left;
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 600;
  color: var(--oms-text);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.admin-nav-item:hover {
  background: rgba(31, 58, 95, 0.06);
}

.admin-nav-item.active {
  background: var(--oms-navy);
  color: #ffffff;
}

.admin-nav-scrim {
  display: none;
}

/* ----- edit texts: tabbed form ----- */

.admin-success {
  background: rgba(43, 122, 120, 0.10);
  color: var(--oms-teal);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
  margin: 0 0 1.25rem;
}

.text-editor-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.text-editor-tab {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 600;
  color: var(--oms-text);
  background: transparent;
  border: 1px solid rgba(31, 58, 95, 0.2);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.text-editor-tab:hover {
  border-color: var(--oms-teal);
}

.text-editor-tab.active {
  background: var(--oms-navy);
  border-color: var(--oms-navy);
  color: #ffffff;
}

.text-editor-panel {
  display: none;
}

.text-editor-panel.active {
  display: block;
}

.admin-field-group {
  margin-bottom: 1.25rem;
}

.admin-field-group-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--oms-text);
  margin-bottom: 0.4rem;
}

.admin-field-group-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-field--inline {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0;
}

.admin-field-inline-label {
  flex: 0 0 auto;
  min-width: 2rem;
  font-size: 0.9rem;
  color: var(--oms-muted);
}

.admin-field-inline-flag svg {
  display: block;
  width: 28px;
  height: auto;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(31, 58, 95, 0.15);
}

.admin-field--inline input,
.admin-field--inline textarea {
  width: auto;
  flex: 1 1 auto;
  margin-top: 0;
}

.admin-field--inline-textarea {
  align-items: flex-start;
}

.wysiwyg-field {
  flex: 1 1 auto;
  min-width: 0;
  /* The "applet" frame -- toolbar and text area sit inside one bordered,
     tinted shell instead of floating loose against the page background. */
  border: 1px solid var(--oms-teal);
  border-radius: 10px;
  background: rgba(43, 122, 120, 0.1);
  padding: 0.5rem;
  box-sizing: border-box;
}

.wysiwyg-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  /* Horizontal spacing between buttons comes from each button's own
     margin-right (below) rather than the toolbar's gap -- gap reserves
     its space even around a button collapsed to zero width, which would
     leave a visible dead gap once the raw-mode "P" button (admin.js)
     finishes animating away. row-gap alone still keeps rows apart when
     the bar wraps on narrow screens. */
  row-gap: 0.35rem;
  margin-bottom: 0.4rem;
}

.wysiwyg-btn {
  min-width: 2rem;
  margin-right: 0.35rem;
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--oms-text);
  background: #ffffff;
  border: 1px solid rgba(31, 58, 95, 0.2);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.wysiwyg-btn:hover {
  background: rgba(31, 58, 95, 0.06);
  border-color: var(--oms-teal);
}

.wysiwyg-btn.active {
  background: var(--oms-navy);
  border-color: var(--oms-navy);
  color: #ffffff;
}

/* Raw-mode-only "Paragraph" button -- built and animated in by admin.js
   the moment a field switches to raw mode (and torn down when it switches
   back), rather than living in the markup permanently disabled. Collapsing
   its width/margin (instead of display:none) is what makes the buttons
   after it visibly slide over to open up or close the gap.
   The two rules below deliberately stagger width and opacity with
   transition-delay so the two states animate in opposite orders:
   appearing slides the gap open first, then fades the button in; the
   .wysiwyg-btn--collapsed rule fades it out first, then slides the gap
   shut, per admin.js's showParagraphButton/hideParagraphButton. */
.wysiwyg-btn--paragraph {
  width: 2rem;
  min-width: 2rem;
  opacity: 1;
  overflow: hidden;
  white-space: nowrap;
  transition: width 0.22s ease, min-width 0.22s ease, margin-right 0.22s ease,
    padding-left 0.22s ease, padding-right 0.22s ease, opacity 0.18s ease 0.22s;
}

.wysiwyg-btn--paragraph.wysiwyg-btn--collapsed {
  width: 0;
  min-width: 0;
  margin-right: 0;
  padding-left: 0;
  padding-right: 0;
  opacity: 0;
  transition: opacity 0.18s ease, width 0.22s ease 0.18s, min-width 0.22s ease 0.18s,
    margin-right 0.22s ease 0.18s, padding-left 0.22s ease 0.18s, padding-right 0.22s ease 0.18s;
}

/* Small pill switch, one per field, toggling that field between the
   formatted editor and raw BBCode text -- pushed to the toolbar's far
   right via margin-left: auto. */
.wysiwyg-mode-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
  padding-left: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--oms-text);
  cursor: pointer;
  user-select: none;
}

.wysiwyg-mode-checkbox {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.wysiwyg-mode-track {
  position: relative;
  flex: none;
  width: 34px;
  height: 20px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(31, 58, 95, 0.25);
  border-radius: 999px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.wysiwyg-mode-thumb {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(31, 58, 95, 0.35);
  transition: transform 0.15s ease;
}

.wysiwyg-mode-checkbox:checked ~ .wysiwyg-mode-track {
  background: var(--oms-navy);
  border-color: var(--oms-navy);
}

.wysiwyg-mode-checkbox:checked ~ .wysiwyg-mode-track .wysiwyg-mode-thumb {
  transform: translateX(14px);
}

.wysiwyg-mode-checkbox:focus-visible ~ .wysiwyg-mode-track {
  outline: 2px solid var(--oms-teal);
  outline-offset: 2px;
}

.wysiwyg-editor,
.wysiwyg-raw {
  min-height: 140px;
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--oms-text);
  background: #ffffff;
  border: 1px solid rgba(31, 58, 95, 0.2);
  border-radius: 8px;
  box-sizing: border-box;
  overflow-y: auto;
}

.wysiwyg-editor:focus,
.wysiwyg-raw:focus {
  outline: none;
  border-color: var(--oms-teal);
  box-shadow: 0 0 0 3px rgba(43, 122, 120, 0.15);
}

.wysiwyg-raw {
  font-family: "Consolas", "SFMono-Regular", Menlo, monospace;
  font-size: 0.9rem;
  resize: vertical;
}

/* Which of the editor/textarea pair is shown is driven entirely by this
   one modifier class on their shared .wysiwyg-field container (added and
   removed by admin.js) -- a single switch to check, rather than two
   separate elements whose own visibility states have to be kept in sync
   with each other.
   ".wysiwyg-field .wysiwyg-raw" (not just ".wysiwyg-raw") is deliberate:
   the raw textarea also sits inside an .admin-field wrapper, and the much
   older ".admin-field textarea { display: block; }" rule further down
   this file (written for the plain contact-form textareas) has one class
   plus one element in its selector -- higher specificity than a single
   ".wysiwyg-raw" class alone, so a plain ".wysiwyg-raw { display: none }"
   here loses to it and the raw box stays visible no matter what. Matching
   its specificity with a second class is what actually wins. */
.wysiwyg-field .wysiwyg-raw {
  display: none;
}

.wysiwyg-field--raw .wysiwyg-editor {
  display: none;
}

.wysiwyg-field--raw .wysiwyg-raw {
  display: block;
}

.wysiwyg-editor p {
  margin: 0 0 0.75rem;
}

.wysiwyg-editor p:last-child {
  margin-bottom: 0;
}

.wysiwyg-editor ul {
  margin: 0 0 0.75rem 1.25rem;
  padding: 0;
}

.wysiwyg-editor h1,
.wysiwyg-editor h2,
.wysiwyg-editor h3 {
  margin: 0 0 0.5rem;
  line-height: 1.25;
  font-weight: 600;
}

.wysiwyg-editor h1 {
  font-size: 1.5rem;
}

.wysiwyg-editor h2 {
  font-size: 1.25rem;
}

.wysiwyg-editor h3 {
  font-size: 1.1rem;
}

.wysiwyg-editor a {
  color: var(--oms-teal);
}

/* ----- manage slideshow ----- */

.hero-slide-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.hero-slide-card {
  border: 1px solid rgba(31, 58, 95, 0.15);
  border-radius: 10px;
  padding: 0.85rem;
  background: #fbfcfc;
  /* Grid items default to min-width: auto, so without this a card's
     content (the caption inputs) refuses to shrink below its own
     intrinsic width and forces the grid track -- and the card -- to
     overflow sideways instead of fitting the column. */
  min-width: 0;
}

.hero-slide-card.dragging {
  opacity: 0.4;
}

.hero-slide-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  /* Bleeds out to the card's own edges/corners rather than sitting
     inset with the card's padding. */
  margin: -0.85rem -0.85rem 0.75rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--oms-muted);
  background: rgba(31, 58, 95, 0.05);
  border-radius: 10px 10px 0 0;
  cursor: grab;
  user-select: none;
}

.hero-slide-drag-handle:active {
  cursor: grabbing;
}

.hero-slide-drag-handle svg {
  width: 16px;
  height: 16px;
  flex: none;
}

/* Two columns only once there's comfortably enough room for them --
   this is deliberately separate from the 768px nav/hamburger
   breakpoint above, which is about the side nav, not this grid. */
@media (max-width: 1024px) {
  .hero-slide-list {
    grid-template-columns: 1fr;
  }
}

.hero-slide-thumb-wrap {
  position: relative;
  margin-bottom: 0.75rem;
}

.hero-slide-thumb {
  display: block;
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 6px;
  background: rgba(31, 58, 95, 0.06);
}

.hero-slide-caption-form .admin-field--inline,
.hero-slide-upload-form .admin-field--inline {
  margin-bottom: 0.6rem;
}

.hero-slide-card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.hero-slide-card-actions .admin-button {
  width: auto;
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
}

/* Overlaps the top-right corner of the slide thumbnail rather than
   sitting in the card's normal flow. */
.hero-slide-delete-form {
  position: absolute;
  top: -10px;
  right: -10px;
  margin: 0;
}

.hero-slide-delete-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: #a3122f;
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(31, 58, 95, 0.35);
  transition: background 0.15s ease;
}

.hero-slide-delete-button:hover {
  background: #7e0e24;
}

.hero-slide-delete-button svg {
  width: 15px;
  height: 15px;
  display: block;
}

/* Sits above the slide grid; empty and invisible until a drag reorders
   the slides, then reports the background auto-save as it happens. */
.hero-slide-order-status {
  display: block;
  min-height: 1.1em;
  margin: -0.5rem 0 0.75rem;
  font-size: 0.85rem;
  color: var(--oms-muted);
}

.hero-slide-upload-heading {
    font-family: "Lora", Georgia, "Times New Roman", serif;
    font-size: 1.1rem;
    color: var(--oms-navy);
    margin: 0 0 1rem;
    margin-top: 1em;
}

.hero-slide-dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  padding: 1.75rem 1rem;
  text-align: center;
  border: 2px dashed rgba(31, 58, 95, 0.25);
  border-radius: 12px;
  background: rgba(31, 58, 95, 0.03);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.hero-slide-dropzone:hover,
.hero-slide-dropzone.dragover {
  border-color: var(--oms-teal);
  background: rgba(43, 122, 120, 0.06);
}

.hero-slide-dropzone-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.hero-slide-dropzone-icon {
  width: 28px;
  height: 28px;
  color: var(--oms-teal);
}

.hero-slide-dropzone-text {
  font-size: 0.9rem;
  color: var(--oms-muted);
}

.hero-slide-dropzone-text strong {
  color: var(--oms-navy);
}

.hero-slide-dropzone-filename {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--oms-navy);
  word-break: break-all;
}

.hero-slide-upload-form {

}

.hero-slide-upload-form .admin-button {
  margin-top: 1em;
}

.admin-field textarea {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.6rem 0.75rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--oms-text);
  border: 1px solid rgba(31, 58, 95, 0.2);
  border-radius: 8px;
  box-sizing: border-box;
  resize: vertical;
}

.admin-field textarea:focus {
  outline: none;
  border-color: var(--oms-teal);
  box-shadow: 0 0 0 3px rgba(43, 122, 120, 0.15);
}

@media (max-width: 768px) {
  .admin-menu-toggle {
    display: flex;
  }

  .admin-layout {
    padding: 1.5rem 1.25rem 2rem;
  }

  .admin-side-nav {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 240px;
    flex: none;
    border-radius: 0;
    box-shadow: -6px 0 24px rgba(31, 58, 95, 0.18);
    padding: 4.5rem 1rem 1.5rem;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 30;
  }

  .admin-side-nav.open {
    transform: translateX(0);
  }

  .admin-nav-scrim.open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 32, 51, 0.35);
    z-index: 20;
  }
}
