/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0;
    background: #f0f2f5;
    font-family: system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    font-size: 14px;
    color: #222;
}

/* ============================================================
   APP SHELL – side panel + main
   ============================================================ */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ============================================================
   SIDE PANEL
   ============================================================ */
.side-panel {
    width: 280px;
    min-width: 280px;
    background: #1a3250;
    color: #c9d8ea;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: width 0.22s ease, min-width 0.22s ease;
    flex-shrink: 0;
}
.side-panel.collapsed {
    width: 0;
    min-width: 0;
    overflow: hidden;
}

.side-panel-inner {
    padding: 12px 14px 24px;
    min-width: 280px; /* prevents content collapsing during animation */
}

.side-section {
    margin-bottom: 22px;
}
.side-section-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7fa8cc;
    padding: 0 0 8px 0;
    border-bottom: 1px solid #2d4d70;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Category checkboxes inside side panel */
.category-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.category {
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 8px 10px;
    border: 1px solid rgba(255,255,255,0.08);
}
.category-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: #cce0f5;
    font-size: 13px;
    cursor: pointer;
}
.category-header input[type=checkbox] {
    accent-color: #4da6ff;
    margin: 0;
}
.toggle-icon {
    margin-left: auto;
    font-size: 11px;
    background: rgba(255,255,255,0.1);
    padding: 1px 6px;
    border-radius: 20px;
    cursor: pointer;
    user-select: none;
    color: #aac5e0;
}
.sub-checkboxes {
    display: none;
    margin-top: 8px;
    padding-left: 6px;
    max-height: 200px;
    overflow-y: auto;
}
.sub-checkboxes label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    padding: 2px 0;
    color: #b0cbe8;
    cursor: pointer;
}
.sub-checkboxes label:hover { color: #fff; }
.sub-checkboxes input[type=checkbox] { accent-color: #4da6ff; }

/* Filter rows inside side panel */
.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 8px;
    align-items: center;
}
.filter-row select,
.filter-row input[type=text] {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.18);
    color: #ddeeff;
    border-radius: 5px;
    padding: 4px 7px;
    font-size: 12px;
    width: 100%;
}
.filter-row select option { background: #1a3250; color: #ddeeff; }
.filter-row input[type=text]::placeholder { color: #6a90b0; }
.filter-row select:focus,
.filter-row input[type=text]:focus {
    outline: none;
    border-color: #4da6ff;
}
.filter-value2 { display: none; }

.filter-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
    flex-wrap: wrap;
}
.filter-status {
    font-size: 11px;
    color: #7fa8cc;
    margin-top: 6px;
    min-height: 16px;
}
.filter-badge {
    background: #e74c3c;
    color: white;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 10px;
    font-weight: 700;
}

/* Checkbox dropdown for Team/Pos */
.checkbox-dropdown {
    margin-top: 4px;
    background: #0f2035;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 7px;
    padding: 7px 9px;
    max-height: 160px;
    overflow-y: auto;
    width: 100%;
}
.cbd-title {
    font-size: 10px;
    font-weight: 700;
    color: #6a90b0;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.cbd-list label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    padding: 2px 0;
    cursor: pointer;
    color: #b0cbe8;
}
.cbd-list label:hover { color: #fff; }

/* Computed column fields */
.comp-fields {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.comp-fields input {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.18);
    color: #ddeeff;
    border-radius: 5px;
    padding: 5px 8px;
    font-size: 12px;
    width: 100%;
}
.comp-fields input::placeholder { color: #6a90b0; }
.comp-fields input:focus { outline: none; border-color: #4da6ff; }
.hint { color: #5a7a96; font-size: 11px; margin-top: 4px; display: block; }

/* Custom column remove btn */
.custom-col-row { display: flex; align-items: center; gap: 5px; margin: 3px 0; }
.custom-col-row button {
    padding: 1px 5px;
    font-size: 10px;
    background: #b02a37;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    flex-shrink: 0;
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f0f2f5;
}

/* ============================================================
   TOP HEADER
   ============================================================ */
.top-header {
    background: #1e466e;
    color: white;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.top-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.top-header h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: white;
}
.subtitle {
    font-size: 12px;
    color: #a0c0e0;
}
.panel-toggle {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: background 0.15s;
}
.panel-toggle:hover { background: rgba(255,255,255,0.25); transform: none; }

/* ============================================================
   CHART COLLAPSIBLE BLOCK
   ============================================================ */
.collapsible-block {
    background: white;
    border-bottom: 1px solid #dde3ec;
    flex-shrink: 0;
}
.collapsible-header {
    width: 100%;
    background: none;
    border: none;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 600;
    color: #1e466e;
    cursor: pointer;
    border-radius: 0;
    transition: background 0.15s;
}
.collapsible-header:hover { background: #f0f4f8; transform: none; }
.chevron { font-size: 12px; color: #888; transition: transform 0.2s; }
.chevron.open { transform: rotate(180deg); }

.collapsible-body {
    padding: 14px 18px 16px;
    border-top: 1px solid #eef0f4;
    overflow-y: auto;
    max-height: 70vh;
}

.chart-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}
.chart-controls select,
.chart-controls input {
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 13px;
    background: white;
}
.chart-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    font-size: 13px;
}
.chart-options label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    white-space: nowrap;
    color: #333;
}
.chart-options select {
    padding: 3px 7px;
    border-radius: 5px;
    border: 1px solid #ccc;
    font-size: 12px;
}

/* ============================================================
   TABLE TOOLBAR – injected into Grid.js search row
   ============================================================ */
.gridjs-search {
    display: flex !important;
    align-items: center;
    gap: 8px;
    padding: 8px 12px !important;
    flex-wrap: wrap;
    background: #fff;
    border-bottom: 1px solid #e0e4ea;
}
.gridjs-search-input {
    flex-shrink: 0;
}
.gridjs-toolbar-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-left: 4px;
}
.toolbar-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #555;
    font-weight: 500;
}
.toolbar-label select {
    padding: 4px 8px;
    border-radius: 5px;
    border: 1px solid #ccc;
    font-size: 13px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
button { cursor: pointer; font-family: inherit; }

.btn-sm {
    background: #1e466e;
    color: white;
    border: none;
    padding: 6px 13px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    transition: background 0.15s, transform 0.1s;
    white-space: nowrap;
}
.btn-sm:hover { background: #0f2c45; transform: translateY(-1px); }

.btn-ghost {
    background: transparent;
    color: #1e466e;
    border: 1px solid #b0c4d8;
}
.btn-ghost:hover { background: #eef2f7; transform: translateY(-1px); }

.btn-green {
    background: #1e7e34;
    margin-top: 2px;
}
.btn-green:hover { background: #145523; }

/* side panel buttons */
.side-panel .btn-sm {
    font-size: 11px;
    padding: 5px 10px;
    background: #2a5a8c;
}
.side-panel .btn-sm:hover { background: #1a3f66; }
.side-panel .btn-ghost {
    background: transparent;
    color: #7fa8cc;
    border: 1px solid rgba(255,255,255,0.18);
}
.side-panel .btn-ghost:hover { background: rgba(255,255,255,0.08); transform: none; }
.side-panel .btn-green { background: #1a6e2e; }
.side-panel .btn-green:hover { background: #104a1e; }

/* ============================================================
   TABLE
   ============================================================ */
#tableWrapper {
    flex: 1;
    overflow: auto;
    background: white;
}
#table-container { width: 100%; }

.gridjs-table {
    width: max-content !important;
    min-width: 100%;
    table-layout: auto !important;
    border-collapse: collapse;
}
.gridjs-th,
.gridjs-td {
    white-space: nowrap;
    padding: 5px 10px;
    font-size: 13px;
    line-height: 1.4;
}
.gridjs-th {
    background: #eef2f7;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 2;
}
.gridjs-resizable-handle { background: #cbd5e1; width: 3px; cursor: col-resize; }
.gridjs-resizable-handle:hover { background: #1e466e; }
.gridjs-search input {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 13px;
    width: 220px;
}

/* ============================================================
   LOGO
   ============================================================ */
.top-header-right {
    display: flex;
    align-items: center;
    margin-left: auto;
    padding-left: 16px;
}
.ll-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
    display: block;
}

/* ============================================================
   GRID.JS HEADER OVERRIDES (Prevent "...")
   ============================================================ */
.gridjs-th .gridjs-th-content {
    /* Allow the text to wrap to the next line if it gets tight */
    white-space: normal !important;
    /* Remove the '...' truncation */
    text-overflow: clip !important;
    overflow: visible !important;
    /* Ensure it aligns properly with the sort arrow */
    display: inline-block;
    vertical-align: middle;
    width: 100%;
}
