/*================================*/
/*    FILTER-TABLE.CSS            */
/*    KGARMIRE, 2025-05-06        */
/*================================*/

:root{
    --ft-blue:#016699;
    --ft-gold:#f9bb56;
    --ft-gray:#565656;
}

._ft-cont{
    height:100%;
    width: 100%;
}

svg._ft-filter{ 
    height:18px;
    width:18px;
    margin:auto;
}

._ft-help{ cursor:help; }

/*--- SEARCH ---------------------*/

._ft-action-cont{
    display: flex;
    gap:8px;
    margin-bottom:8px;
}

._ft-search-bar{
    height: 32px;
    border-radius: 99px;
    border: 1px solid var(--ft-blue);
    padding: 0 18px;
    width: 100%;
    max-width: 600px;
}

._ft-record-count{
    margin: auto 0;
    color: var(--ft-gray);
}

._ft-clear-filter{
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    justify-content: center;
    align-items: center;

    height:32px;
    width:auto;

    margin-left:auto;
    padding:0 8px;

    background-color: var(--ft-blue);
    color:white;
    border:none;
    border-radius: 4px;

    cursor: pointer;
}

._ft-clear-filter:disabled{
    background-color: #c8cbce;
    color:#a3a3a3;
    cursor: not-allowed;
}
._ft-clear-filter:disabled svg{
    fill:#a3a3a3;
}

._ft-button{
    height:32px;
    width:auto;

    /*margin-left:auto;*/
    padding:0 8px;

    background-color: var(--ft-blue);
    color:white;
    border:none;
    border-radius: 4px;

    cursor: pointer;
}


/*--- TABLE ----------------------*/
._ft-table-cont{
    height:100%;
    width:100%;
    overflow: auto;
    height: calc(100% - 48px);
    border-bottom: 1px solid var(--ft-gray);
}


table._ft{
    width: 100%;
    position: relative;
    min-height: 450px;
}

table._ft thead{
  position: sticky;
  inset-block-start: 0;
}

table._ft thead th{
    position: relative;
    text-align:left;
    padding:4px;
    background-color: var(--ft-blue);
    color:white;
}

table._ft thead tr{
    height:38px;
}

table._ft tbody td{
    padding:4px;
}

table._ft tbody tr:nth-child(odd){
    background-color: rgba(0,0,0,0.2);
}

/*... FILTERABLE .................*/
th ._ft-th-cont{
    position: relative;
    display: grid;
    place-content: center start;
    gap: 4px;
}

th ._ft-th-cont._ft-th-filterable,
th ._ft-th-cont._ft-th-sortable{
    grid-template-columns: 1fr 24px;
}

th ._ft-th-cont._ft-th-filterable._ft-th-sortable{
    grid-template-columns: 1fr 24px 24px;
}

th ._ft-th-label{ width : 100% }


th ._ft-filter-toggle,
th ._ft-sort-toggle {
    display: flex;
    padding: 0;
    
    height: 22px;
    width: 22px;

    background: transparent;
    opacity:0.5;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

th ._ft-filter-toggle.filtered,
th ._ft-sort-toggle.sorted { 
    background-color: white; 
    opacity:1; 
}
th ._ft-filter-toggle.filtered svg,
th ._ft-sort-toggle.sorted svg{
    fill : var(--ft-blue); 
}

th ._ft-filter-toggle.active{ background-color: var(--ft-gold); opacity:1;}
th ._ft-filter-toggle.active svg{ fill : var(--ft-blue);}



th ._ft-filter-box{
    display: none;
    position: absolute;
    background: #f1f1f1;
    color: black;
    border: 1px solid var(--ft-blue);
    padding: 8px;
    top: 36px;
    width: auto;
    min-width: 200px;
    box-shadow: 0 4px 5px 0 rgba(0,0,0,0.14), 0 1px 10px 0 rgba(0,0,0,0.12), 0 2px 4px -1px rgba(0,0,0,0.20);
    z-index: 1;

    max-height: 400px;
    overflow-y:auto;
}

th:last-child ._ft-filter-box,
th ._filter-box.right{
    right : 0
}

th:not(:last-child) ._ft-filter-box,
th ._filter-box.right{
    left : 0
}

th ._ft-filter-checkboxes{
    background: white;
    border: 1px solid #a3a3a3;
    padding: 8px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px;
}

th ._ft-filter-checkboxes input{cursor:pointer;}
th ._ft-filter-checkboxes span{margin:auto 0; cursor: pointer;}

th ._ft-filter-button-cont{
    display: flex;
    flex-direction: column;
    gap:4px;
    margin-top:4px;
}

th ._ft-filter-button{
    background-color: transparent;
    border: 1px solid var(--ft-blue);
    color: var(--ft-blue);
    width: 100%;
    cursor: pointer;
}

th ._ft-filter-button.span-2{
    grid-column: span 2;
}

th ._ft-flip-y{
    transform : scaleY(-1);
}

/*------------ HOVER  ------------*/
@media (hover: hover) and (pointer: fine) {
    /*Protect against click-hover on touch devices;*/

    th ._ft-filter-toggle:hover, th ._ft-sort-toggle:hover{ background-color: rgba(0,0,0,0.5); }
    th ._ft-filter-toggle.filtered:hover, th ._ft-sort-toggle.sorted:hover{ background-color: rgba(255,255,255,0.8); }
    th ._ft-filter-toggle.active:hover{ background-color: #d09732; }
    th ._ft-filter-button:hover{ background-color:rgba(39,59,95,0.2); }
    ._ft-button:hover{ background-color:#005081; }
}
