﻿/* ==========================================================================
   Request Component Styles
   ========================================================================== */

/* Container & Layout
   ========================================================================== */

.request-container {
    border-radius: 5px;
    margin-top: 5px;
    width: 100%;
    position: relative;
    overflow: auto;
}

.request-panel {
    border: 1px solid black !important;
    width: fit-content !important;
    margin: 0 auto !important;
    max-width: 100vw;
}

@media (max-width: 1024px) {
    .request-panel {
        margin: 0;
    }
}

.request-section {
    border: 1px solid black;
    border-radius: 5px;
    width: 100%;
    padding: 10px;
}

/* Admin & Detail Component Styles
   ========================================================================== */

.admin-container {
    overflow: visible;
}

.admin-instructions-table {
    width: 100%;
}

.admin-instructions-cell {
    align: center;
    valign: bottom;
    width: 100%;
    margin: 0;
    padding: 0;
}

.admin-instructions-text {
    color: black;
    font-weight: 350;
}

.admin-instructions-button-text {
    color: black;
    font-weight: 325;
}

.admin-grid-wrapper {
    width: 100%;
    max-width: 100vw;
    height: calc(100vh - 150px);
    overflow: auto;
    position: relative;
}

.admin-data-grid-wrapper {
    display: inline-block; /* allows shrink-to-fit */
    max-width: 100%; /* prevents expanding past viewport */
    max-height: calc(100vh - 100px) !important;
    overflow: auto;
    border: 1px solid lightgrey;
    border-radius: 6px;
    padding: 0px !important; /* <— this fixes the clipping */
}

.view-data-grid-wrapper {
    display: inline-block; /* allows shrink-to-fit */
    max-width: 100%; /* prevents expanding past viewport */
    max-height: calc(100vh - 59px) !important;
    overflow: auto;
    border: 1px solid lightgrey;
    border-radius: 6px;
    padding: 0px !important; /* <— this fixes the clipping */
}

.detail-group-grid-wrapper {
    display: inline-block; /* allows shrink-to-fit */
    max-width: 100%; /* prevents expanding past viewport */
    height: 156px;
    overflow: auto;
    display: inline-block;
    border: 1px solid lightgrey;
    border-radius: 6px;
    padding: 0px; /* <— this fixes the clipping */
    background: white; /* optional: prevents scrollbars from covering border */
}

.detail-data-grid-wrapper {
    display: inline-block; /* allows shrink-to-fit */
    max-width: 100%; /* prevents expanding past viewport */
    max-height: calc(100vh - 255px);
    overflow: auto;
    border: 1px solid lightgrey;
    border-radius: 6px;
    padding: 0px; /* <— this fixes the clipping */
}

.detail-group-grid-row:hover td {
    background-color: #e6f2ff;
    cursor: pointer;
}

/* Persisted selection */
.detail-group-grid-row.selected td {
    background-color: #fff4cc;
}

.request-page-footer {
    position: sticky;
    bottom: -2px;
    background: white; /* important: sticky items must have a background */
    z-index: 10; /* so it stays above the rows */
    border: none !important;
}

.request-page-footer-cell {
    width: 34%;
    font-weight: 600;
    font-size: 10pt;
    border: none !important;
}

.request-empty-message {
    font-weight: 600;
    font-size: 10pt;
    text-align: center !important;
}

.detail-group-panel {
    padding-top: 5px;
}

.detail-group-table {
    background: white;
    border: 1px solid #ddd;
    width: 728px;
}

.detail-group-table-row {
    border: 1px solid #ddd;
}

.detail-group-table-header {
    width: 70px;
    font-weight: bold;
}

.detail-group-input {
    height: 32px;
    width: 100%;
    border-radius: 4px;
}

.detail-group-button-cell {
    width: 128px;
}

/* Validation tables (issues/summary) */
.scrollable-table {
    max-height: 260px;
    overflow-y: auto;
    overflow-x: auto;
}

