/* layout.css — app shell layout and small components not covered by custom.css */
.container-fluid { padding: 0; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); }
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }
.app-body  { display: flex; flex: 1; min-height: 0; }
.app-sidebar { width: 260px; flex: 0 0 260px; }
.app-main  { flex: 1; min-width: 0; max-width: none; }
.app-header .user-name { color: rgba(255,255,255,0.8); font-size: 0.85rem; }
.app-sidebar .nav-link { cursor: pointer; text-decoration: none; }
.app-sidebar .shiny-input-container { width: 100%; margin-bottom: 0.6rem; }
.app-sidebar .freshness { color: rgba(255,255,255,0.55); font-size: 0.75rem; padding: 0.25rem 0.5rem; }
.app-sidebar .mode-note { color: rgba(255,255,255,0.55); font-size: 0.75rem; margin: -0.3rem 0 0.6rem; }

.view-title { font-family: var(--font-header); font-size: 1.5rem; font-weight: 600; letter-spacing: 0.04em; margin: 0 0 0.25rem; }
.view-sub   { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 1rem; }
.placeholder-view { padding: 3rem 1rem; text-align: center; color: var(--text-muted); }

/* table filter bar */
.table-filters { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; align-items: flex-end; margin-bottom: 0.9rem; }
.table-filters .shiny-input-container { margin-bottom: 0; }
.table-filters .form-group { margin-bottom: 0; }
.table-filters label { font-size: 0.78rem; font-weight: 500; color: var(--text-muted); margin-bottom: 0.2rem; }
.table-filters .checkbox, .table-filters .form-check { margin: 0; }
.table-summary { color: var(--text-muted); font-size: 0.82rem; margin: 0.6rem 0 0.4rem; }

/* availability badges (match tier-badge look) */
.avail-badge { display: inline-block; font-family: var(--font-header); font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; padding: 0.2rem 0.55rem; border-radius: var(--radius-pill);
  border: 1px solid transparent; white-space: nowrap; }
