/* ============================================
   ENHANCED LISTING - STRUCTURAL CHANGES ONLY
   senaite.ehrplus - EHRPlus customizations

   This CSS only changes the STRUCTURE/LAYOUT:
   - Moves search bar to full-width position above tabs
   - Unified filter bar (scope, dates, sample/dept)
   - Keeps original SENAITE design language intact
   ============================================ */

/* ===========================================
   SECTION 1: TOP TOOLBAR LAYOUT
   Restructure to put search bar above filter tabs
   =========================================== */

/* Stack toolbar vertically: search on top, filters below */
.ajax-contents-table .top-toolbar.row {
    display: flex;
    flex-direction: column;
    padding-bottom: 0.5em;
    padding-right: 0.5em;
}

/* Search container - first (on top), full width */
.ajax-contents-table .top-toolbar > .col-sm-3 {
    order: 1;
    flex: 0 0 100%;
    max-width: 100%;
    text-align: left;
    padding-left: 0;
    padding-right: 0;
    margin-bottom: 0.35em;
}

/* Filter bar container - second (below search), full width */
.ajax-contents-table .top-toolbar > .col-sm-8 {
    order: 2;
    flex: 0 0 100%;
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
}

/* Compact state/transition tabs */
.ajax-contents-table .top-toolbar .nav-item.btn {
    padding: 0.15em 0.4em;
    font-size: 0.75rem;
    margin-right: 0.25em !important;
    margin-bottom: 0.25em !important;
    border-radius: 3px;
}

/* Loader column - position inline with search */
.ajax-contents-table .top-toolbar > .col-sm-1 {
    order: 1;
    position: absolute;
    right: 0;
    top: 0;
}


/* ===========================================
   SECTION 2: SEARCH INPUT SIZE
   Make search input slightly larger
   =========================================== */

/* Make input group full width */
.ajax-contents-table .top-toolbar .input-group {
    width: 100%;
}

/* Compact search input */
.ajax-contents-table .top-toolbar .input-group .form-control {
    height: auto;
    padding: 0.35rem 0.75rem;
    font-size: 0.9rem;
}

.ajax-contents-table .top-toolbar .input-group .btn {
    padding: 0.35rem 0.75rem;
}


/* ===========================================
   SECTION 3: RESPONSIVE ADJUSTMENTS
   =========================================== */

@media (max-width: 576px) {
    .ajax-contents-table .top-toolbar > .col-sm-1 {
        position: static;
        order: 1;
        flex: 0 0 auto;
        max-width: none;
        text-align: right;
        margin-bottom: 0.5em;
    }
}


/* ===========================================
   SECTION 4: UNIFIED FILTER BAR
   Single compact row for all filters
   =========================================== */

.ehrplus-filter-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    order: 1;
    margin-bottom: 16px;
    padding: 4px 8px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 3px;
    font-size: 0;  /* kill inline whitespace between items */
}

/* All direct children get proper font size back */
.ehrplus-filter-bar > * {
    font-size: 0.8rem;
}

/* --- Vertical separator between filter groups --- */
.ehrplus-fb-sep {
    display: inline-block;
    width: 1px;
    height: 18px;
    background-color: #dee2e6;
    flex-shrink: 0;
}

/* --- Dropdown selects (scope, sample type, department) --- */
.ehrplus-fb-select {
    appearance: auto;
    -webkit-appearance: auto;
    display: inline-block;
    height: 26px;
    padding: 0 4px;
    font-size: 0.8rem;
    line-height: 1.3;
    color: #495057;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    cursor: pointer;
    max-width: 140px;
    transition: border-color 0.15s ease-in-out, background-color 0.15s ease-in-out;
}

.ehrplus-fb-select:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.15rem rgba(0, 123, 255, 0.15);
}

/* Active state: control has a non-default value */
.ehrplus-fb-select.ehrplus-fb-active {
    background-color: #e7f1ff;
    border-color: #86b7fe;
    color: #0a58ca;
    font-weight: 600;
}

/* Scope dropdown -- slightly wider for the option text */
.ehrplus-fb-scope {
    max-width: 150px;
}

/* --- Date preset chips --- */
.ehrplus-fb-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 24px;
    padding: 0 8px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1;
    color: #495057;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    transition: all 0.15s ease-in-out;
}

