@import url('../hub/theme.css');

/* HUB Compact — the workspace panel's single density and layout contract. */
.fi-panel-workspace {
    --hub-compact-gap: 0.875rem;
    --hub-compact-padding: 0.875rem;
}

.fi-panel-workspace .fi-main {
    min-width: 0;
    padding-top: 0.625rem;
    padding-bottom: 0.875rem;
}

/* Filament's w-screen utility includes the sidebar width and makes the
   content overlap the sidebar on the workspace panel. Let flex-1 calculate
   the remaining column width instead. */
.fi-panel-workspace .fi-main-ctn {
    width: auto !important;
    min-width: 0;
}

.fi-panel-workspace .fi-page,
.fi-panel-workspace .fi-page > section {
    gap: var(--hub-compact-gap);
}

.fi-panel-workspace .fi-header {
    gap: 0.375rem;
}

.fi-panel-workspace .fi-header-heading {
    font-size: 1.5rem;
    line-height: 1.85rem;
}

.fi-panel-workspace .fi-header-subheading {
    margin-top: 0.2rem;
}

.fi-panel-workspace .fi-section-header {
    padding: 0.625rem var(--hub-compact-padding);
}

.fi-panel-workspace .fi-section-content-ctn > .fi-section-content {
    padding: var(--hub-compact-padding);
}

.fi-panel-workspace .fi-fo-component-ctn {
    gap: var(--hub-compact-gap);
}

.fi-panel-workspace .fi-fo-field-wrp {
    gap: 0.25rem;
}

.fi-panel-workspace .fi-tabs {
    padding: 0.25rem;
    gap: 0.125rem;
}

.fi-panel-workspace .fi-page-sub-navigation-tabs {
    overflow: visible !important;
    flex-wrap: wrap !important;
    row-gap: 0.25rem;
}

.fi-panel-workspace .fi-tabs-item {
    padding: 0.375rem 0.625rem;
}

.fi-panel-workspace .fi-btn {
    min-height: 2rem;
}

.fi-panel-workspace .fi-topbar > nav {
    height: 3rem !important;
    gap: 0.5rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.fi-panel-workspace .fi-topbar [x-persist^='topbar.end'] {
    gap: 0.375rem;
    /* Profile/account menu is always the final control in the top bar. */
    order: 100;
    margin-inline-start: 0 !important;
}

.fi-panel-workspace .fi-topbar #hub-workspace-task-alert {
    /* Keep the whole task/workspace/system/profile group on the right. */
    margin-inline-start: auto;
}

.fi-panel-workspace .hub-task-alert-link {
    color: rgb(255 255 255);
    background: rgb(37 99 235);
    border: 1px solid rgb(37 99 235);
}

.fi-panel-workspace .hub-task-alert-link:hover {
    color: rgb(255 255 255);
    background: rgb(29 78 216);
}

.dark .fi-panel-workspace .hub-task-alert-link {
    color: rgb(255 255 255);
    background: rgb(37 99 235);
    border-color: rgb(96 165 250);
}

.dark .fi-panel-workspace .hub-task-alert-link:hover {
    color: rgb(255 255 255);
    background: rgb(29 78 216);
}

.fi-panel-workspace .hub-task-alert-pulse {
    width: 0.5rem;
    height: 0.5rem;
    flex: none;
    border-radius: 9999px;
    background: rgb(253 224 71);
    box-shadow: 0 0 0 0 rgb(253 224 71 / 0.75);
    animation: hub-task-alert-pulse 1.35s ease-out infinite;
}

@keyframes hub-task-alert-pulse {
    70% { box-shadow: 0 0 0 0.35rem rgb(253 224 71 / 0); }
    100% { box-shadow: 0 0 0 0 rgb(253 224 71 / 0); }
}

@media (prefers-reduced-motion: reduce) {
    .fi-panel-workspace .hub-task-alert-pulse { animation: none; }
}

.fi-panel-workspace .fi-topbar .fi-btn {
    min-height: 1.875rem;
    padding: 0.3rem 0.625rem;
    font-size: 0.8rem;
    line-height: 1rem;
}

.fi-panel-workspace .fi-sidebar-header {
    height: 3rem;
}

.fi-panel-workspace .fi-sidebar-nav {
    padding: 0.625rem;
    gap: 0.375rem;
}

.fi-panel-workspace .fi-sidebar-item-button {
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
}

.fi-panel-workspace .fi-ta-header,
.fi-panel-workspace .fi-ta-header-toolbar,
.fi-panel-workspace .fi-ta-footer {
    padding: 0.5rem 0.75rem;
}

