/* LAB - Grades and Chemistries - AG Grid + Modal styles */

#grades-grid {
    height: 65vh;
    border: 1px solid #ccc;
    overflow: hidden;
}

/* The ag-grid-module template hardcodes height:75vh on its inner
   <div id="agGrid_*">, which overflows our 65vh wrapper. Force the whole
   chain to 100% so the grid stays inside its card. Same approach as
   pages/eaf/eaf-electrodes-summary.css. */
#grades-grid > .ag-grid-module {
    height: 100%;
    width: 100%;
    display: block;
}
#grades-grid .ag-grid-module > div[id^="agGrid_"] {
    height: 100% !important;
    width: 100%;
}

.processes-grid-container .ag-theme-alpine {
    --ag-header-height: 40px;
}

.ag-theme-alpine .ag-header {
    background-color: #f8f8f8;
    border-bottom: 1px solid #babfc7;
}

.ag-theme-alpine .ag-header-group-cell-label,
.ag-theme-alpine .ag-header-cell-label {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    width: 100%;
}

.ag-theme-alpine .ag-header-cell,
.ag-theme-alpine .ag-header-group-cell {
    padding-left: 8px;
    padding-right: 8px;
    margin: 0;
}

.ag-theme-alpine .ag-overlay-loading-center {
    background-color: #fff;
    color: #333;
    border: 1px solid #ccc;
    padding: 10px;
    border-radius: 5px;
}

/* ---- KPI cards ---- */
.kpi-card .kpi-value { line-height: 1.1; }
.kpi-card .kpi-label { margin-bottom: 2px; }
.kpi-card.kpi-total   { border-left: 4px solid #1f6fdf; }
.kpi-card.kpi-active  { border-left: 4px solid #17a83a; }
.kpi-card.kpi-groups  { border-left: 4px solid #f59e0b; }

/* ---- Active cell (read-only checkmark) ---- */
.active-cell { display: inline-flex; align-items: center; justify-content: center; }
.active-cell .fa-check-circle { color: #17a83a; }
.active-cell .fa-times-circle { color: #b0b6be; }

/* ---- Action buttons inside grid cell ---- */
.grades-actions-cell {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    height: 100%;
}
.grades-actions-cell .grades-action-btn {
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 4px;
    padding: 2px 8px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    font-size: 12px;
    color: #374151;
}
.grades-actions-cell .grades-action-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}
.grades-actions-cell .grades-chemistry-btn {
    color: #1f6fdf;
    border-color: #bfdbfe;
}
.grades-actions-cell .grades-chemistry-btn:hover {
    background: #eff6ff;
    border-color: #60a5fa;
}
.grades-actions-cell .grades-edit-btn { color: #374151; }
.grades-actions-cell .grades-delete-btn {
    color: #b91c1c;
    border-color: #fecaca;
}
.grades-actions-cell .grades-delete-btn:hover {
    background: #fef2f2;
    border-color: #f87171;
}
.grades-actions-cell .grades-action-btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Pointer feedback for clickable pencil/trash icons */
.grades-actions-cell i { pointer-events: none; }

/* ---- Edit modal form ---- */
.grades-edit-modal .modal-dialog { width: 520px; }
.grades-edit-modal .edit-form { padding: 8px 4px; }
.grades-edit-modal .form-row {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}
.grades-edit-modal .form-label {
    width: 120px;
    text-align: right;
    padding-right: 12px;
    margin: 0;
    color: #374151;
    font-weight: 500;
    font-size: 13px;
}
.grades-edit-modal .form-input {
    flex: 1;
    height: 36px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 0 8px;
    box-sizing: border-box;
    font-size: 14px;
    background-color: #fff;
    margin: 0;
}
.grades-edit-modal .form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}
.grades-edit-modal select.form-input {
    height: 36px;
    padding: 0 6px;
}
.grades-edit-modal .form-check-wrapper {
    display: flex;
    align-items: center;
    border: none;
    height: 36px;
    padding: 0;
    background: transparent;
}
.grades-edit-modal .form-check-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0 8px 0 0;
}
.grades-edit-modal .form-check-label {
    margin: 0;
    color: #6b7280;
    font-size: 13px;
}
.grades-edit-modal .edit-error {
    color: #b91c1c;
    font-size: 12px;
    margin-top: 6px;
    padding: 6px 8px;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 4px;
}

/* ---- Chemistry modal ---- */
/* Chemistry modal.
   The site uses Bootstrap 2-era modals where `.modal` IS the dialog
   (position:fixed, margin-left:-width/2 for centering) and `.modal-body` has
   a default `max-height: 400px; overflow-y: auto`. Inner AG Grid has its own
   scroll — leaving both produces the double-scroll we want to avoid. Override
   modal-body so the grid owns all the scrolling, and give it a fixed-size
   container the grid fills completely. */
#chemistryModal {
    width: 720px !important;
    margin-left: -360px !important;
}
#chemistryModal .modal-body {
    width: auto !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 12px 15px;
}
#chemistryModal .chemistry-grid-container {
    height: 360px;
    border: 1px solid #ccc;
    overflow: hidden;
}
#chemistryModal #chemistry-grid > .ag-grid-module {
    height: 100%;
    width: 100%;
    display: block;
}
#chemistryModal #chemistry-grid .ag-grid-module > div[id^="agGrid_"] {
    height: 100% !important;
    width: 100%;
}
