﻿/* =========================================
   SaxElectric.BMS — Table System (Reusable)
   File: wwwroot/css/table.css

   Use these classes:
   - .sax-table-card    -> card wrapper around table + optional pagers
   - .sax-pager         -> pager bar wrapper (top/bottom)
   - .sax-table-head    -> put on THEAD for sticky premium header
   - .sax-zebra         -> put on TABLE for zebra striping
   - .sax-row-hover-nav -> put on TABLE for nav-style gradient hover
   - .sax-btn-row       -> for buttons inside rows (View/Edit)
   - .sax-search        -> wrapper for search forms (optional)
   - .sax-legend        -> wrapper for legend boxes (optional)
   - .sax-chipbox       -> chips-inside-textbox wrapper (contenteditable)
   - .sax-chip          -> chip pill
========================================= */


/* =============================
   CARD WRAPPER
============================= */

.sax-table-card {
    border: 1px solid rgba(15,23,42,.10);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(2,6,23,.10);
    background: #fff;
}

    /* keep table tight in card */
    .sax-table-card table.table {
        margin-bottom: 0;
    }

        /* Beat Bootstrap table cell rule */
        .sax-table-card table.table > :not(caption) > * > * {
            padding: 14px 14px;
            border-color: rgba(15,23,42,.06);
            vertical-align: middle;
        }

        /* Clean header seam */
        .sax-table-card table.table thead th {
            border-top: 0 !important;
        }

    /* Square off sticky header corners inside rounded cards */
    .sax-table-card thead th:first-child {
        border-top-left-radius: 0 !important;
    }

    .sax-table-card thead th:last-child {
        border-top-right-radius: 0 !important;
    }


/* =============================
   PAGER
============================= */

.sax-pager {
    background: transparent;
    border-bottom: 1px solid rgba(15,23,42,.08);
    padding: 8px 0;
}

.sax-table-card .sax-pager:last-child {
    border-bottom: none;
    border-top: 1px solid rgba(15,23,42,.08);
}

/* pager buttons */
.sax-pager .pagination {
    gap: 8px;
}

.sax-pager .page-link {
    border: none !important;
    background: transparent !important;
    color: rgba(15,23,42,.75) !important;
    width: 36px;
    height: 36px;
    border-radius: 999px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.95rem;
    transition: transform .12s ease, background-color .12s ease, box-shadow .12s ease, color .12s ease;
}

    .sax-pager .page-link:hover {
        background: rgba(29,78,216,.10) !important;
        color: #1d4ed8 !important;
        transform: translateY(-1px);
    }

.sax-pager .page-item.active .page-link {
    background: #1d4ed8 !important;
    color: #fff !important;
    box-shadow: 0 8px 18px rgba(29,78,216,.25);
}


/* =============================
   STICKY HEADER
============================= */