.ehrplus-fb-chip:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

.ehrplus-fb-chip:active {
    background-color: #dee2e6;
}

.ehrplus-fb-chip.active {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}

.ehrplus-fb-chip.active:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

/* --- Date inputs --- */
.ehrplus-fb-date {
    display: inline-block;
    height: 26px;
    width: 125px;
    padding: 0 4px;
    font-size: 0.8rem;
    line-height: 1.3;
    color: #495057;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    transition: border-color 0.15s ease-in-out;
}

.ehrplus-fb-date:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.15rem rgba(0, 123, 255, 0.15);
}

.ehrplus-fb-date.ehrplus-fb-active {
    background-color: #e7f1ff;
    border-color: #86b7fe;
    font-weight: 600;
}

/* Em-dash between date inputs */
.ehrplus-fb-dash {
    color: #adb5bd;
    font-size: 0.8rem;
    line-height: 1;
}

/* --- Clear-all button --- */
.ehrplus-fb-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    margin-left: auto;  /* push to right edge */
    border: 1px solid #dee2e6;
    border-radius: 3px;
    background-color: #fff;
    color: #6c757d;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease-in-out;
}

.ehrplus-fb-clear:hover {
    background-color: #f8d7da;
    border-color: #f5c2c7;
    color: #dc3545;
}

.ehrplus-fb-clear:active {
    background-color: #f1aeb5;
}

.ehrplus-fb-clear svg {
    flex-shrink: 0;
}

/* When filter bar has active filters, tint the bar subtly */
.ehrplus-filter-bar.has-active-filters {
    background-color: #f0f6ff;
    border-color: #c8ddf8;
}

/* --- Responsive: wrap naturally on narrow screens --- */
@media (max-width: 576px) {
    .ehrplus-filter-bar {
        gap: 4px;
        padding: 4px 6px;
    }

    .ehrplus-fb-select {
        max-width: 120px;
    }

    .ehrplus-fb-date {
        width: 110px;
    }

    .ehrplus-fb-sep {
        display: none;
    }
}


/* ===========================================
   SECTION 5: PANELS COLUMN COMPACTION
   Truncate long Panels/Profile strings in listings
   =========================================== */

.ajax-contents-table td[data-col="Panels"],
.ajax-contents-table td[data-col="Profiles"],
.ajax-contents-table td[data-col="ProfilesTitle"],
.ajax-contents-table td[data-col="getProfilesTitle"] {
    max-width: 240px;
    width: 240px;
}

.ehrplus-panels-cell {
    display: inline-block;
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
}

@media (max-width: 768px) {
    .ajax-contents-table td[data-col="Panels"],
    .ajax-contents-table td[data-col="Profiles"],
    .ajax-contents-table td[data-col="ProfilesTitle"],
    .ajax-contents-table td[data-col="getProfilesTitle"] {
        max-width: 180px;
        width: 180px;
    }

    .ehrplus-panels-cell {
        max-width: 180px;
    }
}


.LabNumber, .getId, .MRN,  .getSampleTypeTitle{
    width: 120px;
}

 .Patient, .getDateReceived {
    width: 200px;
 }

 .getProfilesTitle {
    max-width: 300px;
 }

 .ehrplus-row-delete-cell {
     width: 90px;
     text-align: right;
 }

 .ehrplus-row-delete {
     padding: 0.15rem 0.4rem;
     font-size: 0.75rem;
     line-height: 1.2;
  }


/* ===========================================
   SECTION 6: SEARCH HINT
   Compact search hint layout
   =========================================== */

.ehrplus-search-hint {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.ehrplus-search-hint-title {
    line-height: 1.2;
}

.ehrplus-search-hint-section {
    margin-top: 0.1rem;
}

.ehrplus-search-hint-section-title {
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.ehrplus-search-hint-state-list {
    margin: 0;
    padding-left: 1rem;
}

.ehrplus-search-hint-state-list li {
    margin: 0.05rem 0;
    line-height: 1.25;
}

.ehrplus-search-hint-state-name {
    color: #212529;
}

.ehrplus-search-hint-state-link {
    font-weight: 600;
}

.ehrplus-search-hint-state-count {
    font-weight: 600;
}

@media (max-width: 576px) {
    .ehrplus-search-hint-state-list {
        padding-left: 0.9rem;
    }
}
