/* Custom styles for Rolo PLM */

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* Part number formatting */
.part-number {
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

/* Status badges */
.status-development {
    background-color: #ffc107;
}

.status-released {
    background-color: #28a745;
}

/* BoM table styling */
.bom-table {
    font-size: 0.9rem;
}

.bom-table th {
    background-color: #f8f9fa;
    position: sticky;
    top: 0;
}

/* BoM table: single-line rows with horizontal scroll */
#subBomTable td,
#subBomTable th {
    white-space: nowrap;
}

/* Truncate long text columns (Manufacturer, MPN, Supplier) */
#subBomTable td.truncate-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── Sticky (frozen) columns: columns up to Part stay visible on horizontal scroll ─── */
#subBomTable .sticky-col {
    position: sticky;
    z-index: 2;
    background-color: #fff;
}

/* thead sticky columns need higher z-index (sticky in both axes) */
#subBomTable thead .sticky-col {
    z-index: 4;
    background-color: #f8f9fa;
}

/* Child sub header rows — inherit the row's depth-based background color */
#subBomTable .child-sub-header .sticky-col {
    z-index: 3;
    background: inherit;
}

/* ── Editable mode: Drag(24) + Bracket(16) + Checkbox(30) + Type(60) + Part(natural) ── */
.sticky-col.sticky-drag    { left: 0;     width: 24px;  min-width: 24px;  }
.sticky-col.sticky-bracket { left: 24px;  width: 16px;  min-width: 16px;  }
.sticky-col.sticky-checkbox{ left: 40px;  width: 30px;  min-width: 30px;  }
.sticky-col.sticky-type    { left: 70px;  width: 60px;  min-width: 60px;  }
.sticky-col.sticky-part    { left: 130px; }

/* ── Read-only mode: no Drag/Bracket/Checkbox columns, so Type starts at 0 ── */
#subBomTable:not(.bom-editable-table) .sticky-col.sticky-type { left: 0;     }
#subBomTable:not(.bom-editable-table) .sticky-col.sticky-part { left: 60px;  }

/* Opaque hover background on sticky cells (transparent would let scrolled content bleed through) */
#subBomTable tbody tr:hover .sticky-col {
    background-color: #ededed;
}

/* tfoot sticky cells */
#subBomTable tfoot .sticky-col {
    background-color: #fff;
    z-index: 2;
}

/* Right shadow on the last frozen column to visually separate frozen/scrollable areas */
.sticky-col.sticky-part {
    border-right: 2px solid #dee2e6;
}

/* File upload warning */
.soft-lock-warning {
    border-left: 4px solid #ffc107;
    padding-left: 1rem;
}

/* Subassembly hierarchy indication */
.subassembly-indent-1 {
    padding-left: 1.5rem;
}

.subassembly-indent-2 {
    padding-left: 3rem;
}

.subassembly-indent-3 {
    padding-left: 4.5rem;
}

/* Cost summary styling */
.cost-summary {
    background-color: #e9ecef;
    border-radius: 0.5rem;
    padding: 1rem;
}

.cost-total {
    font-size: 1.5rem;
    font-weight: bold;
}

/* Global search — allow dropdown to overflow navbar */
.navbar,
.navbar .container-fluid,
.navbar .navbar-collapse {
    overflow: visible !important;
}

#globalSearchWrapper {
    position: relative;
    z-index: 1050;
}

/* Global search dropdown */
.search-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 360px;
    max-height: 400px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    z-index: 1055;
    margin-top: 4px;
}

.search-dropdown-category {
    padding: 0.35rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #6c757d;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    letter-spacing: 0.03em;
}

.search-dropdown-item {
    display: block;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    color: #212529;
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-dropdown-item:hover,
.search-dropdown-item:focus {
    background: #e9ecef;
    color: #000;
    text-decoration: none;
}

.search-dropdown-hw {
    cursor: default;
    color: #495057;
}

.search-dropdown-hw:hover {
    background: #f8f9fa;
}

.search-dropdown-empty {
    padding: 0.75rem;
    font-size: 0.85rem;
    color: #6c757d;
    text-align: center;
}

.search-dropdown-viewall {
    display: block;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    text-align: center;
    color: #0d6efd;
    text-decoration: none;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.search-dropdown-viewall:hover {
    background: #e9ecef;
    text-decoration: underline;
}
