/* -----------------------------------------------------------------------
   admin-tables.css
   Shared styles for admin data-table pages (toolbar, table, pagination).
   Page-specific layout and domain styles (e.g. .admit-hca) stay inline.
   ----------------------------------------------------------------------- */

/* --- toolbar ---------------------------------------------------------- */
.fm-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.fm-cache-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0;
}
.fm-toolbar label,
.fm-cache-controls label {
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
}
.fm-toolbar input[type=date] {
    border: 1px solid #9e9e9e;
    border-radius: 2px;
    padding: 5px 8px;
    font-size: 0.875rem;
    width: 140px !important;
    box-sizing: border-box;
}
.fm-toolbar select,
.fm-cache-controls select,
.fm-native-select {
    display: inline-block !important;
    width: auto !important;
    min-width: 60px;
    max-width: 120px;
    border: 1px solid #9e9e9e;
    border-radius: 2px;
    padding: 4px 6px;
    font-size: 0.875rem;
    background: var(--hca-card-bg) !important;
    color: var(--hca-text) !important;
    height: auto !important;
    opacity: 1 !important;
    position: static !important;
    pointer-events: auto !important;
    box-sizing: border-box;
}
.fm-badge {
    font-size: 0.75rem;
    color: var(--hca-report-header-text);
    margin-left: auto;
}
.fm-cache-badge {
    font-size: 0.75rem;
    color: var(--hca-report-header-text);
    padding: 2px 8px;
    border: 1px solid var(--hca-divider);
    border-radius: 12px;
    background: var(--hca-card-bg);
    white-space: nowrap;
}
.fm-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--hca-card-bg);
    border: 1px solid var(--hca-report-header-border);
    border-radius: 4px;
    padding: 6px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--hca-text);
    cursor: pointer;
    transition: background 0.15s;
}
.fm-export-btn:hover { background: var(--hca-report-header-bg); }

/* --- apply spinner ---------------------------------------------------- */
.fm-spinner {
    display: none;
    font-size: 1.1rem;
    vertical-align: middle;
    animation: fm-spin 0.7s linear infinite;
    color: var(--hca-report-header-text);
}
@keyframes fm-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* --- filter row ------------------------------------------------------- */
.fm-filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    position: relative;
}
.fm-search {
    border: 1px solid #9e9e9e;
    border-radius: 2px;
    padding: 5px 10px;
    font-size: 0.875rem;
    width: 300px !important;
    max-width: 300px !important;
    height: auto !important;
    box-sizing: border-box;
    background: var(--hca-card-bg);
    color: var(--hca-text);
}
.fm-search-clear {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    margin-left: -4px;
    color: var(--hca-text);
    opacity: 0.5;
    display: inline-flex;
    align-items: center;
    line-height: 1;
}
.fm-search-clear:hover { opacity: 1; }
.fm-info-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    color: var(--hca-report-header-text);
    display: inline-flex;
    align-items: center;
    line-height: 1;
}
.fm-info-btn:hover { color: #1565c0; }
.fm-info-popup {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 300;
    background: var(--hca-card-bg);
    border: 1px solid var(--hca-divider);
    border-radius: 6px;
    padding: 14px 18px 10px;
    font-size: 0.8rem;
    width: 460px;
    max-width: 90vw;
    box-shadow: 0 4px 18px rgba(0,0,0,0.18);
    color: var(--hca-text);
    line-height: 1.55;
}
.fm-info-popup h6 { margin: 0 0 8px; font-size: 0.85rem; font-weight: 700; }
.fm-info-popup table { width: 100%; border-collapse: collapse; }
.fm-info-popup tr + tr td { border-top: 1px solid var(--hca-divider); }
.fm-info-popup td { padding: 4px 8px 4px 0; vertical-align: top; }
.fm-info-popup td:first-child {
    white-space: nowrap;
    font-family: monospace;
    font-size: 0.82rem;
    color: #1565c0;
    padding-right: 14px;
    width: 1%;
}
.fm-info-note { margin: 8px 0 0; font-size: 0.75rem; color: var(--hca-report-header-text); }

/* --- table ------------------------------------------------------------ */
.fm-table-wrap {
    background: var(--hca-card-bg);
    border: 1px solid var(--hca-divider);
    border-radius: 4px;
    overflow-x: auto;
}
.fm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.fm-table thead tr {
    background: var(--hca-report-header-bg);
    border-bottom: 2px solid var(--hca-report-header-border);
}
.fm-table th {
    padding: 6px 8px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--hca-report-header-text);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}
