/* ═══════════════════════════════════════════════════════════════════════════
   modals.css — one standard for every modal (popup) on TrackPredict
   Loaded from modals.html, which nav.html includes on every page.

   Standard = approved Membership card style (same as the Compare panels and
   the Stable Alert popup): navy gradient, 1px blue-grey frame, 14px corners,
   soft shadow, white shine on the bottom edge.

   Selectors start with "body .modal-overlay" on purpose: that out-ranks the
   older modal rules in base.css, nav.css and page <style> blocks, so those
   files do not need editing.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── 1. Shell ───────────────────────────────────────────────────────────── */
/* The white shine is a background layer (not a pseudo-element), so it stays on
   the bottom edge even when a tall modal scrolls. */
body .modal-overlay .modal {
  background:
    radial-gradient(ellipse 13% 14% at 50% 50%,
      rgba(217,226,238,.92) 0%, rgba(217,226,238,.35) 38%, transparent 100%)
      50% calc(100% + 6px) / 76% 12px no-repeat,
    radial-gradient(ellipse 35% 50% at 50% 50%,
      rgba(217,226,238,.38) 0%, rgba(217,226,238,.15) 35%, transparent 100%)
      50% calc(100% + 6px) / 76% 12px no-repeat,
    var(--tp-membership-card-bg, linear-gradient(180deg, #0D1E33 0%, #192C47 66%, #263A59 100%)) !important;
  color: #D9E2EE !important;
  border: 1px solid rgba(122,155,181,.72) !important;
  border-radius: 14px !important;
  box-shadow: 0 16px 38px rgba(7,18,31,.38), 0 28px 85px rgba(0,0,0,.45) !important;
  font-family: 'Oxanium', Arial, sans-serif;
}

/* Old bottom-edge lines (gold fade in base.css, blue glow in nav.css, gold
   fade in compare.html) are replaced by the shine above. */
body .modal-overlay .modal::before,
body .modal-overlay .modal::after {
  content: none !important;
  display: none !important;
}

/* ── 2. Header, title, close ────────────────────────────────────────────── */
body .modal-overlay .modal-title {
  color: #D9E2EE !important;
  font-family: 'Oxanium', Arial, sans-serif;
}
body .modal-overlay .modal-close {
  color: #7A9BB5 !important;
}
body .modal-overlay .modal-close:hover {
  color: #FFFFFF !important;
}

/* ── 3. Body ────────────────────────────────────────────────────────────── */
body .modal-overlay .modal-body {
  background: transparent !important;
  color: #D9E2EE !important;
}

/* ── 4. Footer bar (Prev / Next / Close / Cancel rows) ──────────────────── */
body .modal-overlay .modal-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 26px;
  border-top: 1px solid #315A80;
  background: rgba(7,18,31,.38);
}
body .modal-overlay .modal-footer--end {
  justify-content: flex-end;
}
/* Footer bars in other templates still carry the old inline colours
   (background:var(--cream); border-top var(--sand)). Bring them into line. */
body .modal-overlay .modal > div[style*="background:var(--cream)"] {
  background: rgba(7,18,31,.38) !important;
  border-top-color: #315A80 !important;
}

/* ── 5. Old inline box colours inside any modal ─────────────────────────── */
/* Catches boxes written as style="background:#0D1B2A" etc. in templates and
   in HTML built by the JS files. */
body .modal-overlay .modal [style*="background:#0D1B2A"],
body .modal-overlay .modal [style*="background:#1A2B3C"],
body .modal-overlay .modal [style*="background:#1a2736"] {
  background: #0D1E33 !important;
}
body .modal-overlay .modal [style*="background:#1E2F42"],
body .modal-overlay .modal [style*="background:#243547"],
body .modal-overlay .modal [style*="background:var(--paper)"] {
  background: #193752 !important;
}

/* ── 6. Labels and inputs ───────────────────────────────────────────────── */
body .modal-overlay .modal-label {
  color: #7A9BB5 !important;
}
body .modal-overlay .modal-input {
  background: #0D1E33 !important;
  border: 1px solid #315A80 !important;
  color: #D9E2EE !important;
  font-family: 'Oxanium', Arial, sans-serif;
}
body .modal-overlay .modal-input option {
  background: #0D1E33 !important;
  color: #D9E2EE !important;
}
body .modal-overlay .modal input:focus,
body .modal-overlay .modal textarea:focus,
body .modal-overlay .modal select:focus,
body .modal-overlay .modal-input:focus {
  border-color: #7A9BB5 !important;
  box-shadow: 0 0 0 2px rgba(122,155,181,.18);
}

/* ── 7. Buttons inside modals ───────────────────────────────────────────── */
/* Text colours are left alone, so gold / danger buttons keep their meaning. */
body .modal-overlay .modal .btn {
  background: #0D1E33;
  border: 1px solid #315A80 !important;
  box-shadow: none !important;
}
body .modal-overlay .modal .btn::before {
  content: none !important;
  display: none !important;
}
body .modal-overlay .modal .btn:hover {
  background: #263A59;
  border-color: #7A9BB5 !important;
}
body .modal-overlay .modal .btn-outline:hover {
  color: #FFFFFF;
}
body .modal-overlay .modal .btn-danger {
  border-color: rgba(224,92,92,.5) !important;
}
body .modal-overlay .modal .btn-danger:hover {
  background: rgba(224,92,92,.14);
  border-color: rgba(224,92,92,.8) !important;
}

/* ── 8. Tables inside modals ────────────────────────────────────────────── */
body .modal-overlay .modal thead tr {
  background: #193752;
}
body .modal-overlay .modal th {
  color: #7A9BB5;
}
body .modal-overlay .modal td {
  border-bottom-color: rgba(122,155,181,.2);
}
body .modal-overlay .modal tbody tr:hover {
  background: rgba(49,90,128,.22);
}
body .modal-overlay #profile-race-table tbody tr:nth-child(even),
body .modal-overlay #jp-race-table tbody tr:nth-child(even) {
  background: rgba(49,90,128,.12);
}
body .modal-overlay #profile-race-table tbody tr:hover,
body .modal-overlay #jp-race-table tbody tr:hover {
  background: rgba(49,90,128,.22);
}
body .modal-overlay #profile-race-table tbody td,
body .modal-overlay #jp-race-table tbody td {
  border-bottom-color: rgba(122,155,181,.2);
}


