﻿
.project-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
    width: 100%;
    table-layout: fixed;
}

    .project-table th {
        background-color: #f1f5f9;
        color: #475569;
        font-weight: 600;
        padding: 14px 6px;
        border-bottom: 2px solid #e2e8f0;
        position: sticky;
        top: 0;
        width: 150px;
        max-width: 150px;
        z-index: 500;
    }

    .project-table td {
        padding: 14px 6px;
        border-bottom: 1px solid #e2e8f0;
        color: #334155;
        vertical-align: middle;
        /*background-color: white !important;*/
        width: 150px;
        max-width: 150px;
        white-space: nowrap; /* Prevents text from wrapping to a 2nd line */
        overflow: hidden; /* Hides any text that overflows the fixed width */
        text-overflow: ellipsis;
    }

    .project-table tr:hover {
        /*background-color: #f8fafc ;*/
    }

    /* Column 1: Starts at 0px */
    .project-table th:nth-child(1),
    .project-table td:nth-child(1) {
        position: sticky;
        left: 0;
        width: 45px;
        min-width: 45px;
        max-width: 45px;
        z-index: 10;
        padding: 0px;
        margin: 0px;
        /*padding-right:50px;*/
    }

    /* Column 2: Starts at Width of Col 1 (120px) */
    .project-table th:nth-child(2),
    .project-table td:nth-child(2) {
        /*background-color: inherit;*/
        position: sticky;
        left: 45px;
        width: 50px;
        min-width: 50px;
        max-width: 50px;
        z-index: 1;
        padding-left: 10px;
    }

    /* Column 3: Starts at Width of Col 1 + Col 2 (240px) */
    .project-table th:nth-child(3),
    .project-table td:nth-child(3) {
        /*background-color: inherit;*/
        position: sticky;
        left: 95px;
        width: 60px;
        min-width: 60px;
        max-width: 60px;
        /*box-shadow: inset -2px 0 0 0 #e2e8f0;*/
        /*box-shadow: 6px 0 10px -3px rgba(0, 0, 0, 0.15);*/
        z-index: 11;
        /*box-shadow: inset -1px 0 0 0 #cbd5e1;*/
    }

    /* Column 3: Starts at Width of Col 1 + Col 2 (240px) */
    .project-table th:nth-child(4),
    .project-table td:nth-child(4) {
        /*background-color: inherit;*/
        position: sticky;
        left: 155px;
        width: 200px;
        min-width: 200px;
        max-width: 200px;
        box-shadow: inset -2px 0 0 0 #e2e8f0;
        box-shadow: 6px 0 10px -3px rgba(0, 0, 0, 0.15);
        z-index: 11;
        box-shadow: inset -1px 0 0 0 #cbd5e1;
    }

    .project-table td:nth-child(1),
    .project-table td:nth-child(2),
    .project-table td:nth-child(3),
    .project-table td:nth-child(4) {
        background-color: inherit;
    }

    /* Header intersections (where top-sticky meets left-sticky) need a higher z-index */
    .project-table th:nth-child(1),
    .project-table th:nth-child(2),
    .project-table th:nth-child(3),
    .project-table th:nth-child(4) {
        z-index: 900;
        top: 0px;
    }


.bom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
    width: 100%;
    table-layout: fixed;
}

    .bom-table th {
        background-color: #f1f5f9;
        color: #475569;
        font-weight: 600;
        padding: 14px 6px;
        border-bottom: 2px solid #e2e8f0;
        position: sticky;
        top: 0;
        width: 150px;
        max-width: 150px;
        z-index: 500;
    }

    .bom-table td {
        padding: 14px 6px;
        border-bottom: 1px solid #e2e8f0;
        color: #334155;
        vertical-align: middle;
        /*background-color: white !important;*/
        width: 150px;
        max-width: 150px;
        white-space: nowrap; /* Prevents text from wrapping to a 2nd line */
        overflow: hidden; /* Hides any text that overflows the fixed width */
        text-overflow: ellipsis;
    }

    .bom-table tr:hover {
        /*background-color: #f8fafc ;*/
    }


    /* Column 3: Starts at Width of Col 1 + Col 2 (240px) */
    .bom-table th:nth-child(1),
    .bom-table td:nth-child(1) {
        /*background-color: inherit;*/
        position: sticky;
        left: 0;
        width: 60px;
        min-width: 60px;
        max-width: 60px;
        /*box-shadow: inset -2px 0 0 0 #e2e8f0;*/
        /*box-shadow: 6px 0 10px -3px rgba(0, 0, 0, 0.15);*/
        z-index: 11;
        /*box-shadow: inset -1px 0 0 0 #cbd5e1;*/
    }

    /* Column 3: Starts at Width of Col 1 + Col 2 (240px) */
    .bom-table th:nth-child(2),
    .bom-table td:nth-child(2) {
        /*background-color: inherit;*/
        position: sticky;
        left: 60px;
        width: 200px;
        min-width: 200px;
        max-width: 200px;
        box-shadow: inset -2px 0 0 0 #e2e8f0;
        box-shadow: 6px 0 10px -3px rgba(0, 0, 0, 0.15);
        z-index: 11;
        box-shadow: inset -1px 0 0 0 #cbd5e1;
    }

    .bom-table td:nth-child(1),
    .bom-table td:nth-child(2){
        background-color: inherit;
    }

    /* Header intersections (where top-sticky meets left-sticky) need a higher z-index */
    .bom-table th:nth-child(1),
    .bom-table th:nth-child(2) {
        z-index: 900;
        top: 0px;
    }