/* Keep bulk-action dropdowns above sticky table headers. */
.fi-panel-workspace .fi-ta-ctn {
    overflow: visible !important;
}

/* A short filtered result can be lower than the columns/filters dropdown.
   Give the open panel room inside the table card, then collapse it again. */
.fi-panel-workspace .fi-ta-ctn:has(
    :is(.fi-ta-col-toggle, .fi-ta-filters-dropdown) .fi-dropdown-panel:not([style*="display: none"])
) {
    min-height: min(32rem, calc(100dvh - 1rem));
}

.fi-panel-workspace .fi-ta-header-ctn {
    position: relative;
    z-index: 30;
    overflow: visible;
}

.fi-panel-workspace .fi-ta-header-toolbar {
    position: relative;
    z-index: 40;
}

.fi-panel-workspace .fi-ta-header-toolbar .fi-dropdown-panel {
    z-index: 50 !important;
}

.fi-panel-workspace .fi-ta-content {
    position: relative;
    z-index: 1;
    max-height: max(20rem, calc(100dvh - 15rem));
    overflow: auto;
    overscroll-behavior-x: contain;
    scrollbar-gutter: stable;
    scrollbar-color: rgb(113 113 122) rgb(39 39 42);
    scrollbar-width: auto;
}

.fi-panel-workspace .fi-ta-content::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.fi-panel-workspace .fi-ta-content::-webkit-scrollbar-track {
    background: rgb(39 39 42);
    border-radius: 999px;
}

.fi-panel-workspace .fi-ta-content::-webkit-scrollbar-thumb {
    min-width: 48px;
    background: rgb(113 113 122);
    border: 3px solid rgb(39 39 42);
    border-radius: 999px;
}

.fi-panel-workspace .fi-ta-content::-webkit-scrollbar-thumb:hover {
    background: rgb(161 161 170);
}

.fi-panel-workspace .fi-ta-table {
    width: max-content;
    min-width: 100%;
}

.fi-panel-workspace .hub-resizable-table-viewport {
    max-width: 100%;
    overflow-x: auto;
}

.fi-panel-workspace .hub-resizable-table-container {
    min-width: 0;
    max-width: none;
}

.fi-panel-workspace .hub-resizable-table-container.hub-empty-actions-column .fi-ta-actions-header-cell,
.fi-panel-workspace .hub-resizable-table-container.hub-empty-actions-column .fi-ta-actions-cell {
    display: none;
}

.fi-panel-workspace .hub-resizable-table-container .fi-ta-header-cell {
    padding-left: 6px !important;
    padding-right: 6px !important;
}

.fi-panel-workspace .hub-resizable-table-container .fi-ta-cell .fi-ta-text,
.fi-panel-workspace .hub-resizable-table-container .fi-ta-cell .fi-ta-icon,
.fi-panel-workspace .hub-resizable-table-container .fi-ta-cell .fi-ta-image {
    padding-left: 6px !important;
    padding-right: 6px !important;
}

.fi-panel-workspace .hub-resizable-table-container .fi-ta-header-cell:not(:last-child),
.fi-panel-workspace .hub-resizable-table-container .fi-ta-cell:not(:last-child) {
    border-right: 1px solid rgb(229 231 235);
}

.dark .fi-panel-workspace .hub-resizable-table-container .fi-ta-header-cell:not(:last-child),
.dark .fi-panel-workspace .hub-resizable-table-container .fi-ta-cell:not(:last-child) {
    border-right-color: rgb(255 255 255 / 0.1);
}

.fi-panel-workspace .hub-resizable-table-container .fi-ta-header-cell > *,
.fi-panel-workspace .hub-resizable-table-container .fi-ta-cell .fi-ta-col-wrp > a,
.fi-panel-workspace .hub-resizable-table-container .fi-ta-cell .fi-ta-col-wrp > div,
.fi-panel-workspace .hub-resizable-table-container .fi-ta-cell .fi-ta-text > .flex {
    justify-content: center !important;
    text-align: center !important;
}

.fi-panel-workspace .hub-resizable-table-container .fi-table-header-cell-name > *,
.fi-panel-workspace .hub-resizable-table-container .fi-table-header-cell-article > *,
.fi-panel-workspace .hub-resizable-table-container .fi-table-cell-name .fi-ta-col-wrp > a,
.fi-panel-workspace .hub-resizable-table-container .fi-table-cell-name .fi-ta-col-wrp > div,
.fi-panel-workspace .hub-resizable-table-container .fi-table-cell-name .fi-ta-text > .flex,
.fi-panel-workspace .hub-resizable-table-container .fi-table-cell-article .fi-ta-col-wrp > a,
.fi-panel-workspace .hub-resizable-table-container .fi-table-cell-article .fi-ta-col-wrp > div,
.fi-panel-workspace .hub-resizable-table-container .fi-table-cell-article .fi-ta-text > .flex {
    justify-content: flex-start !important;
    text-align: left !important;
}