.sax-table-head th {
    position: sticky;
    top: 0;
    z-index: 50;
    background: linear-gradient(180deg, #ffffff 0%, #eef3ff 100%);
    border-bottom: 1px solid rgba(15,23,42,.16);
    font-weight: 900;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: .10em;
    color: rgba(15,23,42,.78);
    padding: 14px 14px;
    box-shadow: 0 12px 22px rgba(2,6,23,.09);
}

/* WorkOrders: dark divider under header row */
.wo-table-head th {
    border-bottom: 2px solid rgba(0,0,0,.85) !important;
}


/* =============================
   ZEBRA STRIPING (opt-in)
============================= */

table.sax-zebra tbody tr:nth-child(odd) {
    background: rgba(255,255,255,0.92);
}

table.sax-zebra tbody tr:nth-child(even) {
    background: rgba(29,78,216,0.085);
}


/* =============================
   ROW HOVER (NAV STYLE) (opt-in)
============================= */

table.sax-row-hover-nav tbody tr {
    transition: transform .12s ease, box-shadow .12s ease;
}

    table.sax-row-hover-nav tbody tr:hover {
        transform: translateY(-1px);
        box-shadow: 0 12px 26px rgba(2,6,23,.12);
        background: linear-gradient(90deg, #1d4ed8, #06b6d4) !important;
    }

        table.sax-row-hover-nav tbody tr:hover > * {
            background: transparent !important;
            color: #fff !important;
        }

        table.sax-row-hover-nav tbody tr:hover a {
            color: #fff !important;
        }


/* =============================
   BUTTONS IN TABLE ROWS
============================= */

.sax-btn-row.btn,
.sax-table-card .btn.btn-outline-primary {
    border-radius: 999px;
    padding: 6px 14px;
    font-weight: 800;
}

/* Keep buttons readable on row hover gradient */
table.sax-row-hover-nav tbody tr:hover .btn.btn-outline-primary,
table.sax-row-hover-nav tbody tr:hover .sax-btn-row.btn {
    background: rgba(255,255,255,.95) !important;
    border-color: rgba(255,255,255,.95) !important;
    color: #0b2d6d !important;
}

/* Other outline buttons inside tables */
.sax-table-card .btn.btn-outline-secondary,
.sax-table-card .btn.btn-outline-danger,
.sax-table-card .btn.btn-outline-warning,
.sax-table-card .btn.btn-outline-success {
    border-radius: 999px;
    padding: 6px 14px;
    font-weight: 800;
}

table.sax-row-hover-nav tbody tr:hover .btn.btn-outline-secondary,
table.sax-row-hover-nav tbody tr:hover .btn.btn-outline-danger,
table.sax-row-hover-nav tbody tr:hover .btn.btn-outline-warning,
table.sax-row-hover-nav tbody tr:hover .btn.btn-outline-success {
    background: rgba(255,255,255,.95) !important;
    border-color: rgba(255,255,255,.95) !important;
}

table.sax-row-hover-nav tbody tr:hover .btn.btn-outline-secondary {
    color: #0f172a !important;
}

table.sax-row-hover-nav tbody tr:hover .btn.btn-outline-danger {
    color: #7f1d1d !important;
}

table.sax-row-hover-nav tbody tr:hover .btn.btn-outline-warning {
    color: #7c2d12 !important;
}

table.sax-row-hover-nav tbody tr:hover .btn.btn-outline-success {
    color: #14532d !important;
}

.sax-table-card .btn.btn-outline-secondary:hover,
.sax-table-card .btn.btn-outline-danger:hover,
.sax-table-card .btn.btn-outline-warning:hover,
.sax-table-card .btn.btn-outline-success:hover {
    transform: translateY(-1px);
}


/* =============================
   SEARCH HELPERS
============================= */

/* Make search feel flatter (less boxed) */
.sax-search .form-control {
    border-radius: 12px;
    border: 1px solid rgba(15,23,42,.14);
    box-shadow: none;
}

.sax-search .btn {
    border-radius: 12px;
    font-weight: 800;
}


/* =============================
   LEGEND
============================= */

.sax-legend,
.sax-legend * {
    color: rgba(15,23,42,.85) !important;
}

    .sax-legend .legend-key,
    .sax-legend .legend-key-inline {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 6px 10px;
        border-radius: 999px;
        border: 1px solid rgba(29,78,216,.18);
        background: rgba(29,78,216,.08);
        font-weight: 900;
        text-decoration: none !important;
        cursor: pointer;
    }

        .sax-legend .legend-key:hover,
        .sax-legend .legend-key-inline:hover {
            background: rgba(29,78,216,.14);
        }


/* =============================
   CHIPBOX (chips inside textbox)
============================= */

.sax-chipbox {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .45rem;
    min-height: 44px;
    padding: 6px 10px;
    border-radius: 12px;
    border: 1px solid rgba(15,23,42,.14);
    background: #fff;
}

    .sax-chipbox:focus-within {
        box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
    }

/* contenteditable editor (text + chips inline) */
.sax-chipbox-editor {
    flex: 1 1 auto;
    min-height: 34px;
    outline: none;
    border: 0;
    background: transparent;
    padding: 6px 4px;
    line-height: 1.35;
    white-space: pre-wrap;
    word-break: break-word;
}

    /* placeholder inside contenteditable */
    .sax-chipbox-editor.is-empty:before {
        content: attr(data-placeholder);
        color: rgba(15,23,42,.45);
        font-weight: 700;
    }


/* =============================
   CHIP PILL
============================= */

.sax-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .32rem .7rem;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--nav-a), var(--nav-b));
    color: #fff !important;
    font-weight: 900;
    font-size: .78rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    box-shadow: 0 10px 18px rgba(2,6,23,.18);
    user-select: none;
}

    .sax-chip .sax-chip-x {
        position: absolute;
        top: -6px;
        right: -6px;
        width: 18px;
        height: 18px;
        border-radius: 999px;
        border: 2px solid #fff;
        background: var(--nav-c);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 900;
        line-height: 1;
        cursor: pointer;
        padding: 0;
    }

        .sax-chip .sax-chip-x:hover {
            filter: brightness(0.95);
            transform: translateY(-1px);
        }
