/* Site-specific styles */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.page-header {
    margin-bottom: 30px;
    text-align: center;
}

.page-header h1 {
    color: var(--primary-color);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.page-header p {
    color: var(--text-light);
    margin: 0;
}

/* Controls Section */
.controls-section {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background-color: var(--background-light);
    border-radius: var(--border-radius-md);
    align-items: end;
}

/* Pathway Buttons */
.pathway-buttons-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pathway-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pathway-btn {
    padding: 8px 16px;
    border: 2px solid #6c757d;
    border-radius: var(--border-radius-sm);
    background-color: #f8f9fa;
    color: #495057;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    user-select: none;
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 36px;
}

.pathway-btn:hover {
    border-color: #495057;
    background-color: #e9ecef;
    transform: translateY(-1px);
}

.pathway-btn.active {
    background-color: var(--success-color);
    border-color: var(--success-color);
    color: white;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

.pathway-btn.active:hover {
    background-color: #388e3c;
    border-color: #388e3c;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(76, 175, 80, 0.4);
}

/* Allocation Filter Buttons */
.allocation-filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.allocation-filter-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.allocation-filter-btn {
    padding: 6px 12px;
    border: 2px solid #6c757d;
    background: white;
    color: #6c757d;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.allocation-filter-btn:hover {
    background: #e9ecef;
    border-color: #495057;
    color: #495057;
}

.allocation-filter-btn.active {
    background: #28a745;
    border-color: #28a745;
    color: white;
}

.allocation-filter-btn.active:hover {
    background: #218838;
    border-color: #218838;
}

.control-group {
    display: flex;
    flex-direction: column;
    min-width: 150px;
}

.control-group label {
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 5px;
}

.form-control {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background-color: var(--white);
    font-size: 14px;
    transition: border-color var(--transition-normal);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.2);
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

/* Timeline Section */
.timeline-section {
    margin-bottom: 30px;
}

.timeline-info {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: var(--background-light);
    border-radius: var(--border-radius-sm);
    flex-wrap: wrap;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-label {
    font-weight: 600;
    color: var(--text-color);
}

.info-value {
    color: var(--primary-color);
    font-weight: 500;
}

/* Timeline Container - Single Grid Approach */
.timeline-container {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    background-color: var(--white);
    position: relative;
    width: 100%;
    height: 80vh;
}

/* Timeline Table Wrapper - Single Scroll Container */
.timeline-table-wrapper {
    width: 100%;
    height: 100%;
    overflow: auto;
    position: relative;
    background-color: var(--white);
}

/* Timeline Grid - Single Container for Everything */
.timeline-grid {
    display: grid;
    grid-template-columns: 180px 80px 60px repeat(var(--timeline-months, 12), 60px);
    min-width: max-content;
    position: relative;
}

/* Grid Items - All cells */
.grid-cell {
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    padding: 8px 4px;
    box-sizing: border-box;
    min-height: 40px;
    position: relative;
}

/* Header Row Styling */
.grid-cell.header {
    background-color: var(--primary-color);
    color: var(--white);
    font-weight: 600;
    padding: 12px 8px;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Sticky Left Columns */
.grid-cell.sticky-name {
    position: sticky;
    left: 0;
    z-index: 15;
    background-color: var(--white);
    justify-content: flex-start;
    padding-left: 12px;
    padding-right: 8px;
}

.grid-cell.sticky-grade {
    position: sticky;
    left: 180px;
    z-index: 15;
    background-color: var(--white);
}

.grid-cell.sticky-wte {
    position: sticky;
    left: 260px;
    z-index: 15;
    background-color: var(--white);
}

/* Header AND Sticky Intersection */
.grid-cell.header.sticky-name {
    background-color: var(--primary-color);
    z-index: 25;
}

.grid-cell.header.sticky-grade {
    background-color: var(--primary-color);
    z-index: 25;
}

.grid-cell.header.sticky-wte {
    background-color: var(--primary-color);
    z-index: 25;
}

/* Month Header Styling */
.grid-cell.header.month {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    flex-direction: column;
    gap: 2px;
    padding: 8px 4px;
}

/* Data Row Styling - Only apply to non-timeline cells */
.grid-cell.data:not(.timeline) {
    background-color: var(--white);
}

/* Alternating Row Colors - Only apply to non-timeline cells */
.grid-cell.data.row-even:not(.timeline) {
    background-color: #f8f9fa;
}

.grid-cell.sticky-name.row-even,
.grid-cell.sticky-grade.row-even,
.grid-cell.sticky-wte.row-even {
    background-color: #f8f9fa;
}

/* Timeline Cell Specific */
.grid-cell.timeline {
    position: relative;
    cursor: help;
    padding: 2px;
}

.grid-cell.timeline.empty {
    background-color: #f8f9fa !important;
    opacity: 0.5;
}

.grid-cell.timeline.start-period {
    border-left: 3px solid var(--primary-color);
}

/* Totals Row */
.grid-cell.totals {
    background-color: var(--background-light);
    font-weight: 600;
    color: var(--text-color);
    padding: 10px 4px;
    border-top: 2px solid var(--primary-color);
    position: sticky;
    bottom: 0;
    z-index: 10;
}

.grid-cell.totals.sticky-name,
.grid-cell.totals.sticky-grade,
.grid-cell.totals.sticky-wte {
    background-color: var(--background-light);
    z-index: 20;
}

.grid-cell.totals.label {
    grid-column: 1 / 4;
    justify-content: flex-start;
    padding-left: 12px;
    color: var(--primary-color);
}

/* Content Styling */
.trainee-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    display: block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trainee-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.wte-full-time {
    color: var(--text-light);
    font-style: italic;
}

.wte-part-time {
    color: var(--warning-color);
    font-weight: 600;
}

.cell-text {
    font-size: 10px;
    font-weight: 600;
    display: block;
    line-height: 1.2;
}

/* DGH-specific cell text styling */
.cell-text[data-dgh="true"],
.grid-cell.timeline .cell-text:contains("DGH→"),
.grid-cell.timeline .cell-text:contains("DGH←") {
    background-color: rgba(255, 152, 0, 0.9);
    color: white;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    box-shadow: 0 1px 3px rgba(255, 152, 0, 0.4);
    border: 1px solid #e65100;
}

.grade-change {
    font-size: 10px;
    font-weight: 700;
    color: var(--white);
    background-color: rgba(0,0,0,0.8);
    padding: 2px 4px;
    border-radius: 3px;
    position: absolute;
    top: 2px;
    right: 2px;
    line-height: 1;
    min-width: 16px;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.wte-change {
    font-size: 9px;
    font-weight: 700;
    color: var(--danger-color);
    background-color: rgba(255,255,255,0.9);
    padding: 1px 3px;
    border-radius: 2px;
    position: absolute;
    bottom: 2px;
    left: 2px;
    line-height: 1;
    border: 1px solid var(--danger-color);
    min-width: 12px;
    text-align: center;
}

/* Upcoming grade change indicator */
.upcoming-grade-change {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 9px;
    font-weight: 700;
    color: #ff6f00;
    background-color: rgba(255, 111, 0, 0.15);
    padding: 1px 3px;
    border-radius: 2px;
    border: 1px dashed #ff6f00;
    line-height: 1;
    white-space: nowrap;
    z-index: 3;
    min-width: 12px;
    text-align: center;
}

.grid-cell.timeline.has-upcoming-grade-change {
    position: relative;
    border-right: 4px solid #ff6f00 !important;
}

.grid-cell.timeline.has-upcoming-grade-change::after {
    content: '';
    position: absolute;
    right: -4px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, transparent 0%, #ff6f00 50%, transparent 100%);
    opacity: 0.6;
}

/* Special styling for End of Training cells */
.grid-cell.timeline.eot-cell {
    border: 3px solid #4caf50 !important;
    box-shadow: 0 0 6px rgba(76, 175, 80, 0.5);
}

.grid-cell.timeline.eot-cell .cell-text {
    font-weight: 800;
    color: #2e7d32;
    text-shadow: 0 0 2px rgba(255,255,255,0.8);
}

/* DGH Timeline Cells */
.grid-cell.timeline.dgh-period {
    border: 2px solid #ff9800;
    background-color: rgba(255, 152, 0, 0.05);
    position: relative;
}

.grid-cell.timeline.dgh-base-site {
    border-left: 4px solid #ff6f00;
    background-color: rgba(255, 111, 0, 0.1);
}

.grid-cell.timeline.dgh-receiving-site {
    border-right: 4px solid #ff6f00;
    background-color: rgba(255, 111, 0, 0.1);
}

.dgh-arrow-to::before {
    content: "→";
    color: #ff6f00;
    font-weight: 900;
    font-size: 12px;
    margin-right: 2px;
}

.dgh-arrow-from::before {
    content: "←";
    color: #ff6f00;
    font-weight: 900;
    font-size: 12px;
    margin-right: 2px;
}

/* Enhanced grade change cells */
.grid-cell.timeline.grade-change-cell {
    border: 2px solid var(--warning-color);
    position: relative;
}

.grid-cell.timeline.grade-promotion {
    border: 2px solid var(--success-color);
    background-color: rgba(76, 175, 80, 0.1);
}

.grid-cell.timeline.grade-change-other {
    border: 2px solid var(--info-color);
    background-color: rgba(33, 150, 243, 0.1);
}

.grid-cell.timeline.grade-change-pending {
    position: relative;
}

.grid-cell.timeline.grade-change-pending::after {
    content: '';
    position: absolute;
    right: -2px;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: #FF6B35;
    border-radius: 0 4px 4px 0;
}

.future-grade-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background-color: #FF6B35;
    color: white;
    font-size: 9px;
    padding: 1px 3px;
    border-radius: 2px;
    font-weight: bold;
    opacity: 0.9;
}

.future-grade-change-after-site {
    background-color: rgba(255, 107, 53, 0.1);
    border-left: 3px solid #FF6B35;
}

/* Sortable headers */
.sortable-header {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.sortable-header:hover {
    background-color: var(--primary-hover);
}

.sort-indicator {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    opacity: 0.7;
}

/* Month header content */
.month-name {
    font-size: 11px;
    font-weight: 700;
}

.year {
    font-size: 9px;
    opacity: 0.8;
}

/* Fallback table styles (hidden by default) */
.timeline-table {
    display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .timeline-container {
        height: 70vh;
    }
    
    .timeline-grid {
        grid-template-columns: 140px 60px 50px repeat(var(--timeline-months, 12), 50px);
    }
    
    .grid-cell.sticky-grade {
        left: 140px;
    }
    
    .grid-cell.sticky-wte {
        left: 200px;
    }
    
    .grid-cell.totals.label {
        grid-column: 1 / 4;
    }
}

/* Legend Section */
.legend-section {
    margin-top: 30px;
    padding: 20px;
    background-color: var(--background-light);
    border-radius: var(--border-radius-md);
}

.legend-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--text-color);
}

.legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.legend-color {
    width: 20px;
    height: 15px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
}

.legend-border {
    width: 20px;
    height: 15px;
    border: 1px solid var(--border-color);
    background-color: var(--white);
    position: relative;
}

.thick-border::after {
    content: '';
    position: absolute;
    right: -1px;
    top: 0;
    width: 3px;
    height: 100%;
    background-color: #333;
}

.legend-text {
    font-family: monospace;
    font-weight: bold;
    color: var(--danger-color);
    padding: 2px 6px;
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 3px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    background-color: var(--white);
    padding: 30px;
    border-radius: var(--border-radius-md);
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.loading-spinner i {
    font-size: 24px;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.loading-spinner span {
    display: block;
    color: var(--text-color);
    font-weight: 500;
}

/* Color Classes for Training Types */
.status-mat { background-color: #e91e63 !important; color: white; }
.status-skl { background-color: #ff5722 !important; color: white; }
.status-lat { background-color: #795548 !important; color: white; }
.status-acl { background-color: #4caf50 !important; color: white; }
.status-phr { background-color: #2196f3 !important; color: white; }
.status-oop { background-color: #9c27b0 !important; color: white; }
.status-oope { background-color: #ff9800 !important; color: white; }
.status-oopr { background-color: #607d8b !important; color: white; }
.status-oopt { background-color: #009688 !important; color: white; }
.status-ext { background-color: #673ab7 !important; color: white; }
.status-icm1 { background-color: #3f51b5 !important; color: white; }
.status-icm2 { background-color: #3f51b5 !important; color: white; }
.status-icm3 { background-color: #3f51b5 !important; color: white; }
.status-las { background-color: #8bc34a !important; color: white; }
.status-pat { background-color: #00bcd4 !important; color: white; }
.status-shp { background-color: #ff4081 !important; color: white; }
.status-ltft { background-color: #ffc107 !important; color: black; }
.status-cct { background-color: #4caf50 !important; color: white; }

/* Responsive Design */
@media (max-width: 1200px) {
    .container {
        max-width: 100%;
        padding: 15px;
    }
    
    .controls-section {
        gap: 15px;
    }
    
    .control-group {
        min-width: 120px;
    }
}

@media (max-width: 480px) {
    .page-header h1 {
        font-size: 1.5rem;
        flex-direction: column;
        gap: 5px;
    }
    
    .timeline-table th {
        padding: 8px 4px;
    }
    
    .trainee-row td {
        padding: 6px 2px;
        height: 35px;
    }
    
    .cell-text {
        font-size: 9px;
    }
    
    .grade-change,
    .wte-change {
        font-size: 7px;
    }
} 