.avail-badge.available { background: rgba(34,197,94,0.14); color: #16a34a; border-color: rgba(34,197,94,0.35); }
.avail-badge.employed  { background: rgba(107,114,128,0.14); color: var(--text-muted); border-color: rgba(107,114,128,0.3); }
.avail-badge.unknown   { background: transparent; color: var(--text-muted); border-color: var(--border); }
.avail-badge.unavailable { background: rgba(220,38,38,0.12); color: #dc2626; border-color: rgba(220,38,38,0.35); }
.avail-badge.not_interested { background: rgba(249,115,22,0.14); color: #ea580c; border-color: rgba(249,115,22,0.4); }
.avail-sub { display: block; font-size: 0.72rem; color: var(--text-muted); margin-top: 0.15rem; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.insufficient { display: inline-block; font-size: 0.7rem; color: #b45309; background: rgba(245,158,11,0.14);
  border: 1px solid rgba(245,158,11,0.35); border-radius: var(--radius-pill); padding: 0.1rem 0.45rem; margin-left: 0.35rem; white-space: nowrap; }
.score-cell { min-width: 120px; }
.league-chip { display: inline-block; font-size: 0.68rem; font-weight: 600; padding: 0.1rem 0.4rem; margin-right: 0.2rem;
  border-radius: var(--radius-sm); background: var(--border-subtle); color: var(--text-muted); }
.row-actions { display: flex; gap: 0.3rem; flex-wrap: nowrap; }
.row-actions .btn { font-size: 0.72rem; padding: 0.15rem 0.5rem; white-space: nowrap; }
.unknown-name { font-style: italic; color: var(--text-muted); }

@media (max-width: 900px) {
  .app-body { flex-direction: column; }
  .app-sidebar { width: auto; flex: none; min-height: 0; }
}

.manager-cell .cell-sub { white-space: normal; display: flex; flex-wrap: wrap; gap: 0.2rem; margin-top: 0.1rem; }
.manager-cell .league-chip { margin-right: 0; }
.insufficient { margin-left: 0.5rem; }

/* reactable sets its own text color; make it follow the light/dark theme */
.reactable, .reactable .rt-td { color: var(--text) !important; }
.reactable .rt-tbody, .reactable .rt-tr-group, .reactable .rt-tr { background-color: var(--bg-panel); }
.reactable .rt-pagination, .reactable .rt-pagination-info, .reactable .rt-page-button,
.reactable .rt-page-size-select, .reactable .rt-page-jump { color: var(--text); }
.reactable .rt-page-size-select, .reactable .rt-page-jump { background-color: var(--bg-input); border-color: var(--border); }
.reactable .rt-page-button:hover:not([disabled]) { background-color: var(--row-hover); }
.reactable .rt-page-button-current { background-color: var(--accent-glow); font-weight: 600; }
.reactable .rt-pagination { border-top: 1px solid var(--border); }
.reactable .rt-pagination { background-color: var(--bg-panel); }

/* star toggle in tables */
.star-btn { background: none; border: none; font-size: 1.15rem; line-height: 1; color: var(--text-muted); cursor: pointer; padding: 0 0.2rem; }
.star-btn:hover { color: #f59e0b; }
.star-btn.on { color: #f59e0b; }

/* ---- profile slide-over ---- */
.profile-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1500; }
.profile-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(1000px, 96vw); background: var(--bg);
  z-index: 1600; overflow-y: auto; padding: 1.25rem 1.5rem 3rem; border-left: 2px solid var(--accent);
  box-shadow: var(--shadow-lg); }
.profile-close { position: sticky; top: 0; float: right; z-index: 5; width: 2.2rem; height: 2.2rem; border-radius: 50%;
  border: 1px solid var(--border); background: var(--bg-panel); color: var(--text); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.profile-close:hover { border-color: var(--accent); color: var(--accent); }
.profile-kpis { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; }
.profile-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-top: 0.6rem; }
.profile-actions .shiny-input-container, .profile-actions .form-group { margin: 0; }
.profile-actions .radio-inline, .profile-actions .form-check-inline { font-size: 0.82rem; }
.manager-meta .meta-sep:last-child { display: none; }
.profile-section { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-md);
  margin-bottom: 0.9rem; box-shadow: var(--shadow-sm); }
.profile-section > summary { cursor: pointer; padding: 0.7rem 1rem; font-family: var(--font-header); font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase; font-size: 0.85rem; list-style: none; }
.profile-section > summary::before { content: '\25B8'; display: inline-block; margin-right: 0.5rem; color: var(--accent); transition: transform 0.15s; }
.profile-section[open] > summary::before { transform: rotate(90deg); }
.profile-section-body { padding: 0 1rem 1rem; }
.profile-group { border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); margin-bottom: 0.5rem; }
.profile-group > summary { cursor: pointer; padding: 0.5rem 0.8rem; display: flex; gap: 0.8rem; align-items: center; list-style: none; }
.profile-group > summary::before { content: '\25B8'; color: var(--accent); }
.profile-group[open] > summary::before { content: '\25BE'; }
.profile-group .grp-name { font-family: var(--font-header); font-weight: 600; flex: 1; }
.profile-group .grp-score { font-family: var(--font-header); font-size: 1.2rem; font-weight: 700; color: var(--accent); }
.profile-group .grp-weight { font-size: 0.72rem; color: var(--text-muted); min-width: 120px; text-align: right; }
.profile-group .comparison-wrapper { padding: 0 0.6rem 0.6rem; }
.profile-subhead { font-size: 0.95rem; margin: 1rem 0 0.4rem; }
.profile-note { border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 0.6rem 0.8rem; margin-bottom: 0.5rem; }
.profile-note .note-head { display: flex; gap: 0.6rem; align-items: center; font-size: 0.8rem; margin-bottom: 0.3rem; }
.profile-note .note-del { margin-left: auto; font-size: 0.7rem; padding: 0.05rem 0.4rem; }
.profile-note .note-text { white-space: pre-wrap; font-size: 0.88rem; }

/* profile season table: tight padding so narrow numeric columns don't wrap */
.season-table .rt-td, .season-table .rt-th { padding: 0.4rem 0.4rem; }
.season-table .rt-td { white-space: nowrap; }

/* tier views: toolbar, compare, nav counts */
.table-toolbar { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; align-items: center; margin-bottom: 0.8rem; }
.table-toolbar .shiny-input-container, .table-toolbar .form-group { margin: 0; }
.table-toolbar > .form-group > label.control-label { font-size: 0.78rem; font-weight: 500; color: var(--text-muted); margin-right: 0.6rem; }
.table-toolbar .shiny-options-group { display: inline-flex; gap: 1rem; }
.compare-bar { display: inline-flex; align-items: center; gap: 0.7rem; }
.compare-bar .btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.export-buttons { display: flex; gap: 0.5rem; margin-left: auto; }
.cmp-box { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); cursor: pointer; }
.app-sidebar .nav-count { margin-left: auto; font-family: var(--font-header); font-size: 0.72rem; padding: 0.05rem 0.5rem;
  border-radius: var(--radius-pill); background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.85); }