/* Add spacing so validation table cell values don't run together */
#request-table-issues,
#request-table-summary {
    border-collapse: separate;
    border-spacing: 0;
}

    #request-table-issues th,
    #request-table-issues td,
    #request-table-summary th,
    #request-table-summary td {
        padding: 6px 10px;
    }

.detail-inline-edit-input {
    height: 32px;
    width: 150px;
    border-radius: 4px;
    border: 2px solid lightgrey;
}

.detail-checkbox-cell {
    margin-left: 55px;
}

.detail-bottom-spacer {
    width: 100%;
    height: 2px;
}

/* Section Table
   ========================================================================== */

.request-section-table {
    border-collapse: separate;
    border-spacing: 20px 0;
}

    .request-section-table thead {
        font-weight: bold;
        font-size: 20px;
    }

    .request-section-table input:disabled,
    .request-section-table textarea:disabled,
    .request-section-table select:disabled {
        color: black;
        background-color: #f5f5f5;
    }

/* Material Table
   ========================================================================== */

.request-material-table-container {
    max-height: calc(100vh - 295px) !important;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid lightgrey;
    border-radius: 4px;
    min-width: 256px !important;
    max-width: 100% !important;
    position: relative;
}

.request-material-table {
    min-width: 256px !important;
    max-width: 100% !important;
    width: 100%;
    border-collapse: collapse;
}

    .request-material-table thead {
        position: sticky;
        top: 0;
        background-color: white;
        z-index: 0;
    }

        .request-material-table thead th {
            border-bottom: 2px solid lightgrey;
        }

    .request-material-table tbody tr:nth-child(odd) {
        background-color: #D9E2F3;
    }

    .request-material-table tbody tr:nth-child(even) {
        background-color: #D9E2F3;
    }

    .request-material-table tbody tr:hover {
        background-color: #e6f7ff;
    }

    .request-material-table tfoot {
        position: sticky;
        bottom: 0;
        background: #fff;
        z-index: 0;
    }

        .request-material-table tfoot td {
            border-top: 2px solid lightgrey;
        }

/* Material Table Buttons & Icons
   ========================================================================== */

.request-material-table-button {
    border: 0;
    background-color: transparent;
    width: 50px;
    cursor: pointer;
}

.request-material-table-add-icon {
    font-size: 20px !important;
    color: green !important;
    font-style: normal !important;
}

.request-material-table-delete-icon {
    font-size: 20px !important;
    color: red !important;
    font-style: normal !important;
}

/* Summary Tables
   ========================================================================== */

.request-summary-material-table,
.request-summary-note-table {
    width: 100%;
}

    .request-summary-material-table thead,
    .request-summary-note-table thead {
        background-color: #B4C6E7;
    }

    .request-summary-material-table tbody tr:nth-child(odd),
    .request-summary-note-table tbody tr:nth-child(odd) {
        background-color: #D9E2F3;
    }

    .request-summary-material-table tbody tr:nth-child(even),
    .request-summary-note-table tbody tr:nth-child(even) {
        background-color: white;
    }

    .request-summary-material-table tbody tr:hover,
    .request-summary-note-table tbody tr:hover {
        background-color: #e6f7ff;
    }

/* Notes Table
   ========================================================================== */

.request-notes-table-wrapper {
    max-height: 160px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}

    .request-notes-table-wrapper thead th {
        position: sticky;
        top: 0;
        z-index: 0;
        background: #B4C6E7;
    }

    .request-notes-table-wrapper table tbody tr:nth-child(odd) {
        background-color: #ffffff;
    }

    .request-notes-table-wrapper table tbody tr:nth-child(even) {
        background-color: #D9E2F3;
    }

    .request-notes-table-wrapper table tbody tr:hover {
        background-color: #e6f7ff;
    }

/* Buttons
   ========================================================================== */

.request-button-container {
    display: flex;
    justify-content: space-between;
    padding: 5px;
    gap: 20px;
    width: 100%;
}

