/* app/static/css/styles.css */

/* --- General & Body Styles --- */
body {
    background-color: #f8f9fa;
    min-height: 100vh;
}

/* --- Login & Dashboard Styles --- */
.login-container { max-width: 400px; margin-top: 5rem; }
.report-card:hover { transform: translateY(-5px); box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important; }

/* --- Main Report Layout --- */
.report-layout {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    height: 70vh;
}

/* Table container now uses flex-grow */
.table-responsive {
    overflow: auto;
}

/* Static Summary Panel on the right */
.summary-container {
    flex-shrink: 0;
    width: 350px;
    padding: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background-color: #ffffff;
    overflow-y: auto;
}

#summary-placeholder {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    text-align: center;
}

/* --- Heatmap Table Styles --- */
.heatmap-table {
    table-layout: fixed;
    width: 100%;
    border-collapse: collapse;
}

.heatmap-table th, .heatmap-table td {
    text-align: center;
    vertical-align: middle;
    font-size: 0.8rem;
    white-space: nowrap;
    padding: 0 !important;
    min-width: 50px;
    border: 1px solid #dee2e6;
}

/* --- STICKY HEADER & COLUMN (FREEZE PANES) LOGIC --- */
.heatmap-table thead th {
    position: -webkit-sticky;
    position: sticky;
    background-color: #e9ecef;
    z-index: 4;
}

.heatmap-table thead tr:nth-child(2) th {
    top: 0;
    height: 30px;
}

.heatmap-table thead tr:nth-child(3) th {
    top: 30px;
}

/* Sticky Columns */
.employee-col, .task-col {
    position: -webkit-sticky;
    position: sticky;
    z-index: 2;
    background-color: #f8f9fa;
}

.employee-col {
    width: 150px;
    font-weight: bold;
    left: 0;
}

.employee-col[rowspan] {
    vertical-align: middle !important;
    text-align: center !important;
}

.task-col {
    width: 250px;
    text-align: left !important;
    white-space: normal !important; 
    word-break: break-word;
    overflow-wrap: break-word;
    left: 150px;
    vertical-align: top !important;
}

.task-col > div {
    max-height: 50px;
    overflow-y: auto;
    padding: 4px;
}

.heatmap-table td:not(.task-col) { padding: 4px !important; }
.heatmap-table th { padding: 4px !important; }

.heatmap-table thead .employee-col,
.heatmap-table thead .task-col {
    z-index: 5 !important;
}

/* --- Floating Legend Button --- */
.floating-legend-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    z-index: 1050;
}

/* Legend item styling */
.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
}
.legend-item .task-marker {
    margin-right: 12px;
    cursor: default;
}

/* --- Task Marker & Status Color Styles --- */
.task-marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 0; /* Square icons */
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    position: relative;
}

.marker-proof {
    border: 2px solid white;
    box-shadow: 0 0 0 1.5px currentColor;
}

/* Status Colors */
.status-empty { background-color: transparent; }
.status-unknown { background-color: #95a5a6; }
.status-not-started { background-color: #e74c3c; }
.status-dropped { background-color: #7f8c8d; }
.status-delayed { background-color: #f39c12; }
.status-on-time { background-color: #2ecc71; }
.status-anomaly { background-color: #9b59b6; }
.status-flagged { background-color: #c0392b; }
.status-audited { background-color: #3498db; }
.status-submitted { background-color: #1abc9c; }
.status-pending { background-color: #e67e22; }

.marker-proof-legend { 
    background-color: #f8f9fa !important; 
    border: 2px solid #6c757d;
    box-shadow: 0 0 0 1.5px #f8f9fa;
}

/* --- Other Styles --- */
.filter-bar { background-color: #ffffff; padding: 1rem; border-radius: 0.5rem; border: 1px solid #dee2e6; }
.employee-name-link { text-decoration: none; cursor: pointer; color: inherit; }
.employee-name-link:hover { text-decoration: underline; }

.employee-row-selected {
    background-color: #cfe2ff !important;
}

.popover-header { background-color: #343a40; color: white; }

.summary-proofs a {
    margin-right: 8px;
}

#summary-task-list .list-group-item {
    padding-left: 0;
    padding-right: 0;
}

.print-only { display: none; }

/* --- PRINT STYLES --- */
.print-header-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    padding: 0.5rem;
    justify-content: center;
    font-weight: normal;
    text-align: left;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}

@media print { 
    .no-print { 
        display: none !important; 
    } 
    .print-only { 
        display: table-row !important;
    }
    
    body, .report-layout, .table-responsive, .card, .card-body {
        height: auto !important;
        overflow: visible !important;
    }

    .card {
        border: none !important;
        box-shadow: none !important;
    }

    .heatmap-table thead {
        display: table-header-group;
    }

    .heatmap-table thead th, .employee-col, .task-col {
        position: static !important;
    }
    
    /* --- REVISED COLUMN WIDTHS FOR PRINTING --- */

    /* 1. Force the table to be as wide as its content, preventing "shrink-to-fit" */
    .heatmap-table {
        width: max-content !important;
    }

    /* 2. Set the requested width for the Employee column */
    .heatmap-table .employee-col {
        width: 5cm !important;
    }

    /* 3. Set the requested width for the Task Description column */
    .heatmap-table .task-col {
        width: 7cm !important;
        font-weight: 600 !important;
    }

    /* 4. Set a small width for the date columns */
    .heatmap-table th:not(.employee-col):not(.task-col),
    .heatmap-table td:not(.employee-col):not(.task-col) {
        width: 0.8cm !important;
        font-size: 8pt !important;
    }
    
    /* 5. Ensure full description is visible vertically */
    .heatmap-table .task-col > div {
        max-height: none !important;
        overflow-y: visible !important;
    }
}