/* ═══════════════════════════════════════════════════════════════════════════
   Individual modals (moved here from the <style> blocks in modals.html)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Stable Racing Alert ────────────────────────────────────────────────── */
/* Shell colours, border, corners and shadow come from section 1. */
#modal-stable-alerts .modal {
  width: 1060px; max-width: 95vw; max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
  padding: 0;
}
#modal-stable-alerts .modal-header {
  position: relative; display: block; flex: 0 0 auto;
  width: 100%; height: auto; min-height: 0;
  box-sizing: border-box; margin: 0; padding: 0;
  border: 0; border-radius: 0; background: transparent;
  line-height: 0;
}
#modal-stable-alerts .stable-alerts-header-image {
  display: block; width: 100%; height: auto; max-width: none;
  margin: 0; padding: 0; border: 0;
}
/* The header image already contains the white X. This invisible button makes
   that exact X clickable without drawing a second one. */
#modal-stable-alerts .modal-close {
  position: absolute; top: 0; right: 0; z-index: 2;
  display: block; width: 5%; height: 44%;
  min-width: 32px; min-height: 32px;
  margin: 0; padding: 0; border: 0; border-radius: 0;
  background: transparent; color: transparent;
  font-size: 0; line-height: 0; cursor: pointer;
  box-shadow: none; opacity: 1;
}
#modal-stable-alerts .modal-close:hover { background: rgba(217,226,238,.08); }
#modal-stable-alerts .modal-close:focus-visible { outline: 2px solid #D9E2EE; outline-offset: -3px; }
#modal-stable-alerts .modal-body { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 26px 22px; }
#modal-stable-alerts .stable-alerts-table-wrap { width: 100%; overflow-x: auto; border: 1px solid #315A80; border-radius: 9px; background: #0D1E33; }
#modal-stable-alerts .stable-alerts-table { width: 100%; border-collapse: collapse; font-family: 'Oxanium', Arial, sans-serif; }
#modal-stable-alerts .stable-alerts-table thead { background: #193752; color: #7A9BB5; }
#modal-stable-alerts .stable-alerts-table th { padding: 13px 12px; text-align: left; font-size: .73rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
#modal-stable-alerts .stable-alerts-table td { padding: 14px 12px; color: #D9E2EE; font-size: .85rem; border-top: 1px solid rgba(122,155,181,.2); }
#modal-stable-alerts .stable-alerts-table tbody tr:nth-child(even) { background: rgba(49,90,128,.12); }
#modal-stable-alerts .stable-alerts-table .stable-horse { font-weight: 800; color: #F3E6C0; }
#modal-stable-alerts .stable-alerts-table .stable-muted { color: #A9BDD0; }
#modal-stable-alerts .stable-alerts-table .stable-center { text-align: center; }
#modal-stable-alerts .stable-alerts-table .stable-right { text-align: right; }
#modal-stable-alerts .stable-alerts-status { display: inline-block; padding: 5px 10px; border-radius: 5px; font-size: .72rem; font-weight: 800; letter-spacing: .04em; white-space: nowrap; border: 1px solid currentColor; }
#modal-stable-alerts .stable-alerts-status.today { color: #F3E6C0; background: rgba(243,230,192,.10); border-color: #7A9BB5; }
#modal-stable-alerts .stable-alerts-status.tomorrow { color: #F3E6C0; background: rgba(243,230,192,.1); }
#modal-stable-alerts .stable-alerts-status.later { color: #79CBA4; background: rgba(74,155,122,.12); }
#modal-stable-alerts .stable-alerts-compare,
#modal-stable-alerts .stable-alerts-close-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 8px 16px; border: 1px solid #315A80; border-radius: 6px; background: #0D1E33; color: #D9E2EE; font: 700 .8rem 'Oxanium', Arial, sans-serif; letter-spacing: .04em; cursor: pointer; white-space: nowrap; }
#modal-stable-alerts .stable-alerts-compare:hover,
#modal-stable-alerts .stable-alerts-close-btn:hover { background: #263A59; border-color: #7A9BB5; }
#modal-stable-alerts .stable-alerts-footer { display: flex; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 26px; border-top: 1px solid #315A80; background: rgba(7,18,31,.38); }
#modal-stable-alerts .stable-alerts-dismiss-label { display: inline-flex; align-items: center; gap: 10px; color: #A9BDD0; font-size: .82rem; cursor: pointer; }
#modal-stable-alerts #stable-alerts-dismiss { width: 17px; height: 17px; accent-color: #7A9BB5; }
@media (max-width: 650px) {
  #modal-stable-alerts .modal-close { top: 5px; right: 5px; width: 28px; height: 28px; font-size: 16px; }
  #modal-stable-alerts .modal-body { padding: 14px; }
  #modal-stable-alerts .stable-alerts-footer { padding: 12px 14px; }
  #modal-stable-alerts .stable-alerts-table { min-width: 780px; }
}