.request-button-cancel,
.request-button-submit,
.request-button-view {
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.request-button-cancel {
    background-color: #ffe5e5;
    color: #a00000;
    border: 1px solid #a00000;
}

.request-button-submit,
.request-button-view {
    background-color: #e6f2ff;
    color: #0066cc;
    border: 1px solid #0066cc;
}

    .request-button-cancel:disabled,
    .request-button-submit:disabled,
    .request-button-view:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

/* Form Controls
   ========================================================================== */

/* Input utility classes for common patterns */
.request-input {
    height: 32px;
    border-radius: 4px;
    border: 1px solid lightgrey;
    text-transform: none !important;
}

.request-input-sm {
    width: 146px;
}

.request-input-md {
    width: 200px;
}

.request-input-full {
    width: 100%;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

select:disabled,
textarea:disabled,
input:disabled {
    background-color: #f0f0f0;
    cursor: not-allowed;
}

/* Cells & States
   ========================================================================== */

.readonly-cell {
    text-align: left;
    width: 100%;
    height: 30px;
    line-height: 30px;
    background: #f5f5f5;
    border: 1px solid lightgrey;
    border-radius: 4px;
    white-space: nowrap;
    cursor: not-allowed;
    padding: 0 5px;
    font-family: sans-serif;
    font-size: 1rem;
    color: #000;
    font-weight: normal;
}

    .readonly-cell .material-symbols-outlined {
        vertical-align: middle;
        line-height: 1;
        font-size: 16px;
        margin-left: 6px;
        cursor: pointer;
    }

.selected-row {
    background-color: #e2f5e2 !important;
}

    .selected-row td,
    .selected-row td input,
    .selected-row td select,
    .selected-row td textarea {
        background-color: #e2f5e2 !important;
    }

        .selected-row td select:disabled,
        .selected-row td input:disabled {
            opacity: 0.85;
        }

.disabled-row {
    opacity: 0.6;
}

.disabled-section {
    opacity: 0.6;
    position: relative;
}

    .disabled-section::after {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(255, 255, 255, 0.1);
        cursor: not-allowed;
    }

/* Validation & Messages
   ========================================================================== */

.required-field {
    color: lightcoral;
    font-weight: bold;
}

.invalid-input {
    background-color: white;
}

.validation-message {
    color: lightcoral;
    font-size: 1rem;
    margin-top: 5px;
    margin-bottom: 5px;
    text-align: left;
    font-weight: bold;
    padding-left: 20px;
}

/* Filter Overlay
   ========================================================================== */

.column-filter-pop-overlay {
    position: fixed;
    z-index: 100000;
    background: #fff;
    padding: .6rem .8rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 4px 14px rgba(0,0,0,.25);
    min-width: 260px;
    width: auto;
    max-width: 420px;
    max-height: 420px;
    display: flex;
    flex-direction: column;
    gap: .55rem;
    font-size: .85rem;
}

/* Dialog Modal
   ========================================================================== */

.virtual-grid-product-dialog-modal {
    /* default dialog positioning (used by other dialogs) */
    top: 200px;
    left: 50%;
    max-height: calc(100vh - 200px);
    position: fixed;
    transform: translateX(-50%);
}

    .virtual-grid-product-dialog-modal.is-dragging {
        transform: none;
    }

.virtual-grid-draggable-header {
    cursor: move;
    user-select: none;
}

/* Note: Sort column highlighting requires inline style due to dynamic data-key values */

/* =====================================================================
   Request inputs & in-grid editing helpers
   ===================================================================== */

/* Material grid text input (used in Request grid) */
.request-material-input {
    text-transform: none !important;
    width: 100%;
    border-radius: 4px;
    height: 30px;
    padding: 5px;
    margin: 0;
    border: 1px solid lightgrey !important;
    font-size: 1rem;
    color: #000;
    font-weight: normal;
}

.row-error {
    background-color: #ffcccc;
}

/* Extra alignment for readonly display cells when used inside grid rows */
.readonly-cell {
    vertical-align: middle;
    white-space: nowrap;
}

:root {
    /* Stacking & theme */
    --combo-z: 99999; /* LAYERING: dropdown z-index default (higher = on top) */
    --combo-bg: #ffffff; /* COLORS: background for inputs/dropdown */
    --combo-border: lightgrey; /* COLORS: border color for inputs/dropdown */
    --combo-radius: 4px; /* SHAPE: border radius (rounded corners) */
    --combo-shadow: 0 8px 20px rgba(0,0,0,0.12); /* ELEVATION: dropdown shadow */
    --combo-text: black; /* COLORS: primary text color */
    --combo-muted: #6e6e6e; /* COLORS: muted/secondary text color */
    --combo-highlight: #0f62fe; /* COLORS: matched text & accent color */
    /* Readability / density */
    --combo-font: 400 16px/1.5 inherit;
    --combo-input-padding: 4px 14px; /* SIZE: input height & left/right padding */
    --combo-item-padding: 4px 14px; /* SIZE: row height & left/right padding */
    --combo-max-height: 415px; /* SIZE: max dropdown list height before scroll */
    --combo-max-width: 420px; /* SIZE: max width of inputs & dropdown */
}

/* ===========================
         Input (text box)
         =========================== */
.request-combo-input {
    font: var(--combo-font); /* SIZE/WEIGHT: font-size & line-height; boldness via font-weight if needed */
    padding: var(--combo-input-padding); /* SIZE: vertical height & horizontal padding */
    width: 100%; /* WIDTH: fill container width */
    max-width: var(--combo-max-width); /* WIDTH: cap maximum width */
    border: 1px solid var(--combo-border); /* BORDER: thickness & color */
    border-radius: var(--combo-radius); /* SHAPE: rounded corners */
    box-sizing: border-box; /* LAYOUT: includes padding/border in width/height */
    color: var(--combo-text); /* COLOR: text color */
    background: var(--combo-bg); /* COLOR: background color */
    outline: none; /* FOCUS: remove default outline (custom below) */
}

    .request-combo-input:focus {
        box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.2); /* FOCUS: glow thickness/color */
        border-color: #7fb0ff; /* FOCUS: border color when focused */
    }

/* ===========================
         Dropdown (singleton)
         =========================== */
.request-combo-dropdown {
    position: absolute; /* POSITION: anchored under input */
    z-index: var(--combo-z); /* LAYERING: stacking above UI */
    background: var(--combo-bg); /* COLOR: dropdown background */
    border: 1px solid var(--combo-border); /* BORDER: dropdown border */
    border-radius: var(--combo-radius); /* SHAPE: rounded corners */
    box-shadow: var(--combo-shadow); /* ELEVATION: drop shadow */
    padding: 6px 0; /* SPACING: vertical padding inside */
    margin-top: 6px; /* SPACING: gap below input */
    inline-size: max-content;
    max-height: var(--combo-max-height); /* SIZE: limit height, enable scrolling */
    overflow: auto; /* SCROLL: show scrollbar when needed */
    font: var(--combo-font); /* SIZE: inherit same font sizing */
    color: var(--combo-text); /* COLOR: text color inside dropdown */
    animation: request-combo-fade-in .06s ease-out; /* ANIMATION: quick fade-in */
}

@keyframes request-combo-fade-in {
    from {
        opacity: 0;
        transform: translateY(-2px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================
         Items (options)
         =========================== */
.request-combo-option {
    padding: var(--combo-item-padding); /* SIZE: row height & left/right padding */
    cursor: pointer; /* CURSOR: indicate clickable row */
    white-space: nowrap; /* LAYOUT: single-line rows */
    overflow: hidden; /* TRUNCATE: hide overflow text */
    text-overflow: ellipsis; /* TRUNCATE: show ellipsis … */
}

    .request-combo-option + .request-combo-option {
        border-top: 1px solid rgba(205, 212, 223, 0.5); /* SEPARATOR: divider between rows */
    }

    .request-combo-option:hover {
        background: #f2f6ff; /* HOVER: background color */
    }

    .request-combo-option.is-active,
    .request-combo-option[aria-selected="true"] {
        background: #e7f0ff; /* ACTIVE: selected/active background */
        outline: 1px solid #c2dafc; /* ACTIVE: outline thickness & color */
        outline-offset: -1px; /* ACTIVE: outline inside the element */
    }

    .request-combo-option .request-match {
        font-weight: 700; /* BOLDNESS: highlight match in bold */
        color: var(--combo-highlight); /* COLOR: accent color for match */
    }

/* ===========================
         Empty state
         =========================== */
.request-combo-empty {
    padding: var(--combo-item-padding); /* SIZE: keep same height as options */
    color: var(--combo-muted); /* COLOR: muted text color */
    font-style: italic; /* STYLE: italicize empty state */
    cursor: default; /* CURSOR: non-clickable */
}

/* ===========================
         Nice scrollbars (WebKit)
         =========================== */
.request-combo-dropdown::-webkit-scrollbar {
    width: 10px;
    height: 10px; /* SIZE: scrollbar thickness */
}

.request-combo-dropdown::-webkit-scrollbar-thumb {
    background-color: #d8dee9; /* COLOR: scrollbar thumb color */
    border-radius: 10px; /* SHAPE: rounded corners */
    border: 2px solid transparent; /* BORDER: creates inset effect */
    background-clip: padding-box; /* VISUAL: keeps inner roundness */
}

/* =======================================================
   request-combo-input-multi-editable (additive styles)
   ======================================================= */

/* Multi-editable rows inside dropdown */
.request-combo-option.rcme-row {
    display: grid;
    grid-template-columns: auto 1fr 4ch;
    gap: 8px;
    align-items: center;
}

    /* Checkbox spacing */
    .request-combo-option.rcme-row input[type="checkbox"] {
        margin: 0;
    }

/* Language code */
.rcme-code {
    font-weight: 600;
    color: var(--combo-text);
    white-space: nowrap;
}

/* Inline editable description */
.rcme-desc {
    font: inherit;
    padding: 2px 6px;
    border: 1px solid var(--combo-border);
    border-radius: 3px;
    background: #fff;
    box-sizing: border-box;
    width: 100%; /* fill grid column */
    min-width: 0; /* REQUIRED so grid/flex allows shrinking/growing */
}

    .rcme-desc:disabled {
        background: #f3f3f3;
        color: var(--combo-muted);
        cursor: not-allowed;
    }

    /* Focus styling aligned with combo design */
    .rcme-desc:focus {
        outline: none;
        border-color: #7fb0ff;
        box-shadow: 0 0 0 2px rgba(15, 98, 254, 0.2);
    }


.rcme-footer {
    display: flex;
    align-items: center;
}

    .rcme-footer .rcme-clear {
        margin-right: auto; /* pushes Save to the right */
    }

/* Prevent hover highlight from interfering with editing */
.request-combo-option.rcme-row:hover {
    background: #f7faff;
}


.rcme-footer {
    padding: 8px;
    border-top: 1px solid var(--combo-border);
    display: flex;
    justify-content: flex-end;
    background: var(--combo-bg);
}

.rcme-apply {
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid var(--combo-border);
    cursor: pointer;
}

/* =======================================================
   Multi-editable scrollable list + footer
   ======================================================= */

.rcme-list {
    max-height: 220px; /* scrollable area */
    overflow-y: auto;
}

/* Footer always visible */
.rcme-footer {
    padding: 8px;
    border-top: 1px solid var(--combo-border);
    background: var(--combo-bg);
    display: flex;
    justify-content: flex-end;
}
.request-admin-selected-disabled {
    opacity: 0.45;
    cursor: not-allowed !important;
}

    .request-admin-selected-disabled * {
        pointer-events: none;
    }
