/* ============================================================================
   PAYROLL PROCESSING - Edit Check Panel Styles
   Matching Payroll_Run_Detail.html mockup design
   ============================================================================ */

/* CSS Variables - Design Tokens */
:root {
    --accent-primary: #15B6A0;
    --accent-error: #F95F62;
    --accent-warning: #F59E0B;
    --accent-success: #10B981;
    --surface-base: #F9FAFB;
    --surface-alt: #FFFFFF;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-disabled: #9CA3AF;
    --divider: #E5E7EB;
    --radius: 12px;
}

/* ============================================================================
   EDIT CHECK PANEL - Main Container
   ============================================================================ */

.edit-check-panel {
    background: #F8FAFC;
    border: 2px solid var(--accent-primary);
    border-radius: var(--radius);
    margin: 0 16px 16px 16px;
    overflow: visible;
}

.edit-check-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 40px;
    justify-content: center;
    color: var(--text-secondary);
}

/* ============================================================================
   HEADER
   ============================================================================ */

.edit-check-header {
    background: var(--surface-alt);
    padding: 12px 20px;
    border-bottom: 1px solid var(--divider);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.edit-check-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.edit-check-actions {
    display: flex;
    gap: 8px;
}

.edit-check-btn {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--divider);
    background: white;
    color: var(--text-secondary);
}

.edit-check-btn.danger {
    color: var(--accent-error);
    border-color: var(--accent-error);
}

.edit-check-btn:hover {
    background: rgba(0,0,0,0.04);
}

/* ============================================================================
   BODY
   ============================================================================ */

.edit-check-body {
    padding: 12px 20px;
}

/* ============================================================================
   SECTIONS
   ============================================================================ */

.edit-check-section {
    margin-bottom: 12px;
}

.edit-check-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    padding: 6px 0 4px 0;
    border-bottom: 1px solid var(--divider);
}

/* ============================================================================
   GRIDS
   ============================================================================ */

/* Earnings Grid - 6 columns */
.edit-check-grid-earnings {
    display: grid;
    grid-template-columns: 110px 2fr 120px 120px 120px 40px;
    gap: 0;
    align-items: stretch;
    font-size: 12px;
    border: 1px solid var(--divider);
}

/* Extended Earnings Grid - 8 columns for Row 1 (Code, Description, Start, End, Hours, Rate, Amount, Del) */
.edit-check-grid-earnings-extended {
    display: grid;
    grid-template-columns: 110px 1fr 120px 120px 120px 120px 120px 40px;
    gap: 0;
    align-items: stretch;
    font-size: 11px;
    border: 1px solid var(--divider);
    width: 100%;
}

/* Earnings Detail Row - Location, Department, Position, Shift (spans full width) */
.edit-check-earnings-detail-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-bottom: 1px solid var(--divider);
}

.edit-check-earnings-detail-row.new-line-item {
    background: #e8f5e9;
}

.edit-check-earnings-detail-row.modified-line-item {
    background: #fff8e1;
}

/* Detail field styling for two-row layout */
.detail-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-field label {
    font-size: 10px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-field select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--divider);
    border-radius: 4px;
    font-size: 12px;
    background: white;
}

/* Standard Grid - 6 columns (Earnings: CODE, DESCRIPTION, HOURS, RATE, AMOUNT, actions) */
.edit-check-grid {
    display: grid;
    grid-template-columns: 110px 2fr 1fr 120px 120px 40px;
    gap: 0;
    align-items: stretch;
    font-size: 12px;
    border: 1px solid var(--divider);
}

/* Simple Grid - 4 columns (Taxes, legacy) */
.edit-check-grid-simple {
    display: grid;
    grid-template-columns: 110px 2fr 120px 40px;
    gap: 0;
    align-items: stretch;
    font-size: 12px;
    border: 1px solid var(--divider);
}

/* Deductions Grid - 6 columns (CODE, DESCRIPTION, UNITS, RATE, AMOUNT, actions) */
.edit-check-grid-deductions {
    display: grid;
    grid-template-columns: 110px 2fr 80px 80px 120px 40px;
    gap: 0;
    align-items: stretch;
    font-size: 12px;
    border: 1px solid var(--divider);
}

/* Benefits Grid - 6 columns (CODE, DESCRIPTION, UNITS, RATE, AMOUNT, actions) */
.edit-check-grid-benefits {
    display: grid;
    grid-template-columns: 110px 2fr 80px 80px 120px 40px;
    gap: 0;
    align-items: stretch;
    font-size: 12px;
    border: 1px solid var(--divider);
}

