/* Prepurchased Energy - AG Grid + Tailwind page styles */

/* Force the ag-grid-module wrapper chain to fill its host container.
   The shared template hardcodes height: 75vh + width:auto on its inner div;
   without these rules the grid overflows the card on the right. */
#prepurchased-energy-grid {
    overflow: hidden;
}

#prepurchased-energy-grid > .ag-grid-module {
    height: 100%;
    width: 100%;
    display: block;
}

#prepurchased-energy-grid .ag-grid-module > div[id^="agGrid_"] {
    height: 100% !important;
    width: 100% !important;
}

/* AG Grid: header look consistent with other refactored pages */
.processes-grid-container .ag-theme-alpine {
    --ag-header-height: 42px;
}

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

/* AG Grid: centered headers (group and column) */
.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 Grid loading overlay styling (matches other MES screens) */
.ag-theme-alpine .ag-overlay-loading-center {
    background-color: #fff;
    color: #333;
    border: 1px solid #ccc;
    padding: 10px;
    border-radius: 5px;
}

/* Editable cells: subtle indicator so the user knows they can click to edit */
.editable-cell {
    background-color: #fffef7;
}
.editable-cell:hover {
    background-color: #fff9db;
    cursor: text;
}

/* Numeric cells right-aligned */
.text-right-cell {
    text-align: right !important;
}

/* Actions cell: vertical-center the button within the AG Grid cell */
.actions-cell {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

/* Delete button inside the actions column - icon only */
.action-delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    border: 1px solid #fca5a5;
    color: #b91c1c;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    padding: 0;
    cursor: pointer;
    line-height: 1;
    transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}
.action-delete-btn:hover {
    background-color: #fee2e2;
    color: #7f1d1d;
    border-color: #ef4444;
}
.action-delete-btn .fa {
    font-size: 14px;
}
.action-delete-btn[disabled] {
    color: #9ca3af;
    cursor: not-allowed;
    background: transparent;
    border-color: #e5e7eb;
}

/* Add Year modal: width override + label sizing.
   Bootstrap's default .modal is 560px wide with margin-left: -280px - we
   shrink to 420px and re-center. */
.modal-add-year.modal {
    width: 420px;
    margin-left: -210px;
}
.modal-add-year .modal-body {
    padding: 18px 22px;
}
.modal-add-year .modal-header h4 {
    font-weight: 600;
    margin: 0;
    font-size: 18px;
}
.modal-add-year .row-field {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}
.modal-add-year .row-field:last-of-type {
    margin-bottom: 0;
}
.modal-add-year .row-field-label {
    flex: 0 0 140px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}
.modal-add-year .row-field-input {
    flex: 1 1 auto;
    padding: 7px 10px;
    font-size: 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    outline: none;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
.modal-add-year .row-field-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}
.modal-add-year #addYearError {
    color: #dc2626;
    font-size: 13px;
    margin-top: 6px;
}
.modal-add-year .modal-footer .btn {
    min-width: 80px;
}