.fi-panel-workspace .fi-ta-header-cell,
.fi-panel-workspace .fi-ta-cell,
.fi-panel-workspace .fi-ta-header-cell-label,
.fi-panel-workspace .fi-ta-text-item-label {
    white-space: nowrap !important;
}

.fi-panel-workspace .fi-ta-cell,
.fi-panel-workspace .fi-ta-col-wrp,
.fi-panel-workspace .fi-ta-cell .fi-ta-text,
.fi-panel-workspace .fi-ta-cell .fi-ta-text > div,
.fi-panel-workspace .fi-ta-cell .fi-ta-text-item {
    min-width: 0;
    overflow: hidden;
}

.fi-panel-workspace .fi-ta-header-cell,
.fi-panel-workspace .fi-ta-table > thead .fi-ta-selection-cell {
    position: sticky;
    top: 0;
    z-index: 10;
    overflow: visible;
    background: rgb(255 255 255 / 0.97);
}

/* The filters dropdown must remain above sticky table headings. */
.fi-panel-workspace .fi-ta-filters-dropdown .fi-dropdown-panel {
    z-index: 20 !important;
}

/* Each company is a separate marketplace connection, not one continuous register. */
.fi-panel-workspace .hub-marketplace-integration-card:not(:last-child) {
    margin-bottom: 1.75rem;
}

.fi-panel-workspace .hub-marketplace-integration-card {
    box-shadow: 0 8px 20px rgb(15 23 42 / 0.08);
}

.dark .fi-panel-workspace .fi-ta-header-cell,
.dark .fi-panel-workspace .fi-ta-table > thead .fi-ta-selection-cell {
    background: rgb(39 39 42 / 0.97);
}

.fi-panel-workspace .fi-ta-header-cell-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fi-panel-workspace .fi-ta-cell .fi-ta-text-item-label {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fi-panel-workspace .fi-ta-header-cell,
.fi-panel-workspace .fi-ta-cell {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.fi-panel-workspace .fi-ta-header-cell > *,
.fi-panel-workspace .fi-ta-header-cell > div {
    padding-top: 0.375rem !important;
    padding-bottom: 0.375rem !important;
}

.fi-panel-workspace .fi-ta-cell > div {
    padding-top: 4px !important;
    padding-bottom: 4px !important;
}

.fi-panel-workspace .fi-ta-cell .fi-ta-text {
    padding-top: 4px !important;
    padding-bottom: 4px !important;
}

.fi-panel-workspace .fi-ta-cell .fi-ta-icon {
    padding-top: 4px !important;
    padding-bottom: 4px !important;
}

.fi-panel-workspace .fi-ta-row {
    height: 2.625rem;
}

.fi-panel-workspace .fi-ta-search-field .fi-input-wrp,
.fi-panel-workspace .fi-ta-header-toolbar .fi-input-wrp {
    min-height: 2rem;
}

.fi-panel-workspace .fi-ta-row > td {
    transition: background-color 0.12s ease;
}

.fi-panel-workspace .fi-pagination {
    gap: 0.5rem;
}

.fi-panel-workspace .fi-page-sub-navigation-tabs {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.fi-panel-workspace .hub-workspace-resource-navigation {
    margin-top: 0.75rem !important;
}

.fi-panel-workspace .hub-column-resize-handle {
    position: absolute;
    top: 0;
    right: -4px;
    z-index: 10;
    width: 8px;
    height: 100%;
    cursor: col-resize;
}

.fi-panel-workspace .hub-column-resize-handle::after {
    position: absolute;
    top: 25%;
    right: 3px;
    width: 2px;
    height: 50%;
    border-radius: 2px;
    background: rgb(148 163 184 / 0.65);
    content: '';
    opacity: 0;
    transition: opacity 0.15s;
}

.fi-panel-workspace .fi-ta-header-cell:hover .hub-column-resize-handle::after {
    opacity: 1;
}

@media (max-width: 640px) {
    .fi-panel-workspace .fi-main {
        padding-top: 0.5rem;
    }

    .fi-panel-workspace .fi-header-heading {
        font-size: 1.35rem;
    }
}