/* Taxes Grid - 3 columns (CODE, DESCRIPTION, AMOUNT) */
.edit-check-grid-taxes {
    display: grid;
    grid-template-columns: 110px 2fr 120px;
    gap: 0;
    align-items: stretch;
    font-size: 12px;
    border: 1px solid var(--divider);
}

/* Bank Allocation Grid - 4 columns (ACCOUNT, ACCOUNT#, METHOD, AMOUNT) */
.edit-check-grid-bankallocation {
    display: grid;
    grid-template-columns: 1fr 120px 100px 100px;
    gap: 0;
    align-items: stretch;
    font-size: 12px;
    border: 1px solid var(--divider);
}

/* Grid cell specific styles */
.grid-code {
    font-weight: 600;
    color: var(--text-primary);
}

.grid-description {
    color: var(--text-primary);
}

.grid-method {
    font-size: 11px;
    color: var(--text-secondary);
}

.grid-units {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
}

.grid-rate {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
}

.grid-amount {
    font-family: 'JetBrains Mono', monospace;
}

.grid-actions {
    justify-content: center;
}

.edit-check-grid-header {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 4px 6px;
    background: var(--surface-base);
    border-right: 1px solid var(--divider);
    border-bottom: 1px solid var(--divider);
    line-height: 1.2;
}

.edit-check-grid-header:last-child {
    border-right: none;
}

.edit-check-grid-row {
    display: contents;
}

.edit-check-grid-row > div,
.edit-check-grid-row > span {
    padding: 4px 6px;
    border-right: 1px solid var(--divider);
    border-bottom: 1px solid var(--divider);
    line-height: 1.2;
    display: flex;
    align-items: center;
    min-height: 28px;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    position: relative;
}

.edit-check-grid-row > div:last-child,
.edit-check-grid-row > span:last-child {
    border-right: none;
}

/* ============================================================================
   INPUTS
   ============================================================================ */

.edit-check-input {
    padding: 2px 4px;
    border: none;
    border-radius: 0;
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    width: 100%;
    background: white;
    line-height: 1.2;
    color: var(--text-primary);
}

.edit-check-input:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: -2px;
    z-index: 1;
}

.edit-check-select {
    padding: 2px 4px;
    border: none;
    border-radius: 0;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    width: 100%;
    background: white;
    line-height: 1.2;
    color: var(--text-primary);
    cursor: pointer;
    position: relative;
}

.edit-check-select:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: -2px;
    z-index: 100;
}

.edit-check-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    line-height: 1.2;
    color: var(--text-primary);
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.delete-icon-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    padding: 0;
    margin: auto;
}

.delete-icon-btn:hover {
    background: rgba(249, 95, 98, 0.1);
    color: var(--accent-error);
}

.delete-icon-btn .material-icons {
    font-size: 16px;
}

/* ============================================================================
   FOOTER
   ============================================================================ */

.edit-check-footer {
    background: var(--surface-base);
    padding: 12px 20px;
    border-top: 1px solid var(--divider);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.edit-check-summary {
    display: flex;
    gap: 24px;
    font-size: 13px;
    font-weight: 600;
}

.edit-check-summary-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.edit-check-summary-label {
    color: var(--text-secondary);
}

.edit-check-summary-value {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
}

.edit-check-save-actions {
    display: flex;
    gap: 12px;
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 150ms;
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--divider);
}

.btn-secondary:hover {
    background: rgba(0,0,0,0.04);
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background: #128F7E;
}

.btn-primary:disabled {
    background: var(--text-disabled);
    cursor: not-allowed;
    opacity: 0.5;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 1400px) {
    .edit-check-grid-earnings {
        grid-template-columns: 70px 1fr 80px 80px 80px 80px 80px 80px 70px 70px 90px 32px;
    }
}

@media (max-width: 1200px) {
    .edit-check-grid-earnings {
        font-size: 11px;
    }

    .edit-check-grid {
        font-size: 11px;
    }
}

/* ============================================================================
   PAYROLL RUN TABS - Match Department Table Style
   Clean white background with gray text, teal accent for active tab only
   ============================================================================ */

.payroll-run-tabs {
    background: white !important;
}

