/* Contract Tracking System - Styles */

/* Layout */
body {
    padding-top: 56px; /* navbar height */
    background-color: #f8f9fa;
}

.wrapper {
    display: flex;
    min-height: calc(100vh - 56px);
}

/* Sidebar */
#sidebar {
    width: 250px;
    min-width: 250px;
    position: fixed;
    top: 56px;
    left: 0;
    height: calc(100vh - 56px);
    overflow-y: auto;
    z-index: 100;
}

#sidebar .nav-link {
    color: #333;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin: 0.125rem 0;
}

#sidebar .nav-link:hover {
    background-color: #e9ecef;
}

#sidebar .nav-link.active {
    background-color: #0d6efd;
    color: white;
}

#sidebar .nav-link i {
    margin-right: 0.5rem;
    width: 1.25rem;
    text-align: center;
}

/* Main content */
.content {
    flex: 1;
    min-width: 0;
}

.content.with-sidebar {
    margin-left: 250px;
}

/* Login page */
.login-container {
    max-width: 400px;
    margin: 100px auto;
}

.login-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Contract selection */
.contract-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.contract-card {
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.contract-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.contract-card.selected {
    border-color: #0d6efd;
    border-width: 2px;
}

/* Tables */
.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Status badges */
.badge-create { background-color: #adb5bd; }
.badge-submitted { background-color: #6c757d; }
.badge-approved { background-color: #0d6efd; }
.badge-accepted { background-color: #198754; }
.badge-paid { background-color: #20c997; }
.badge-rejected { background-color: #dc3545; }

/* State badges for mods */
.badge-unassigned { background-color: #6c757d; }
.badge-contractor-input { background-color: #0dcaf0; }
.badge-task-lead-review { background-color: #ffc107; color: #333; }
.badge-financial-review { background-color: #fd7e14; }
.badge-pm-review { background-color: #6f42c1; color: #fff; }
.badge-submitted-to-govt { background-color: #0d6efd; }
.badge-awarded { background-color: #198754; }
.badge-unawarded-mod { background-color: #dc3545; }

/* Test mode banner */
.test-mode-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #ffc107;
    color: #333;
    text-align: center;
    padding: 0.25rem;
    font-size: 0.75rem;
    font-weight: bold;
    z-index: 1050;
}

/* Page headers */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #dee2e6;
}

.page-header h1 {
    margin: 0;
    font-size: 1.75rem;
}

/* Cards */
.stat-card {
    text-align: center;
    padding: 1.5rem;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #0d6efd;
}

.stat-card .stat-label {
    color: #6c757d;
    font-size: 0.875rem;
}

/* Data rows */
.clickable-row {
    cursor: pointer;
}

.clickable-row:hover {
    background-color: #e9ecef !important;
}

/* Alerts */
.alert-container {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 1060;
    max-width: 400px;
}

/* Forms */
.form-label {
    font-weight: 500;
}

/* Modal improvements */
.modal-header {
    background-color: #f8f9fa;
}

/* Responsive */
@media (max-width: 768px) {
    #sidebar {
        width: 100%;
        position: relative;
        top: 0;
        height: auto;
    }

    .content.with-sidebar {
        margin-left: 0;
    }

    .wrapper {
        flex-direction: column;
    }
}

/* Loading spinner */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Invoice Management - Green Header Bar */
.inv-header {
    background-color: #4a8c4a;
    color: white;
    padding: 10px 16px;
    border-radius: 6px 6px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.inv-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.inv-header .btn {
    color: white;
    border-color: rgba(255,255,255,0.5);
}

.inv-header .btn:hover {
    background-color: rgba(255,255,255,0.15);
}

/* Invoice Summary Bar */
.inv-summary {
    background: white;
    border: 1px solid #dee2e6;
    border-top: none;
    padding: 8px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 24px;
    font-size: 0.85rem;
}

.inv-summary .inv-field {
    white-space: nowrap;
}

.inv-summary .inv-field label {
    color: #6c757d;
    margin-right: 4px;
}

.inv-summary .inv-field strong {
    color: #333;
}

/* Invoice Grouped Table */
.inv-group-header {
    background-color: #f0f0f0;
    padding: 8px 12px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
    border: 1px solid #dee2e6;
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.inv-group-header:hover {
    background-color: #e8e8e8;
}

.inv-group-header .inv-group-toggle {
    transition: transform 0.2s;
}

.inv-group-header.collapsed .inv-group-toggle {
    transform: rotate(-90deg);
}

.inv-group-body {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.inv-group-body.collapsed {
    display: none;
}

/* Invoice wide table - horizontal scroll */
.inv-table-wrap {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0 0 6px 6px;
    overflow-x: auto;
}

.inv-table {
    font-size: 0.8rem;
    margin-bottom: 0;
    white-space: nowrap;
}

.inv-table thead th {
    position: sticky;
    top: 0;
    background: #f8f9fa;
    z-index: 1;
    font-size: 0.75rem;
    padding: 6px 8px;
}

.inv-table td {
    padding: 5px 8px;
    vertical-align: middle;
}

.inv-table .text-money {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Invoice Detail - Inline editable cells */
.inv-edit-cell {
    padding: 2px !important;
}

.inv-edit-cell input,
.inv-edit-cell select {
    border: 1px solid transparent;
    background: transparent;
    padding: 2px 4px;
    font-size: 0.8rem;
    width: 100%;
    min-width: 60px;
}

.inv-edit-cell input:focus,
.inv-edit-cell select:focus {
    border-color: #86b7fe;
    outline: none;
    background: white;
    box-shadow: 0 0 0 2px rgba(13,110,253,0.15);
}

.inv-edit-cell input.saving {
    background-color: #fff3cd;
}

.inv-edit-cell input.saved {
    background-color: #d1e7dd;
}

.inv-edit-cell input.save-error {
    background-color: #f8d7da;
}

/* Number inputs in invoice grid */
.inv-edit-cell input[type="number"] {
    text-align: right;
    min-width: 70px;
    -moz-appearance: textfield;
}

.inv-edit-cell input[type="number"]::-webkit-inner-spin-button,
.inv-edit-cell input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Attachment table */
.inv-attach-table td {
    vertical-align: middle;
}

.inv-attach-actions .btn {
    padding: 2px 6px;
    font-size: 0.8rem;
}

/* Invoice detail tabs */
.inv-tabs .nav-link {
    font-size: 0.9rem;
    padding: 8px 16px;
}

/* Checkbox column */
.inv-table .col-check {
    width: 32px;
    text-align: center;
}

/* ============================================================ */
/* Spreadsheet-style tables (contract.php tabs)                 */
/* ============================================================ */
.spreadsheet-table {
    font-size: 0.84rem;
    border-collapse: collapse;
    margin-bottom: 0;
}

.spreadsheet-table th,
.spreadsheet-table td {
    padding: 5px 10px;
    border: 1px solid #bfc8d1;
    white-space: nowrap;
}

.spreadsheet-table thead th {
    background-color: #dce4ed;
    font-weight: 600;
    font-size: 0.8rem;
    border-bottom: 2px solid #9aabbf;
}

.spreadsheet-table tbody td {
    font-variant-numeric: tabular-nums;
}

.spreadsheet-table tbody tr:nth-child(even) {
    background-color: #f4f7fa;
}

.spreadsheet-table tbody tr:hover {
    background-color: #dae6f2;
}

/* Rate pivot table - company section */
.rate-company-section {
    margin-bottom: 1.5rem;
}

.spreadsheet-company-header {
    background: linear-gradient(135deg, #3a5a8c, #4a6fa5);
    color: white;
    padding: 8px 14px;
    font-size: 0.9rem;
    border-radius: 4px 4px 0 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rate-company-section .table-responsive {
    border: 1px solid #bfc8d1;
    border-top: none;
    border-radius: 0 0 4px 4px;
    overflow-x: auto;
}

.rate-company-section .spreadsheet-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

/* CY group header row */
.spreadsheet-table .cy-group-header {
    background-color: #c9d6e4;
    border-bottom: 1px solid #9aabbf;
}

/* Clickable rate cells */
.rate-cell {
    cursor: pointer;
    transition: background-color 0.1s;
}

.rate-cell:hover {
    background-color: #b8d4f0 !important;
}

/* Spreadsheet container (replaces table-container for these tabs) */
.spreadsheet-wrap {
    background: white;
    border: 1px solid #bfc8d1;
    border-radius: 4px;
    overflow: hidden;
}

.spreadsheet-wrap .spreadsheet-table {
    border: none;
}

.spreadsheet-wrap .spreadsheet-table th:first-child,
.spreadsheet-wrap .spreadsheet-table td:first-child {
    border-left: none;
}

.spreadsheet-wrap .spreadsheet-table th:last-child,
.spreadsheet-wrap .spreadsheet-table td:last-child {
    border-right: none;
}

.spreadsheet-wrap .spreadsheet-table thead tr:first-child th {
    border-top: none;
}

.spreadsheet-wrap .spreadsheet-table tbody tr:last-child td {
    border-bottom: none;
}

/* Productive Hours grid */
.ph-cy-section {
    margin-bottom: 1.5rem;
}

.ph-input {
    width: 100px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    border: 1px solid transparent;
    background: transparent;
    padding: 2px 6px;
    font-size: 0.84rem;
    transition: background-color 0.3s;
}

.ph-input:focus {
    border-color: #86b7fe;
    outline: none;
    background: white;
    box-shadow: 0 0 0 2px rgba(13,110,253,0.15);
}

.ph-input::placeholder {
    color: #bbb;
}

/* Cost Estimating - disabled selects look like plain text */
.ce-row-subtask:disabled,
.ce-row-company:disabled,
.ce-row-category:disabled,
.ce-row-location:disabled,
.ce-odc-subtask:disabled,
.ce-odc-company:disabled,
.ce-travel-subtask:disabled,
.ce-travel-company:disabled {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: none !important;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057;
    cursor: default;
    opacity: 1;
}

/* ============================================================ */
/* 533M Report                                                   */
/* ============================================================ */
.report-533m-table {
    font-size: 0.8rem;
    margin-bottom: 0;
    white-space: nowrap;
    border-collapse: collapse;
    width: 100%;
}

.report-533m-table th,
.report-533m-table td {
    padding: 4px 8px;
    border: 1px solid #bfc8d1;
    vertical-align: middle;
}

.report-533m-table thead th {
    position: sticky;
    top: 0;
    background: #dce4ed;
    font-weight: 600;
    font-size: 0.75rem;
    border-bottom: 2px solid #9aabbf;
    z-index: 2;
    text-align: center;
}

.report-533m-table thead th:first-child {
    text-align: left;
    min-width: 160px;
}

.report-533m-table .text-money {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.report-533m-contractor-header td {
    background: linear-gradient(135deg, #3a5a8c, #4a6fa5);
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    border-color: #2d4a73;
}

.report-533m-section-header td {
    background-color: #d6e4f0;
    font-weight: 600;
    font-size: 0.78rem;
    color: #1f3864;
}

.report-533m-table tbody tr.data-row:nth-child(even) {
    background-color: #f9fbfd;
}

.report-533m-table tbody tr.data-row:hover {
    background-color: #e8f0fa;
}

.report-533m-subtotal td {
    background-color: #e8edf3;
    font-weight: 600;
    border-top: 2px solid #9aabbf;
}

.report-533m-contractor-total td {
    background-color: #e2efda;
    font-weight: 700;
    border-top: 2px solid #7dac6e;
}

.report-533m-grand-total td {
    background-color: #4a8c4a;
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    border-top: 3px double #2d5a2d;
}

.subtask-toggle-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 0;
}

.subtask-toggle-bar .btn {
    font-size: 0.78rem;
    padding: 3px 10px;
}