/* ── Account Settings ───────────────────────────────────────────────────── */
/* Layout unchanged. Clubhouse-blue accents switched to the standard palette. */
#modal-account .modal { width: 860px; max-width: 95vw; max-height: 92vh; display: flex; flex-direction: column; }
#modal-account .modal-body { flex: 1; overflow-y: auto; padding-top: 16px; }
#modal-account .acm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
#modal-account .acm-card { background: rgba(7,18,31,.44); border: 1px solid #315A80; border-radius: 10px; padding: 14px 16px; }
#modal-account .acm-title { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: #D9E2EE; margin: 0 0 10px; }
#modal-account .acm-row { display: flex; justify-content: space-between; gap: 12px; font-size: 0.84rem; padding: 4px 0; color: #7A9BB5; }
#modal-account .acm-row strong { color: #FFFFFF; font-weight: 700; text-align: right; }
#modal-account .acm-field { margin: 8px 0; }
#modal-account .acm-field label { display: block; font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; color: #7A9BB5; margin-bottom: 4px; }
#modal-account .acm-field input { width: 100%; box-sizing: border-box; background: #0D1E33; border: 1px solid #315A80; color: #D9E2EE; font-family: 'Oxanium', Arial, sans-serif; font-size: 0.86rem; padding: 7px 10px; outline: none; }
#modal-account .acm-loc { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
#modal-account .acm-btn { background: #0D1E33; border: 1px solid #315A80; border-radius: 6px; color: #D9E2EE; font-family: 'Oxanium', Arial, sans-serif; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; padding: 7px 14px; cursor: pointer; margin-top: 4px; }
#modal-account .acm-btn:hover { background: #263A59; border-color: #7A9BB5; }
#modal-account .acm-btn:disabled { opacity: 0.5; cursor: default; }
#modal-account .acm-btn.red { background: rgba(224,92,92,0.12); border-color: rgba(224,92,92,0.5); color: #F2A0A0; }
#modal-account .acm-btn.red:hover { background: rgba(224,92,92,0.2); border-color: rgba(224,92,92,0.8); }
#modal-account .acm-link { background: none; border: none; color: #A9BDD0; font: inherit; font-size: 0.8rem; padding: 0; cursor: pointer; text-decoration: underline; }
#modal-account .acm-link:hover { color: #FFFFFF; }
#modal-account .acm-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
#modal-account .acm-tab { background: none; border: 1px solid #315A80; border-radius: 6px; color: #7A9BB5; font-family: 'Oxanium', Arial, sans-serif; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; padding: 7px 14px; cursor: pointer; }
#modal-account .acm-tab.active { color: #FFFFFF; border-color: #7A9BB5; background: #193752; }
#modal-account .acm-tab.danger { color: #E05C5C; }
#modal-account .acm-panel { display: none; }
#modal-account .acm-panel.active { display: block; }
#modal-account .acm-pw { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
#modal-account .acm-msg { font-size: 0.82rem; margin: 6px 0; }
#modal-account .acm-msg:empty { display: none; }
#modal-account .acm-msg.ok { color: #8FFFC2; }
#modal-account .acm-msg.err { color: #F18B8B; }
#modal-account .acm-note { font-size: 0.78rem; color: #7A9BB5; line-height: 1.5; margin: 6px 0 8px; }
@media (max-width: 720px) {
  #modal-account .acm-grid, #modal-account .acm-loc, #modal-account .acm-pw { grid-template-columns: 1fr; }
}