.fm-table th:hover { opacity: 0.8; }
.fm-table th .sort-icon {
    display: inline-block;
    margin-left: 4px;
    opacity: 0.4;
    font-size: 0.75rem;
}
.fm-table th.sort-asc .sort-icon,
.fm-table th.sort-desc .sort-icon { opacity: 1; }
.fm-table td {
    padding: 4px 8px;
    border-bottom: 1px solid var(--hca-divider);
    white-space: nowrap;
}
.fm-table th.fm-col-dest,
.fm-table td.fm-col-dest {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fm-table th.fm-col-matchid,
.fm-table td.fm-col-matchid {
    width: 100px;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fm-table tbody tr:hover { background: var(--hca-report-header-bg); }

/* --- pagination ------------------------------------------------------- */
.fm-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0;
}
.fm-pagination {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    font-size: 0.82rem;
    flex-wrap: wrap;
}
.fm-page-btn {
    border: 1px solid var(--hca-divider);
    background: var(--hca-card-bg);
    color: var(--hca-text);
    border-radius: 3px;
    padding: 3px 9px;
    cursor: pointer;
    font-size: 0.82rem;
}
.fm-page-btn:disabled { opacity: 0.4; cursor: default; }
.fm-page-btn.active { background: #1565c0; color: #fff; border-color: #1565c0; }
.fm-page-info { color: var(--hca-report-header-text); margin: 0 4px; }

/* --- row selection ---------------------------------------------------- */
.fm-table tbody tr { cursor: pointer; }
.fm-table tbody tr.fm-row-mixed-dob { background: rgba(255, 179, 0, 0.14); }
.fm-table tbody tr.fm-row-potential-match { background: rgba(0, 150, 136, 0.13); }
.fm-table tbody tr.fm-row-selected { background: rgba(21, 101, 192, 0.2) !important; }

/* --- right-click context menu ----------------------------------------- */
.fm-ctx-menu {
    display: none;
    position: fixed;
    z-index: 600;
    background: var(--hca-card-bg);
    border: 1px solid var(--hca-divider);
    border-radius: 6px;
    padding: 12px 16px 14px;
    min-width: 260px;
    max-width: 420px;
    max-height: 60vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.22);
    color: var(--hca-text);
}
.fm-ctx-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.fm-ctx-title { font-size: 0.85rem; font-weight: 700; }
.fm-ctx-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--hca-text);
    padding: 2px;
    display: inline-flex;
    align-items: center;
}
.fm-ctx-close:hover { color: #c62828; }
.fm-ctx-list {
    list-style: none;
    margin: 0 0 10px;
    padding: 0;
    font-size: 0.8rem;
    font-family: monospace;
    line-height: 1.6;
}
.fm-ctx-list li {
    padding: 2px 0;
    border-bottom: 1px solid var(--hca-divider);
}
.fm-ctx-list li:last-child { border-bottom: none; }
.fm-ctx-empty { font-size: 0.82rem; color: var(--hca-report-header-text); }
.fm-ctx-copy {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    background: #1565c0;
    color: #fff;
    border: none;
    border-radius: 3px;
    padding: 6px 12px;
    font-size: 0.82rem;
    cursor: pointer;
}
.fm-ctx-copy:hover { background: #0d47a1; }
.fm-ctx-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    background: #c62828;
    color: #fff;
    border: none;
    border-radius: 3px;
    padding: 6px 12px;
    font-size: 0.82rem;
    cursor: pointer;
    margin-top: 6px;
}
.fm-ctx-clear:hover { background: #b71c1c; }

/* --- copy toast -------------------------------------------------------- */
.fm-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 700;
    background: #2e7d32;
    color: #fff;
    padding: 10px 18px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.28);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}
.fm-toast.fm-toast-show {
    opacity: 1;
    transform: translateY(0);
}

/* Checkbox label used in toolbar and top bar */
.fm-chk-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
}
.fm-chk-label input[type=checkbox] {
    position: static !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    width: 16px !important;
    height: 16px !important;
    margin: 0 !important;
    flex-shrink: 0;
}
/* Suppress Materialize's animated pseudo-element overlay */
.fm-chk-label span::before,
.fm-chk-label span::after {
    display: none !important;
}
.fm-chk-label span {
    padding-left: 0 !important;
    height: auto !important;
    line-height: 1 !important;
}








.fm-table th[data-col="matchLabel"],
.fm-table td.fm-col-match-label {
    width: 62px;
    max-width: 62px;
}
.fm-match-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    min-height: 18px;
    padding: 0 5px;
    border: 1px solid var(--hca-divider);
    border-radius: 3px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--hca-report-header-text);
    background: transparent;
}
.fm-match-pill.has-value {
    border-color: #1565c0;
    color: #1565c0;
    background: rgba(21, 101, 192, 0.06);
}
.fm-table tbody tr.fm-row-match-hover {
    outline: 1px dashed #1565c0;
    outline-offset: -1px;
}
.fm-table tbody tr.fm-row-match-hover .fm-match-pill {
    border-color: #1565c0;
    background: rgba(21, 101, 192, 0.1);
}
