/* admin-components.css — shared admin components matching admin.freedomclub.com (2026-09-27).
 * Linked AFTER the page's inline styles so it is the single source for these components.
 * Scope: .btn family, .tab-btn tabs, .modal / .modal-content, .card / .stat-card. Uses admin-tokens.css.
 * Rollback: remove the <link>. Inline style="" attributes in modules still win (follow-up migration). */

/* Buttons — FC pill */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary); color: #fff; border: none;
  padding: 10px 24px; border-radius: var(--radius-pill, 999px);
  font-family: inherit; font-weight: 500; font-size: 14px; line-height: 1.3;
  cursor: pointer; transition: all 0.2s ease; width: auto;
}
.btn:hover { opacity: 1; background: var(--primary-light); transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.btn:disabled, .btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-sm { padding: 8px 16px; font-size: 12px; border-radius: var(--radius-pill, 999px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); }
:root.dark .btn, :root.dark .btn-primary { color: #1a1a1a; }
:root.dark .btn-secondary { color: var(--text-primary); }

/* Tabs — FC style: square, 13px, active = heavier weight + 2px underline (no pill/box/shadow) */
.tab-group { display: flex; gap: 4px; align-items: flex-end; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab-group::-webkit-scrollbar { display: none; }
.tab-btn {
  padding: 8px 16px; font-size: 13px; font-weight: 500; font-family: inherit;
  color: #1a1a1a; background: transparent;
  border: none; border-bottom: 2px solid transparent; border-radius: 0;
  margin-bottom: -1px; white-space: nowrap; flex-shrink: 0; cursor: pointer; transition: all 0.15s;
}
.tab-btn:hover { color: #1a1a1a; background: transparent; }
.tab-btn.active { color: #1a1a1a; background: transparent; border-bottom-color: #1a1a1a; font-weight: 600; box-shadow: none; }

/* Modals — FC */
.modal { background: var(--bg-card); border-radius: 12px; padding: 25px; width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
.modal-content { border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }

/* Cards — FC */
.card { border-radius: var(--radius); transition: all 0.3s ease; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; transition: all 0.3s ease; }
.stat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

/* FC breakpoints */
@media (max-width: 1024px) {
  .tab-btn { padding: 8px 14px; }
}
@media (max-width: 768px) {
  .btn { min-height: 44px; padding: 12px 20px; font-size: 14px; }
  .btn-sm { min-height: 44px; padding: 8px 14px; }
  .tab-btn { min-height: 44px; padding: 10px 12px; font-size: 12px; }
  .modal { margin: 8px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); border-radius: 10px; padding: 16px; }
  .modal-content { width: calc(100vw - 16px) !important; max-width: calc(100vw - 16px) !important; margin: 8px auto !important; max-height: calc(100vh - 16px); overflow-y: auto; border-radius: 10px; }
}
@media (max-width: 480px) {
  .tab-btn { padding: 10px 10px; font-size: 12px; }
}

/* Austin msg2067 2026-09-27: tab headers stay black (FC underline for active). Dark mode keeps readable text. */
:root.dark .tab-btn, :root.dark .tab-btn:hover, :root.dark .tab-btn.active { color: #ffffff; }
:root.dark .tab-btn.active { border-bottom-color: #ffffff; }
/* Austin msg2067: all tab headers black incl. Finances sub-tabs (were blue #3A92FF) */
.fin-subtab-btn, .fin-subtab-btn:hover { color: #1a1a1a !important; }
.fin-subtab-btn.active { color: #1a1a1a !important; border-bottom-color: #1a1a1a !important; font-weight: 600 !important; }
:root.dark .fin-subtab-btn, :root.dark .fin-subtab-btn.active { color: #ffffff !important; }
:root.dark .fin-subtab-btn.active { border-bottom-color: #ffffff !important; }

/* FFUI3 item1 (msg2092): no box-shadow on table / row / table-card hover; subtle bg only */
table:hover, table tr:hover, table tbody tr:hover, table tbody tr:hover td,
.table-container:hover, .table-wrapper:hover, .card:has(table):hover, .card:has(.table-container):hover { box-shadow: none !important; }
:root:not(.dark) table tbody tr:hover > td { background-color: #FAFBFC; }
:root.dark table tbody tr:hover > td { background-color: #2e2e2e; }

/* ============================================================
   M2109 item 3 (Austin msg 2109, 2026-09-27): every admin checkbox = FC dash checkbox.
   Source: /home/ubuntu/fc-education/fc-education-dashboard.html
     light  (L1342-1352): 16px, radius 4px, 1.5px #D1D5DB border, #FFF bg, #1A1A1A fill
     dark   (DARKCHECKBOX-20260829, L1387-1430): appearance:none, 1.5px var(--text-muted)
            border, var(--bg-body) bg, checked = var(--text-primary) fill + drawn tick
   Drawn with appearance:none in BOTH themes so the look is identical across browsers and the
   element can carry a ::before hit-area on mobile (native checkboxes cannot).
   Excludes visually-hidden checkboxes that drive toggle switches (inline opacity:0).
   !important on size only: several checkboxes carry inline width/height:14px.
   Rollback: delete this block (or restore admin-components.css.bak-m2109-*).
   ============================================================ */
input[type="checkbox"]:not([style*="opacity:0"]):not([style*="opacity: 0"]) {
  appearance: none;
  -webkit-appearance: none;
  width: 16px !important;
  height: 16px !important;
  min-width: 16px;
  min-height: 16px; /* page mobile rule input{min-height:44px} stretched the box; hit area comes from ::before */
  max-height: 16px;
  margin: 0;
  padding: 0;
  border-radius: 4px;
  border: 1.5px solid #D1D5DB;
  background: #FFFFFF;
  accent-color: #1A1A1A;
  cursor: pointer;
  position: relative;
  vertical-align: middle;
  flex-shrink: 0;
  box-sizing: border-box;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
input[type="checkbox"]:not([style*="opacity:0"]):not([style*="opacity: 0"]):hover:not(:disabled) { border-color: #9CA3AF; }
input[type="checkbox"]:not([style*="opacity:0"]):not([style*="opacity: 0"]):checked,
input[type="checkbox"]:not([style*="opacity:0"]):not([style*="opacity: 0"]):indeterminate {
  background: #1A1A1A;
  border-color: #1A1A1A;
}
input[type="checkbox"]:not([style*="opacity:0"]):not([style*="opacity: 0"]):checked::after {
  content: "";
  position: absolute;
  left: 4.5px; top: 1.5px;
  width: 4px; height: 8px;
  border: solid #FFFFFF;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
input[type="checkbox"]:not([style*="opacity:0"]):not([style*="opacity: 0"]):indeterminate::after {
  content: ""; position: absolute; left: 3px; top: 6px; width: 7px; height: 2px; background: #FFFFFF;
}
input[type="checkbox"]:not([style*="opacity:0"]):not([style*="opacity: 0"]):focus-visible {
  outline: 2px solid #1A1A1A; outline-offset: 2px;
}
input[type="checkbox"]:not([style*="opacity:0"]):not([style*="opacity: 0"]):disabled {
  background: #F3F4F6; border-color: #E5E7EB; cursor: not-allowed; opacity: 0.65;
}
input[type="checkbox"]:not([style*="opacity:0"]):not([style*="opacity: 0"]):disabled:checked {
  background: #9CA3AF; border-color: #9CA3AF;
}
/* Dark theme — mirrors FC DARKCHECKBOX-20260829 exactly (theme vars, WCAG 3.63:1 border) */
:root.dark input[type="checkbox"]:not([style*="opacity:0"]):not([style*="opacity: 0"]) {
  border: 1.5px solid var(--text-muted);
  background: var(--bg-body);
}
:root.dark input[type="checkbox"]:not([style*="opacity:0"]):not([style*="opacity: 0"]):checked,
:root.dark input[type="checkbox"]:not([style*="opacity:0"]):not([style*="opacity: 0"]):indeterminate {
  background: var(--text-primary);
  border-color: var(--text-primary);
}
:root.dark input[type="checkbox"]:not([style*="opacity:0"]):not([style*="opacity: 0"]):checked::after { border-color: var(--bg-body); }
:root.dark input[type="checkbox"]:not([style*="opacity:0"]):not([style*="opacity: 0"]):indeterminate::after { background: var(--bg-body); }
:root.dark input[type="checkbox"]:not([style*="opacity:0"]):not([style*="opacity: 0"]):focus-visible { outline-color: var(--text-primary); }
:root.dark input[type="checkbox"]:not([style*="opacity:0"]):not([style*="opacity: 0"]):disabled {
  background: var(--bg-hover); border-color: var(--border);
}
:root.dark input[type="checkbox"]:not([style*="opacity:0"]):not([style*="opacity: 0"]):disabled:checked {
  background: var(--text-muted); border-color: var(--text-muted);
}

/* Mobile 44px tap targets (desktop layout untouched: everything below is inside the media query).
   Checkbox: invisible ::before hit-area 44x44 centred on the 16px box, so the visual size and the
   row/column layout do not change. Icon-only table links/buttons + icon-only clickable cells get a
   44x44 minimum box. */
@media (max-width: 768px) {
  input[type="checkbox"]:not([style*="opacity:0"]):not([style*="opacity: 0"])::before {
    content: "";
    position: absolute;
    left: 50%; top: 50%;
    width: 44px; height: 44px;
    transform: translate(-50%, -50%);
    border-radius: 8px;
  }
  table td a:has(> svg:only-child),
  table td button:has(> svg:only-child),
  table td a:has(> img:only-child),
  table td button:not(.btn):not(.inv-cat-pill):empty,
  table td .icon-btn,
  table td [role="button"]:has(> svg:only-child) {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    box-sizing: border-box;
  }
  table td[onclick]:has(> svg:only-child) {
    min-width: 44px;
    width: 44px !important;
    height: 44px;
  }
}
/* M2109: toggle-switch inputs (portal .toggle-switch / .switch, hidden via class not inline style) keep their hidden native box. :not(#_) lifts specificity above the checkbox block. */
.toggle-switch input[type="checkbox"]:not(#_), .switch input[type="checkbox"]:not(#_) {
  appearance: auto; -webkit-appearance: auto; opacity: 0; width: 0 !important; height: 0 !important; min-width: 0; border: 0; background: none;
}
.toggle-switch input[type="checkbox"]:not(#_)::before, .toggle-switch input[type="checkbox"]:not(#_)::after,
.switch input[type="checkbox"]:not(#_)::before, .switch input[type="checkbox"]:not(#_)::after { content: none; }