/* ── Data Settings (Clubhouse menu) ─────────────────────────────────────── */
#modal-data-settings-nav .modal { width: 460px; max-width: 95vw; }
#modal-data-settings-nav .dsm-field { margin: 4px 0 16px; }
#modal-data-settings-nav .dsm-field label { display: block; font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; color: #7A9BB5; margin-bottom: 6px; }
#modal-data-settings-nav select { width: 100%; box-sizing: border-box; background: #0D1E33; border: 1px solid #315A80; color: #D9E2EE; font-family: 'Oxanium', Arial, sans-serif; font-size: 0.88rem; padding: 8px 10px; outline: none; }
#modal-data-settings-nav .dsm-note { font-size: 0.78rem; color: #7A9BB5; line-height: 1.5; margin: 6px 0 0; }
#modal-data-settings-nav .dsm-msg { font-size: 0.82rem; margin: 6px 0; }
#modal-data-settings-nav .dsm-msg:empty { display: none; }
#modal-data-settings-nav .dsm-msg.ok { color: #8FFFC2; }
#modal-data-settings-nav .dsm-msg.err { color: #F18B8B; }
#modal-data-settings-nav .dsm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
#modal-data-settings-nav .dsm-btn { background: #0D1E33; border: 1px solid #315A80; border-radius: 6px; color: #D9E2EE; font-family: 'Oxanium', Arial, sans-serif; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; padding: 7px 16px; cursor: pointer; }
#modal-data-settings-nav .dsm-btn:hover { background: #263A59; border-color: #7A9BB5; }
#modal-data-settings-nav .dsm-btn.plain { background: none; color: #7A9BB5; }
#modal-data-settings-nav .dsm-btn.plain:hover { background: rgba(49,90,128,.22); color: #D9E2EE; }
#modal-data-settings-nav .dsm-btn:disabled { opacity: 0.5; cursor: default; }