/* Tab bar container */
.payroll-run-tabs .mud-tabs-toolbar {
    background: white !important;
    border-bottom: 1px solid var(--divider) !important;
}

/* Individual tabs - default state (gray) */
.payroll-run-tabs .mud-tab {
    color: var(--text-secondary) !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    transition: all 150ms ease-in-out !important;
}

/* Tab hover state */
.payroll-run-tabs .mud-tab:hover {
    color: var(--text-primary) !important;
    background: rgba(0, 0, 0, 0.02) !important;
}

/* Active tab - teal accent */
.payroll-run-tabs .mud-tab-active {
    color: var(--accent-primary) !important;
}

/* Active tab indicator (bottom border) */
.payroll-run-tabs .mud-tab-slider {
    background-color: var(--accent-primary) !important;
}

/* Tab panel content area */
.payroll-run-tabs .mud-tabs-panels {
    background: white !important;
}

/* ============================================================================
   MUDTABLE OVERRIDES - Match Department Table Style
   Override MudBlazor table header styling to match design system
   ============================================================================ */

/* Target MudTable headers in payroll run pages */
.mud-table .mud-table-head .mud-table-row .mud-table-cell {
    background: #F3F4F6 !important;
    color: #6B7280 !important;
    font-size: 12px !important;
    letter-spacing: 0.06em !important;
    text-transform: uppercase !important;
    font-weight: 600 !important;
    border-bottom: 1px solid #E5E7EB !important;
}

/* MudTh elements specifically */
.mud-table-head th {
    background: #F3F4F6 !important;
    color: #6B7280 !important;
    font-size: 12px !important;
    letter-spacing: 0.06em !important;
    text-transform: uppercase !important;
    font-weight: 600 !important;
}

/* Sort labels inside headers */
.mud-table-head .mud-table-sortlabel {
    color: #6B7280 !important;
    font-weight: 600 !important;
}

/* Sort icons */
.mud-table-head .mud-table-sortlabel svg {
    color: #6B7280 !important;
}

/* ============================================================================
   EMPLOYEES TABLE - Status Badges & Custom Elements
   ============================================================================ */

/* Status Badge Base */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Calculation Status Colors */
.status-default {
    background-color: #e0e0e0;
    color: #424242;
}

.status-success {
    background-color: #d1e7dd;
    color: #0f5132;
}

.status-error {
    background-color: #f8d7da;
    color: #842029;
}

.status-info {
    background-color: #cfe2ff;
    color: #084298;
}

.status-warning {
    background-color: #fff3cd;
    color: #856404;
}

/* Chip (for Manually Edited badge) */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    margin-top: 4px;
}

.chip-info {
    background-color: #e7f5ff;
    color: #084298;
}

/* Manually Edited Indicators (BR-CALC-006) */
.manually-edited-input {
    border-color: var(--accent-warning) !important;
    background-color: rgba(245, 158, 11, 0.1) !important;
}

.manually-edited-badge {
    background-color: var(--accent-warning);
    color: white;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Expanded Row Styling */
.expanded-row {
    background: #F9FAFB !important;
}

.expanded-row td {
    padding: 0 !important;
    border-bottom: 2px solid #E5E7EB !important;
}

/* Action Buttons in Table */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-start;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.icon-btn.danger:hover {
    background-color: rgba(211, 47, 47, 0.1);
    color: #d32f2f;
}

.icon-btn .material-icons {
    font-size: 20px;
}

/* Utility Classes */
.text-right {
    text-align: right;
}

.mono {
    font-family: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
}

.text-center {
    text-align: center;
}

/* ============================================================================
   PAGINATION - Match Department Table Style
   ============================================================================ */

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--divider);
    background: white;
}

.pagination-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid var(--divider);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    background: #F3F4F6;
    border-color: var(--accent-primary);
}

.pagination-btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-btn .material-icons {
    font-size: 20px;
}

.pagination-info {
    margin-left: auto;
    font-size: 14px;
    color: var(--text-secondary);
}

.pagination-ellipsis {
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    color: var(--text-secondary);
    font-size: 14px;
    user-select: none;
}

/* Page Size Selector (PRM-020) */
.pagination-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.page-size-select {
    padding: 6px 12px;
    border: 1px solid var(--divider);
    border-radius: 6px;
    background: white;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    min-width: 70px;
}

.page-size-select:hover {
    border-color: var(--accent-primary);
}

.page-size-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(21, 182, 160, 0.2);
}