/* Main Container Changes for Light Theme (Anchored Right) */
.editor-container.light-theme {
    position: fixed;
    top: 70px;
    right: 0;
    bottom: 40px;
    display: flex;
    flex-direction: row-reverse;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    background: #ffffff;
    border-left: 1px solid #e0e0e0;
    color: #333333;
    /* Left-casting drop shadow matching your manager panel depth */
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2), 1px 0 4px rgba(0, 0, 0, 0.2);
}

.editor-container.collapsed {
    transform: translateX(400px);
}

.editor-container.open {
    transform: translateX(0);
}

/* Floating Tab Attached to Left Edge of the Editor Panel */
.editor-toggle {
    position: absolute;
    left: -40px;
    top: 20px;
    width: 40px;
    height: 160px;
    background: #007acc;
    border: none;
    color: white;
    border-radius: 8px 0 0 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    box-shadow: -5px 2px 14px rgba(0, 0, 0, 0.12);
}

.vertical-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 1px;
    margin-top: -10px;
}

.editor-content {
    width: 400px;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #ffffff;
}

.editor-header {
    padding: 10px;
    border-bottom: 1px solid #e0e0e0;
    background: #ffffff;
}

    .editor-header h3 {
        margin: 0 0 0px 0;
        font-size: 1.275rem;
        font-weight: 600;
        color: #111111;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

.product-id-sub {
    font-size: 0.75rem;
    color: #007acc;
    font-weight: 600;
}

.editor-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 20px;
    padding: 0px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 0px;
    overflow-y:scroll;
}

    /* --- Global Child Content Form Styles ---
               These target form tags you pass inside your @ChildContent blocks
    */
    .editor-body .form-group {
        display: flex;
        flex-direction: column;
        gap: 0px;
        width: 100%;
    }

    .editor-body .form-row {
        display: flex;
        gap: 0px;
        width: 100%;
    }

    .editor-body .col {
        flex: 1;
    }

    .editor-body label {
        font-size: 0.75rem;
        color: #666666;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .editor-body input,
    .editor-body textarea,
    .editor-body select {
        background: #f8f9fa;
        border: 1px solid #cccccc;
        border-radius: 4px;
        padding: 8px 10px;
        color: #333333;
        font-size: 0.85rem;
        width: 100%;
        box-sizing: border-box;
        transition: border-color 0.15s, background-color 0.15s;
    }

        .editor-body input:focus,
        .editor-body textarea:focus,
        .editor-body select:focus {
            border-color: #007acc;
            background: #ffffff;
            outline: none;
            box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.15);
        }

    /* System Read-Only Content Boxes */
    .editor-body .static-value {
        padding: 8px 10px;
        background: #f1f3f5;
        border: 1px solid #e9ecef;
        border-radius: 4px;
        font-size: 0.8rem;
        color: #495057;
        font-family: monospace;
    }

/* Footer & Actions Area */
.editor-footer {
    padding: 16px 20px;
    border-top: 1px solid #e0e0e0;
    background: #ffffff;
}

.btn-primary {
    width: 100%;
    background: #007acc;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s;
}

    .btn-primary:hover {
        background: #0062a3;
    }

/* Fallback State styling when no dataset is assigned */
.no-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px;
    text-align: center;
    color: #777777;
    gap: 12px;
}

    .no-selection i {
        font-size: 2rem;
        color: #cccccc;
        6c
    }

    .no-selection p {
        font-size: 0.85rem;
        margin: 0;
    }

