/* Santej Lab User PMR Details Page Stylesheet */

.lab-detail-page {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1A1A1A;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 80px;
    box-sizing: border-box;
}

/* Header */
.lab-detail-header-block {
    margin-bottom: 4px;
}

.lab-detail-header-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
    width: fit-content;
}

.lab-detail-header-title-row .status-badge {
    margin: 0 !important;
}

.lab-detail-header-title {
    font-size: 20px;
    font-weight: 700;
    color: #1A1A1A;
    margin: 0;
    line-height: 1.2;
}

.lab-detail-header-subtitle {
    font-size: 12px;
    font-weight: 400;
    color: #9CA3AF;
    margin: 0;
    line-height: 1.3;
}



/* 2-Column Grid Layout */
.lab-detail-main-grid {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    width: 100%;
}

@media (max-width: 992px) {
    .lab-detail-main-grid {
        flex-direction: column;
    }
    .lab-left-info-card {
        width: 100% !important;
        flex: 1 1 100% !important;
    }
}

/* Left PMR Information Card */
.lab-left-info-card {
    flex: 0 0 240px;
    width: 240px;
    background-color: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    box-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.04), 0 1px 2px -1px rgba(15, 23, 42, 0.03);
    padding: 16px;
    box-sizing: border-box;
}

.lab-info-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.lab-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 12px;
    border-bottom: 1px solid #F1F5F9;
}

.lab-info-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.lab-info-label {
    font-size: 11.5px;
    font-weight: 600;
    color: #333333;
}

.lab-info-value {
    font-size: 12.5px;
    font-weight: 400;
    color: #808080;
    line-height: 1.4;
}

/* Right Main Content Card */
.lab-right-content-card {
    flex: 1;
    background-color: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    box-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.04), 0 1px 2px -1px rgba(15, 23, 42, 0.03);
    padding: 20px 24px;
    box-sizing: border-box;
    min-width: 0;
}

.lab-card-top-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

/* Title + status badge (Lab Revised) on one line */
.lab-card-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
    width: fit-content;
}

.lab-card-title-row .status-badge {
    margin: 0 !important;
}

    .lab-card-title-row .lab-card-title {
        margin: 0;
    }

.lab-card-title {
    font-size: 16px;
    font-weight: 700;
    color: #1A1A1A;
    margin: 0 0 2px 0;
}

.lab-card-header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.lab-toggle-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lab-toggle-label {
    font-size: 12.5px;
    font-weight: 500;
    color: #333333;
}

/* Common Project Toggle Switch */
.user-toggle {
    position: relative;
    width: 36px;
    height: 20px;
    display: inline-block;
    flex-shrink: 0;
}

.user-toggle input { opacity: 0; width: 0; height: 0; }

