/* Connextion by MyOrder — dark theme + theme button. Loaded after each page's own <style>.
   theme.js sets html[data-theme="dark" | "light"]; pages keep their light tokens on :root, this file redefines them. */

/* ---------- theme button + menu (both themes) ---------- */
.theme-btn { position: relative; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--hover, #EEF4F8); color: var(--fg, #14202B);
  display: inline-grid; place-items: center; cursor: pointer; flex: 0 0 auto; padding: 0; }
.theme-btn:hover { background: var(--chip, #EAF1F6); }
.theme-btn svg { width: 19px; height: 19px; }
.theme-btn[data-theme-label] { width: auto; height: 36px; border-radius: 9999px; padding: 0 12px; display: inline-flex; gap: 6px; font: inherit; font-size: 13px; font-weight: 700; }
.theme-menu { position: fixed; z-index: 90; min-width: 200px; background: var(--card, #FFFFFF); color: var(--fg, #14202B); border: 1px solid var(--line, #E3EAF0);
  border-radius: 14px; box-shadow: 0 16px 40px rgba(11,53,82,.18); padding: 6px; display: grid; gap: 2px; font-family: "Inter", "Noto Sans Thai", system-ui, sans-serif; }
.theme-menu p { margin: 4px 10px 6px; font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--muted, #5C6B78); }
.theme-menu button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; color: inherit; font: inherit; font-size: 14px;
  padding: 9px 10px; border-radius: 10px; cursor: pointer; text-align: left; }
.theme-menu button:hover, .theme-menu button:focus-visible { background: var(--hover, #EEF4F8); outline: none; }
.theme-menu button[aria-checked="true"] { color: var(--brand, #0E86C2); font-weight: 700; }
.theme-menu svg { width: 18px; height: 18px; flex: 0 0 auto; }
.theme-menu span { flex: 1; display: grid; }
.theme-menu small { font-size: 11.5px; color: var(--muted, #5C6B78); font-weight: 500; }
.theme-menu i { font-style: normal; }

/* ---------- dark palette ---------- */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0D1820; --card: #14222D; --hover: #1B2D3A; --chip: #223747; --pill: #1B2D3A; --pill-hover: #223747;
  --fg: #E6EEF4; --text: #C2CFD9; --muted: #93A6B4; --faint: #64788A; --line: #263A4A;
  --brand: #3BAEE6; --brand-hover: #5CC0EE; --brand-subtle: #12344A; --brand-deep: #CDEFFD;
  --sky: #45BFEC; --sky-hover: #66CCF0; --sky-subtle: #133A4E;
  --hero: linear-gradient(120deg, #0F2433 0%, #123B55 55%, #155E86 100%);
  --c-contribute: #5CC0EE; --c-contribute-bg: #12344A;
  --c-next: #A3A6F6; --c-next-bg: #262A52;
  --c-action: #4FD39A; --c-action-bg: #10392A;
  --ok: #4FD39A; --ok-bg: #10392A; --warn: #F0C350; --warn-bg: #3A2F0E; --bad: #FF7D9C; --bad-bg: #401726;
  --err: #FF7D9C; --err-bg: #401726; --gold: #F0C350; --gold-bg: #3A2F0E;
  --up: #5CC0EE; --down: #A3A6F6; --pin: #F0B35A; --solved: #4FD39A;
  --shadow: 0 1px 3px rgba(0,0,0,.45);
  --side-bg: #101F2A; --side-fg: #CDEFFD; --side-muted: #8FA6B5; --side-hover: rgba(255,255,255,.06); --side-active: rgba(69,191,236,.16); --side-line: rgba(255,255,255,.08);
}
html[data-theme="dark"] body { background: var(--bg); color: var(--fg); }

/* places that use the navy token as a background with white text */
html[data-theme="dark"] .toast { background: #2B4B61; color: #FFFFFF; }
html[data-theme="dark"] .me .role, html[data-theme="dark"] .tier.adm, html[data-theme="dark"] .p-tier.admin { background: #2B4B61; color: #FFFFFF; }
html[data-theme="dark"] .site .btn-primary { background: #2B4B61; }

/* hard-coded light surfaces in the pages */
html[data-theme="dark"] .join .btn, html[data-theme="dark"] .modal-x:hover { background: var(--card); color: var(--fg); }
html[data-theme="dark"] .modal-x, html[data-theme="dark"] .x { background: rgba(0,0,0,.35); color: #FFFFFF; }
html[data-theme="dark"] .pill.del:hover, html[data-theme="dark"] .notfound .big { background: var(--bad-bg); }
html[data-theme="dark"] .ai-box.rejected, html[data-theme="dark"] .mod-rejected { background: var(--bad-bg); color: var(--bad); }
html[data-theme="dark"] .mod-pending, html[data-theme="dark"] .foot-links .mock { background: var(--warn-bg); color: var(--warn); }
html[data-theme="dark"] .demo { background: #2A2512; border-color: #6B5A1E; color: #F0DCA0; }
html[data-theme="dark"] .cell.out { background: #0F1C25; }
html[data-theme="dark"] .pillars span, html[data-theme="dark"] .head a { background: rgba(255,255,255,.08); color: var(--brand-deep); }
html[data-theme="dark"] .tier.gold { background: #3A2F0E; border-color: #6B5A1E; }
html[data-theme="dark"] .tier.silver { background: #1F2A33; border-color: #3A4A57; }
html[data-theme="dark"] .tier.bronze { background: #33231A; border-color: #5E4130; }
html[data-theme="dark"] .founder-card { background: linear-gradient(90deg, #3A2F0E, #4A3A10); color: #F0DCA0; }
html[data-theme="dark"] .founder-card b { color: #F5D27A; }
html[data-theme="dark"] .st.rejected { background: #3A1A26; color: #FF9DB5; }
html[data-theme="dark"] .b-bad:hover { background: #57203A; }
html[data-theme="dark"] .att-img, html[data-theme="dark"] .att.grid.n1 .att-img img { background: #0F1C25; }
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea { color: var(--fg); }
html[data-theme="dark"] input::placeholder, html[data-theme="dark"] textarea::placeholder { color: var(--faint, #64788A); }
html[data-theme="dark"] img[src$="myorder-logo.png"] { filter: brightness(0) invert(1); }

/* login: white card + photo hero */
html[data-theme="dark"] .card, html[data-theme="dark"] .field input, html[data-theme="dark"] .pill-logo { background: var(--card); }
html[data-theme="dark"] .hero { background-color: #0D1820; }
html[data-theme="dark"] .hero::after { content: ""; position: absolute; inset: 0; background: rgba(5,12,18,.55); pointer-events: none; }
html[data-theme="dark"] .hero > * { position: relative; z-index: 1; }
html[data-theme="dark"] .demo, html[data-theme="dark"] aside.demo { background: rgba(20,34,45,.95); color: var(--text); }

/* rewards banner bits drawn in white on blue stay white */
html[data-theme="dark"] .rw .tag { background: rgba(13,24,32,.85); color: var(--brand-deep); }

/* notification panel (notify.js uses fixed light colours) */
html[data-theme="dark"] .nb-panel, html[data-theme="dark"] .nb-head { background: var(--card); color: var(--fg); border-color: var(--line); }
html[data-theme="dark"] .nb-head button { background: var(--hover); color: var(--fg); }
html[data-theme="dark"] .nb-item { border-color: var(--line); }
html[data-theme="dark"] .nb-item:hover { background: var(--hover); }
html[data-theme="dark"] .nb-item.unread { background: var(--brand-subtle); }
html[data-theme="dark"] .nb-item small, html[data-theme="dark"] .nb-empty, html[data-theme="dark"] .nb-desk small { color: var(--muted); }
html[data-theme="dark"] .nb-desk { background: var(--hover); border-color: var(--line); }
html[data-theme="dark"] .nb-count { border-color: var(--card); }
html[data-theme="dark"] .theme-menu { box-shadow: 0 16px 40px rgba(0,0,0,.5); }

/* more hard-coded light surfaces */
html[data-theme="dark"] .reward-card { background: linear-gradient(180deg, #16303F 0%, var(--card) 70%); }
html[data-theme="dark"] .tier.founder-pill, html[data-theme="dark"] #b-founder { background: linear-gradient(90deg, #3A2F0E, #4A3A10); color: #F5D27A; }

/* theme choice inside a menu (index profile menu) */
[data-theme-seg] { border-top: 1px solid var(--line, #E3EAF0); margin-top: 6px; padding: 10px 6px 4px; display: grid; gap: 8px; }
[data-theme-seg] .seg-label { font-size: 12px; font-weight: 700; color: var(--muted, #5C6B78); padding: 0 4px; }
[data-theme-seg] .seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--hover, #EEF4F8); border-radius: 10px; padding: 3px; }
[data-theme-seg] .seg button { display: grid !important; justify-items: center; gap: 2px !important; padding: 7px 4px !important; border: 0; border-radius: 8px !important;
  background: transparent; color: var(--muted, #5C6B78); font: inherit; font-size: 12px !important; font-weight: 600; cursor: pointer; text-align: center !important; }
[data-theme-seg] .seg button svg { width: 17px; height: 17px; }
[data-theme-seg] .seg button[aria-checked="true"] { background: var(--card, #FFFFFF); color: var(--brand, #0E86C2); box-shadow: 0 1px 3px rgba(11,53,82,.15); }
[data-theme-seg] .seg button:hover { color: var(--fg, #14202B); }