.flyout-container.light-theme {
    position: fixed;
    top: 70px;
    left: 0;
    bottom: 40px;
    display: flex;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    background: #ffffff;
    border-right: 1px solid #e0e0e0;
    color: #333333;
    /* UPDATED: Multi-tiered right-casting drop shadow.
               Uses a soft blur layout so it works perfectly over light/white work areas
            */
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2), 1px 0 4px rgba(0, 0, 0, 0.2);
}

.flyout-container.collapsed {
    transform: translateX(-320px);
}

.flyout-container.open {
    transform: translateX(0);
}

.flyout-toggle {
    position: absolute;
    right: -40px;
    top: 20px;
    width: 40px;
    height: 160px;
    background: #007acc;
    border: none;
    color: white;
    border-radius: 0 8px 8px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    /* UPDATED: Matches the drop-shadow depth profile of the main wrapper */
    box-shadow: 5px 2px 14px rgba(0, 0, 0, 0.12);
}

.vertical-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 1px;
    margin-top: -10px;
}

.flyout-content {
    width: 320px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.flyout-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #ffffff;
}

    .flyout-header h3 {
        margin: 0 0 12px 0;
        font-size: 1.1rem;
        font-weight: 600;
        color: #111111;
    }

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

    .search-box i {
        position: absolute;
        left: 10px;
        color: #777777;
    }

    .search-box input {
        width: 100%;
        padding: 8px 12px 8px 32px;
        background: #f8f9fa;
        border: 1px solid #cccccc;
        border-radius: 4px;
        color: #333333;
        font-size: 0.85rem;
    }

        .search-box input:focus {
            border-color: #007acc;
            background: #ffffff;
            outline: none;
            box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.15);
        }

.flyout-body {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
    background: #ffffff;
}

.product-group {
    margin-bottom: 2px;
}

.group-header {
    display: flex;
    align-items: center;
    padding: 10px 5px;
    padding-right: 10px;
    background: #f5f5f7;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid #e5e5e5;
}

    .group-header:hover {
        background: #eaeaea;
    }

.header-icon-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 10px;
    min-width: 32px;
}

    .header-icon-wrapper i {
        font-size: 0.8rem;
        color: #555555;
    }

.toggle-indicator {
    font-family: monospace;
    font-size: 0.85rem;
    color: #007acc;
    font-weight: bold;
}

.group-title {
    font-weight: 500;
    font-size: 0.85rem;
    color: #333333;
    font-size: 0.9375rem;
}

.group-count {
    margin-left: auto;
    background: #dddddd;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.75rem;
    color: #444444;
    font-weight: 500;
}

.group-add {
    width:50px;
    /*margin-left: auto;*/
    background: #dddddd;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.75rem;
    color: #444444;
    font-weight: 500;
}

.product-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background: #ffffff;
}

    .product-list.nested-indent .product-item {
        padding-left: 44px;
        border-left: 2px solid #e8e8e8;
    }

.product-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px 12px 36px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

    .product-item:hover {
        background: #f1f7fc;
    }

    .product-item.active {
        background: #e1f0fa;
        border-left: 3px solid #007acc !important;
        padding-left: 43px;
    }

        .product-item.active .product-name {
            color: #005599;
            font-weight: 600;
        }

.product-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.product-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: #222222;
}

.product-desc {
    font-size: 0.75rem;
    color: #666666;
    height: 10px;
    font-style: italic;
}

.status-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

    .status-badge.quote {
        background: #fff3cd;
        color: #856404;
        border: 1px solid #ffeeba;
    }

    .status-badge.won {
        background: #d4edda;
        color: #155724;
        border: 1px solid #c3e6cb;
    }

.no-results {
    padding: 20px;
    text-align: center;
    color: #777777;
    font-size: 0.85rem;
}