.user-toggle-slider {
    position: absolute;
    inset: 0;
    background-color: #d1d5db;
    border-radius: 20px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.user-toggle input:checked + .user-toggle-slider { background-color: #22c55e; }

.user-toggle-slider::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    left: 3px;
    top: 3px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.user-toggle input:checked + .user-toggle-slider::before { transform: translateX(16px); }

.lab-btn-add-material {
    background-color: #FFFFFF;
    border: 1px solid #D9E0E7;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    color: #1A1A1A;
    cursor: pointer;
    transition: all 0.15s ease;
}

.lab-btn-add-material:hover {
    background-color: #F8FAFC;
    border-color: #CBD5E1;
}

/* PMR Select & Note Inputs Row */
.lab-pmr-inputs-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.lab-pmr-input-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lab-pmr-input-label {
    font-size: 12px;
    font-weight: 600;
    color: #1A1A1A;
}

.lab-required-star {
    color: #FF0000;
}

.lab-pmr-text-input {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    font-size: 12.5px;
    color: #333333;
    background-color: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    box-sizing: border-box;
}

.lab-pmr-text-input::placeholder {
    color: #9CA3AF;
}

.lab-pmr-text-input:focus {
    outline: none;
    border-color: #9CA3AF;
    box-shadow: 0 0 0 2px rgba(108, 117, 125, 0.2);
}

.lab-label-with-counter {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lab-word-counter {
    font-size: 11px;
    font-weight: 500;
    color: #64748B;
}

/* Table Section with Header Background and Full Width Row Dividers */
.lab-table-container {
    background-color: #FFFFFF;
    border: 1px solid #EAEAEA;
    border-radius: 8px;
    max-height: 335px;
    overflow-y: auto;
    overflow-x: hidden;
    margin-bottom: 16px;
    padding: 0;
    position: relative;
}

.lab-table-container::-webkit-scrollbar {
    width: 6px;
}

.lab-table-container::-webkit-scrollbar-track {
    background: #F8FAFC;
    border-radius: 8px;
}

.lab-table-container::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 8px;
}

.lab-table-container::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

.lab-weights-table {
    width: 100%;
    border-collapse: collapse;
}

.lab-weights-table thead {
    background-color: #FAFAFA;
}

.lab-weights-table th {
    font-size: 11.5px;
    font-weight: 500;
    color: #64748B;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #EAEAEA;
    background-color: #FAFAFA;
    position: sticky;
    top: 0;
    z-index: 5;
    box-shadow: inset 0 -1px 0 #EAEAEA;
}

.lab-weights-table td {
    padding: 10px 14px;
    vertical-align: middle;
    border-bottom: 1px solid #F1F5F9;
    color: #151515;
}

.lab-weights-table tr:last-child td {
    border-bottom: none;
}

.lab-select-wrap {
    position: relative;
    width: 100%;
}

.lab-material-select {
    width: 100%;
    height: 38px;
    padding: 0 28px 0 12px;
    font-size: 12.5px;
    color: #333333;
    background-color: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    box-sizing: border-box;
}

.lab-select-chevron {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #94A3B8;
    display: flex;
    align-items: center;
}

.lab-select-chevron svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.lab-input-old-weight {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    font-size: 12.5px;
    color: #6b7280;
    -webkit-text-fill-color: #6b7280;
    background-color: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    box-sizing: border-box;
    cursor: not-allowed;
    text-align: right;
    outline: none;
    box-shadow: none;
}

    .lab-input-old-weight:focus {
        outline: none;
        box-shadow: none;
        border-color: #E2E8F0;
    }

.lab-input-formula-weight {
    text-align: right;
    width: 100%;
    height: 38px;
    padding: 0 12px;
    font-size: 12.5px;
    color: #333333;
    background-color: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    box-sizing: border-box;
    text-align: right !important;
}

.lab-input-formula-weight:not([readonly]):not(:disabled):focus {
    outline: none;
    border-color: #9CA3AF;
    box-shadow: 0 0 0 2px rgba(108, 117, 125, 0.2);
}

.lab-label-with-counter {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lab-word-counter {
    font-size: 11px;
    font-weight: 500;
    color: #64748B;
}

.lab-btn-trash {
    background: none;
    border: none;
    color: #94A3B8;
    cursor: pointer;
    padding: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
}

.lab-btn-trash:hover {
    color: #EF4444;
}

.lab-btn-trash svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

/* Bottom Actions & Warning Row (Bottom Attached Frosted Glass Dock) */
.lab-card-bottom-row {
    position: fixed;
    bottom: 0;
    left: 260px;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: none;
    border-top: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 0;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.04);
    padding: 14px 24px;
    margin: 0;
    box-sizing: border-box;
    flex-shrink: 0;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.sidebar-collapsed .lab-card-bottom-row {
    left: 70px;
}

@media (max-width: 768px) {
    .lab-card-bottom-row {
        left: 0;
    }
}

.lab-warning-box {
    background-color: #FFFBEB;
    border: 1px solid #FDE68A;
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 11.5px;
    color: #D97706;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.lab-warning-info-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.lab-action-buttons-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lab-btn-cancel-action {
    background-color: #FFFFFF;
    border: 1px solid #D9E0E7;
    border-radius: 6px;
    padding: 8px 18px;
    font-size: 12.5px;
    font-weight: 600;
    color: #1A1A1A;
    cursor: pointer;
    height: 36px;
    transition: all 0.15s ease;
}

.lab-btn-cancel-action:hover {
    background-color: #F8FAFC;
    border-color: #CBD5E1;
}

.lab-btn-submit-action {
    background-color: #FF0000;
    color: #FFFFFF;
    border: none;
    border-radius: 6px;
    padding: 8px 20px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    height: 36px;
    transition: background-color 0.15s ease;
}

.lab-btn-submit-action:hover {
    background-color: #CC0000;
}

/* ============================================================
   Read-only (Material Added) full-screen view
   ============================================================ */

/* Fill the available viewport height so the read-only detail
   occupies the full screen area within the layout content state. */
.lab-detail-page--readonly {
    min-height: 100%;
    height: 100%;
}

.lab-detail-page--readonly .lab-detail-main-grid {
    align-items: flex-start;
}

/* Read-only card sizes to its content, same as the editable card */
.lab-detail-page--readonly .lab-right-content-card {
    display: block;
}

/* Table container sizes to its rows — no forced height expansion */
.lab-detail-page--readonly .lab-table-container {
    flex: none;
}

/* Read-only / disabled inputs render as plain, non-interactive grey text fields with no hover/focus effects */
.lab-material-readonly,
.lab-material-select[readonly],
.lab-material-select:disabled,
.lab-detail-page--readonly .lab-material-readonly,
.lab-input-formula-weight[readonly],
.lab-input-formula-weight:disabled,
.lab-detail-page--readonly .lab-input-formula-weight[readonly],
.lab-input-old-weight,
.lab-input-old-weight[readonly],
.lab-input-old-weight:disabled,
.lab-pmr-text-input[readonly],
.lab-pmr-text-input:disabled {
    width: 100%;
    box-sizing: border-box;
    background-color: #F8FAFC !important;
    color: #6b7280 !important;
    -webkit-text-fill-color: #6b7280 !important;
    border: 1px solid #E2E8F0 !important;
    border-radius: 6px !important;
    cursor: not-allowed !important;
    opacity: 1 !important;
    outline: none !important;
    box-shadow: none !important;
    user-select: none;
}

.lab-material-readonly,
.lab-material-select[readonly],
.lab-material-select:disabled {
    padding: 0 12px !important;
}

.lab-material-readonly:hover,
.lab-material-readonly:focus,
.lab-material-readonly:focus-visible,
.lab-material-readonly:active,
.lab-material-select[readonly]:hover,
.lab-material-select[readonly]:focus,
.lab-material-select[readonly]:focus-visible,
.lab-material-select[readonly]:active,
.lab-material-select:disabled:hover,
.lab-material-select:disabled:focus,
.lab-material-select:disabled:focus-visible,
.lab-material-select:disabled:active,
.lab-detail-page--readonly .lab-material-readonly:hover,
.lab-detail-page--readonly .lab-material-readonly:focus,
.lab-input-formula-weight[readonly]:hover,
.lab-input-formula-weight[readonly]:focus,
.lab-input-formula-weight[readonly]:focus-visible,
.lab-input-formula-weight[readonly]:active,
.lab-input-formula-weight:disabled:hover,
.lab-input-formula-weight:disabled:focus,
.lab-input-formula-weight:disabled:focus-visible,
.lab-input-formula-weight:disabled:active,
.lab-detail-page--readonly .lab-input-formula-weight[readonly]:hover,
.lab-detail-page--readonly .lab-input-formula-weight[readonly]:focus,
.lab-input-old-weight:hover,
.lab-input-old-weight:focus,
.lab-input-old-weight:focus-visible,
.lab-input-old-weight:active,
.lab-input-old-weight:disabled:hover,
.lab-input-old-weight:disabled:focus,
.lab-input-old-weight:disabled:focus-visible,
.lab-input-old-weight:disabled:active,
.lab-pmr-text-input[readonly]:hover,
.lab-pmr-text-input[readonly]:focus,
.lab-pmr-text-input:disabled:hover,
.lab-pmr-text-input:disabled:focus {
    background-color: #F8FAFC !important;
    border-color: #E2E8F0 !important;
    color: #6b7280 !important;
    -webkit-text-fill-color: #6b7280 !important;
    box-shadow: none !important;
    outline: none !important;
    cursor: not-allowed !important;
}

/* ============================================================
   Inline field validation
   ============================================================ */

/* Error message displayed directly below an invalid input */
.lab-field-error {
    color: #dc2626;
    font-size: 11px;
    font-weight: 400;
    margin-top: 4px;
    display: block;
    line-height: 1.2;
    text-align: left;
}

/* Red border applied to the input control when it is invalid */
.lab-input-error,
.lab-input-error.lab-material-select,
.lab-input-error.lab-input-formula-weight,
.lab-input-error.lab-pmr-text-input {
    border-color: #dc2626 !important;
}


/* ============================================================
   RESPONSIVE (Laptop & Desktop: 1200px – 1920px)
   Breakpoints follow css/responsive-layout.css.
   The table columns use % widths, so only spacing changes here.
   The 992px block near the top is below the supported width
   (html min-width: 1200px) and is kept only as a fallback.
   ============================================================ */

/* Standard laptops (1366 / 1440) */
@media (max-width: 1440px) {
    .lab-weights-table th,
    .lab-weights-table td {
        padding: 9px 12px;
    }
}

/* Small laptops (1240 / 1280) */
@media (max-width: 1280px) {
    .lab-detail-page,
    .lab-detail-main-grid {
        gap: 12px;
    }

    .lab-detail-header-title {
        font-size: 18px;
    }

    /* Left info card: 240px -> 210px gives the table more room. */
    .lab-left-info-card {
        flex: 0 0 210px;
        width: 210px;
        padding: 12px;
    }

    .lab-info-list {
        gap: 10px;
    }

    .lab-info-item {
        padding-bottom: 10px;
    }

    .lab-info-value {
        font-size: 12px;
        overflow-wrap: anywhere;
    }

    /* Right card: 20/24px -> 14/16px padding. */
    .lab-right-content-card {
        padding: 14px 16px;
    }

    .lab-card-title {
        font-size: 15px;
    }

    .lab-card-top-row,
    .lab-pmr-inputs-row,
    .lab-table-container {
        margin-bottom: 12px;
    }

    .lab-pmr-inputs-row {
        gap: 12px;
    }

    /* Inputs: 38px -> 36px tall. */
    .lab-pmr-text-input,
    .lab-material-select,
    .lab-input-old-weight,
    .lab-input-formula-weight {
        height: 36px;
        padding-left: 10px;
        padding-right: 10px;
    }

    .lab-material-select {
        padding-right: 28px; /* room for the chevron */
    }

    .lab-weights-table th,
    .lab-weights-table td {
        padding: 8px 10px;
    }

    /* Bottom row: negative margins must match the card's 16px side padding
       so the divider line still runs edge to edge. */
    .lab-card-bottom-row {
        gap: 12px;
        margin-top: 12px;
        padding-top: 12px;
        margin-left: -16px;
        margin-right: -16px;
        padding-left: 16px;
        padding-right: 16px;
    }

    .lab-warning-box {
        padding: 6px 10px;
    }

    .lab-btn-cancel-action,
    .lab-btn-submit-action {
        padding: 6px 14px;
        font-size: 12px;
        white-space: nowrap;
    }
}