.app-sidebar .nav-link.active .nav-count { background: var(--accent); color: #fff; }

/* ---- Visualize ---- */
.viz-controls { align-items: flex-end; }
.viz-controls .radio-inline, .viz-controls .form-check-inline { font-size: 0.85rem; }
.viz-chart { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0.5rem; box-shadow: var(--shadow-sm); }
.viz-chart:fullscreen, .viz-chart .html-widget:fullscreen { background: var(--bg-panel); padding: 1rem; }
.viz-tip { position: fixed; z-index: 3000; display: none; gap: 0.7rem; align-items: center; pointer-events: none;
  background: var(--bg-panel); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 0.55rem 0.7rem; box-shadow: var(--shadow-lg); font-size: 0.8rem; max-width: 320px; }
.viz-tip img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); flex-shrink: 0; }
.viz-tip .muted { color: var(--text-muted); margin-bottom: 0.2rem; }

/* mini-profile slide-in (sits under the full profile panel) */
.mini-panel { position: fixed; top: 4.5rem; right: 1rem; width: 340px; z-index: 1400; background: var(--bg-panel);
  border: 1px solid var(--border); border-top: 3px solid var(--accent); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); padding: 1rem; }
.mini-panel .mini-close { position: absolute; top: 0.5rem; right: 0.5rem; float: none; width: 1.8rem; height: 1.8rem; font-size: 1.1rem; }
.mini-head { display: flex; gap: 0.8rem; align-items: center; margin-bottom: 0.8rem; }
.mini-head h3 { margin: 0 0 0.3rem; font-size: 1.15rem; }
.mini-head .manager-headshot { width: 64px; height: 64px; }
.mini-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; margin-bottom: 0.8rem; }
.mini-kpi { background: var(--kpi-bg); border: 1px solid var(--kpi-border); border-radius: var(--radius-sm); padding: 0.4rem 0.2rem; text-align: center; }
.mini-kpi-v { font-family: var(--font-header); font-weight: 700; color: var(--accent); font-size: 1.05rem; }
.mini-kpi-l { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.mini-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* ---- Compare ---- */
.compare-wrap { overflow-x: auto; }
.compare-table { table-layout: fixed; min-width: 640px; }
.compare-table th.compare-corner { width: 28%; text-align: left; vertical-align: bottom; font-family: var(--font-body); text-transform: none;
  letter-spacing: 0; font-size: 0.78rem; font-weight: 400; padding-bottom: 0.8rem; }
.compare-table th.compare-card { position: sticky; top: 0; z-index: 3; background: var(--bg-panel); text-align: center; vertical-align: top;
  padding: 0.9rem 0.6rem; border-bottom: 2px solid var(--border); text-transform: none; letter-spacing: 0; }
.compare-card .manager-headshot { width: 64px; height: 64px; margin: 0 auto 0.4rem; display: block; }
.compare-card .compare-name { display: block; font-family: var(--font-header); font-size: 1.05rem; font-weight: 700; color: var(--text); margin-bottom: 0.3rem; }
.compare-card .compare-sub { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; margin: 0.35rem 0; }
.compare-card .compare-score { font-family: var(--font-body); font-weight: 400; color: var(--text); font-size: 0.85rem; }
.compare-card .compare-score b { font-family: var(--font-header); font-size: 1.25rem; color: var(--accent); }
.compare-card .compare-remove { position: absolute; top: 0.3rem; right: 0.4rem; border: none; background: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; line-height: 1; }
.compare-card .compare-remove:hover { color: #ef4444; }
.compare-table td.dir { width: 36px; text-align: center; color: var(--text-muted); font-family: var(--font-body); }
.compare-table td { text-align: center; }
.compare-table td:first-child { text-align: left; }
.compare-table .pctl { margin-left: 0.4rem; font-family: var(--font-body); font-size: 0.68rem; color: var(--text-muted); font-weight: 400; }
.compare-table .nr-tag { font-family: var(--font-body); font-size: 0.7rem; font-weight: 400; }
.compare-table tr.grp-head td { background: var(--row-stripe); border-top: 2px solid var(--border); font-family: var(--font-header); cursor: pointer; text-align: left; }
.compare-table tr.grp-head td.grp-score { text-align: center; color: var(--accent); font-weight: 700; font-size: 1.05rem; }
.compare-table tr.grp-head.static { cursor: default; }
.compare-table .grp-caret { display: inline-block; width: 1rem; color: var(--accent); transition: transform 0.15s; }
.compare-table tbody.collapsed .grp-caret { transform: rotate(-90deg); }
.compare-table tbody.collapsed tr.m-row { display: none; }
.compare-table .grp-weight { margin-left: 0.8rem; font-family: var(--font-body); font-size: 0.72rem; color: var(--text-muted); font-weight: 400; }

/* selectize follows the light/dark theme outside the sidebar */
.app-main .selectize-input, .app-main .selectize-dropdown { background-color: var(--bg-input); color: var(--text); border-color: var(--border); }
.app-main .selectize-input .item { background: var(--row-stripe); color: var(--text); border: 1px solid var(--border); }
.app-main .selectize-input.full, .app-main .selectize-input input { color: var(--text); }
.app-main .selectize-dropdown .option { color: var(--text); }
.app-main .selectize-dropdown .active { background-color: var(--row-hover); color: var(--text); }
.compare-card .compare-remove { font-size: 1.6rem; }

/* ---- fit-to-screen table, compact top, collapsible left panel ---- */
.app-main { padding: 0.75rem 1.25rem 0.5rem; }
.view-title { margin-bottom: 0.1rem; }
.view-sub { margin-bottom: 0.5rem; }
.table-filters { margin-bottom: 0.4rem; gap: 0.4rem 1.1rem; }
.table-filters .export-buttons { margin-left: auto; align-self: flex-end; }
.table-summary { margin: 0.2rem 0 0.3rem; }
.pool-table-wrapper { min-height: 260px; }
.pool-table-wrapper .reactable { height: 100%; }
.name-line { display: flex; align-items: center; gap: 0.5rem; }
.name-line .star-btn { font-size: 1rem; padding: 0; margin-left: 0.4rem; }
.sidebar-toggle { background: none; border: none; color: #fff; font-size: 1.4rem; line-height: 1; cursor: pointer; padding: 0.2rem 0.6rem; margin-right: 0.4rem; }
.sidebar-toggle:hover { color: var(--accent); }
.app-sidebar { min-height: 0; }
/* collapsed: a narrow rail with the navigation icons only */
.sidebar-collapsed .app-sidebar { width: 56px; flex: 0 0 56px; padding: 0.75rem 0.4rem; overflow: hidden; }
.sidebar-collapsed .app-sidebar .nav-label, .sidebar-collapsed .app-sidebar .nav-count,
.sidebar-collapsed .app-sidebar .sidebar-section-label, .sidebar-collapsed .app-sidebar hr,
.sidebar-collapsed .app-sidebar .shiny-input-container, .sidebar-collapsed .app-sidebar .freshness,
.sidebar-collapsed .app-sidebar .mode-note { display: none; }
.sidebar-collapsed .app-sidebar .nav-link { justify-content: center; padding: 0.55rem 0; }

/* second filter row: checkboxes on the left, export buttons on the right of the same line (wrapping together) */
.filter-row2 { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 1.25rem; flex: 1 1 100%; }
.filter-row2 .shiny-input-container { width: auto; }
.filter-row2 .export-buttons { margin-left: auto; align-self: center; }
/* the table fills its box: header and page navigation stay on screen, rows and both scrollbars live inside the table */
.pool-table-wrapper > .html-widget, .pool-table-wrapper > .reactable { height: 100% !important; }
.pool-table-wrapper .reactable { display: flex; flex-direction: column; }
.pool-table-wrapper .rt-table { flex: 1 1 0; min-height: 0; }

/* Overall Score: a short bar with the number to its right (the column stays narrow) */
.score-cell { min-width: 0; }
.score-cell .pct-bar { flex: 0 0 44px; }
.score-cell .pct-bar-val { min-width: 2.1rem; text-align: left; color: var(--text); font-size: 0.85rem; }
/* the metric being filtered */
.reactable .rt-th.mf-col, .reactable .rt-td.mf-col { background-color: var(--accent-glow); }
.filter-row2 .shiny-input-container select { padding-top: 0.25rem; padding-bottom: 0.25rem; }

/* filter bar: two groups that share a line on a wide screen and stack on a laptop */
.filter-group { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; align-items: flex-end; flex: 0 1 auto; }
.filter-group .shiny-input-container, .filter-group .form-group { margin-bottom: 0; }
.filter-group .selectize-input { flex-wrap: nowrap; overflow: hidden; }
/* league chips stay on one line */
#pool-leagues + .selectize-control, [id$="-leagues"] + .selectize-control { width: 100%; }
.filter-group [id$="-leagues"] ~ .selectize-control .selectize-input { white-space: nowrap; padding: 0.3rem 0.4rem; }
.filter-group [id$="-leagues"] ~ .selectize-control .selectize-input .item { margin-right: 0.25rem; padding: 0.1rem 0.3rem; font-size: 0.85rem; }
.filter-group [id$="-leagues"] ~ .selectize-control .selectize-input > input { width: 1px !important; min-width: 1px; }

/* title row with the show/hide-filters button; collapsed = only the title, the count and the table */
.view-head { display: flex; align-items: center; gap: 1rem; }
.view-head .view-title { margin: 0 0 0.1rem; }
.filters-toggle { background: none; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-muted);
  font-size: 0.78rem; padding: 0.15rem 0.6rem; cursor: pointer; }
.filters-toggle:hover { color: var(--accent); border-color: var(--accent); }
.filters-collapsed .table-filters, .filters-collapsed .table-toolbar, .filters-collapsed .view-sub { display: none; }
.filters-collapsed .filters-toggle { color: var(--accent); border-color: var(--accent); }
.league-rank { font-family: var(--font-header); }

/* the club team being evaluated (left panel) */
.club-panel .club-team-name { color: #fff; font-size: 0.9rem; padding: 0 0.1rem 0.4rem; }
.club-coach { font-size: 0.8rem; color: rgba(255,255,255,0.8); line-height: 1.45; padding: 0 0.1rem; }
.club-coach-label { font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: rgba(255,255,255,0.5); }
.club-coach-name { font-size: 1rem; color: #fff; font-weight: 600; margin-bottom: 0.15rem; }
.club-coach-note { color: rgba(255,255,255,0.5); font-size: 0.72rem; }
.sidebar-collapsed .app-sidebar .club-panel { display: none; }

/* dialogs opened from the profile drawer (link to Transfermarkt, unavailable reason) must sit above the drawer and its overlay */
.modal { z-index: 2100 !important; }
.modal-backdrop { z-index: 2090 !important; }