/* Container for the unified field list layout */
.editor-dynamic-properties {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

/* Base structural panel behind the header elements */
.section-fields-container {
    padding: 8px 0;
    background: #ffffff;
}

    /* Indentation tracking line aligning exactly with your manager panel trees */
    .section-fields-container.nested-indent {
        padding-left: 20px;
        border-left: 2px solid #e8e8e8;
        margin-left: 14px;
        margin-top: 4px;
        margin-bottom: 8px;
    }

/* NEW: The crisp card layout wrapping all inline UIFieldGroups */
.fields-card-wrapper {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 16px;
    margin-right: 14px; /* Matches layout boundaries */
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

/* Operational Spacer Rules */
.spacer-large {
    width: 100%;
    height: 10px;
}

.spacer-small {
    width: 100%;
    height: 8px;
}

.section-divider {
    width: 100%;
    height: 1px;
    background-color: #e0e0e0;
    margin: 8px 0;
}

/* Formatting for Inline Form Section Headings inside cards */
.form-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #007acc;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 6px;
    margin-bottom: 2px;
}

/* Output calculation values alignment styling override */
.text-output {
    font-weight: 600 !important;
    background: #f8f9fa !important;
    border-color: #e9ecef !important;
}


/* Update your field layout wrapper to look like this */
.fields-card-wrapper {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 16px;
    margin-right: 14px;
    /* Change this to allow left-to-right flow with wrapping */
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap:0px 20px; /* Gives spacing between adjacent inputs */
    margin:0px;
    padding:0px;
    padding-left:10px;
}

    /* Ensure individual form items don't hog 100% width unless forced */
    .fields-card-wrapper .form-group {
        display: flex;
        flex-direction: column;
        gap: 6px;
        /* Allow them to grow, but give them a flexible base width */
        flex: 1 1 120px; /* grow | shrink | basis (minimum width before wrapping) */
        min-width: 120px;
    }


.fields-card-wrapper {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 16px;
    margin-right: 14px;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 16px;
    /* NEW: Centers items horizontally on the current line.
       When fields wrap to a new row, that row is also centered independently. */
    justify-content: center;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    /* ADJUSTED: Change flex-grow from 1 to 0. 
       If flex-grow is 1, the inputs stretch to fill 100% of the row width, 
       which makes "centering" impossible because they take up all available space anyway.
       Setting it to 0 keeps them at their native size or flex-basis, allowing them to pool in the center. */
    flex: 0 1 130px;
    min-width: 110px;
    box-sizing: border-box;
}

.field-group-small {
    flex: 0 1 110px;
    min-width: 90px;
}

/* Keep structural title rows breaking completely across the card */
.field-group[style*="width: 100%"] {
    flex: 1 0 100% !important;
}

/* Centered Section Subheader Typography */
.field-group-title.centered-header {
    font-size: 0.8rem;
    font-weight: 700;
    color: white; /* Matches your premium operational blue theme color */
    text-transform: uppercase;
    letter-spacing: 1.2px; /* Clean micro-spacing for industrial readability */
    text-align: center;
    width: 100%;
    display: block;
    padding: 6px 0;
    margin: 0 auto;
    border-bottom: none; /* Removed the line underneath to clean up split spacing */
}

/* Base fields placement within the centered wrapping structure */
.fields-card-wrapper {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 16px;
    margin-right: 14px;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0px 16px;
    justify-content: center;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 0 1 130px;
    min-width: 110px;
    box-sizing: border-box;
    margin-bottom:15px;
}

    /* Keeps labels left-aligned above inputs even when wrapped layout centers the cards */
    .field-group label {
        font-size: 0.75rem;;
        color: #666666;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        text-align: center;
        height:25px;
        align-content:end;
    }


/* Container pushing actions and counts to the right wall */
.group-header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px; /* Spacing between the ADD button and the count bubble */
}

/* Premium Light-Theme Add Micro-Button styling */
.btn-group-add {
    background: transparent;
    border: 1px solid #007acc;
    color: #007acc;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s ease-in-out;
}

    .btn-group-add:hover {
        background: #007acc;
        color: #ffffff;
        box-shadow: 0 2px 6px rgba(0, 122, 204, 0.2);
    }

    .btn-group-add i {
        font-size: 0.75rem;
        font-weight: bold;
    }

/* Ensure the count bubble alignment feels structurally balanced */
.group-count {
    background: #dddddd;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.75rem;
    color: #444444;
    font-weight: 500;
    min-width: 20px;
    text-align: center;
}

.popup-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
    width: 100%;
}

    .popup-form-group:last-child {
        margin-bottom: 0;
    }

    .popup-form-group label {
        font-size: 0.75rem;
        color: #666666;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        text-align: left;
    }

    .popup-form-group input,
    .popup-form-group textarea {
        width: 100%;
        padding: 10px 12px;
        background: #f8f9fa;
        border: 1px solid #cccccc;
        border-radius: 4px;
        color: #333333;
        font-size: 0.9rem;
        box-sizing: border-box;
        transition: border-color 0.15s, background-color 0.15s;
    }

        .popup-form-group input:focus,
        .popup-form-group textarea:focus {
            border-color: #007acc;
            background: #ffffff;
            outline: none;
            box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.15);
        }