/* 
 * Pythagoras APTMS - Advanced Public Transport Management System
 * Scheduling & Performance Module Styles
 */

.dashboard-stat-card {
    padding: 20px;
    background-color: white;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    margin-bottom: 20px;
}

.dark-mode .dashboard-stat-card {
    background-color: #1e1e1e;
}

/* Schedule Overview Stats */
.stat-grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-box {
    display: flex;
    align-items: center;
    padding: 15px;
    border-radius: 8px;
    background-color: #f9f9f9;
    transition: transform 0.2s, box-shadow 0.2s;
}

.dark-mode .stat-box {
    background-color: #2a2a2a;
}

.stat-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.stat-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 8px;
    background-color: rgba(var(--primary-rgb), 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
}

.stat-icon i {
    font-size: 24px;
    color: var(--primary-color);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 500;
    margin-bottom: 5px;
    line-height: 1;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--light-text);
}

.quick-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* On-Time Performance */
.performance-gauge-container {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.performance-gauge {
    width: 140px;
    min-width: 140px;
    margin-right: 20px;
}

.gauge {
    width: 100%;
    height: auto;
}

.gauge-background {
    fill: none;
    stroke: #eee;
    stroke-width: 5;
}

.gauge-value {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 5;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: center;
    transition: stroke-dasharray 0.8s ease;
}

.gauge-percentage {
    font-family: Arial, sans-serif;
    font-size: 12px;
    font-weight: bold;
    text-anchor: middle;
    fill: var(--text-color);
    dominant-baseline: middle;
}

.gauge-label {
    font-family: Arial, sans-serif;
    font-size: 6px;
    text-anchor: middle;
    fill: var(--light-text);
    dominant-baseline: middle;
}

.performance-breakdown {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.breakdown-item {
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    min-width: 90px;
}

.breakdown-item.on-time {
    background-color: rgba(15, 157, 88, 0.1);
}

.breakdown-item.early {
    background-color: rgba(66, 133, 244, 0.1);
}

.breakdown-item.late {
    background-color: rgba(219, 68, 55, 0.1);
}

.percentage {
    display: block;
    font-size: 1.4rem;
    font-weight: 500;
    margin-bottom: 5px;
}

.breakdown-item.on-time .percentage {
    color: var(--success-color);
}

.breakdown-item.early .percentage {
    color: var(--info-color);
}

.breakdown-item.late .percentage {
    color: var(--error-color);
}

.performance-trend {
    margin-top: 20px;
}

/* Upcoming Departures */
.departures-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.current-time {
    font-size: 1.4rem;
    font-weight: 500;
}

.location-selector {
    width: 180px;
}

.departures-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.departures-table thead th {
    background-color: rgba(var(--primary-rgb), 0.05);
    color: var(--text-color);
    font-weight: 500;
    padding: 12px 15px;
}

.departure-row td {
    padding: 12px 15px;
}

.route-name {
    font-weight: 500;
}

.departure-time {
    white-space: nowrap;
}

.scheduled-time {
    font-weight: 500;
}

.predicted-time {
    font-size: 0.9rem;
    color: var(--light-text);
}

.predicted-time .late {
    color: var(--error-color);
}

.status {
    white-space: nowrap;
}

.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-indicator.on-time {
    background-color: var(--success-color);
}

.status-indicator.delayed {
    background-color: var(--warning-color);
}

.status-indicator.cancelled {
    background-color: var(--error-color);
}

.load-bar {
    height: 8px;
    background-color: #eee;
    border-radius: 4px;
    overflow: hidden;
}

.load-fill {
    height: 100%;
    border-radius: 4px;
    background-color: var(--primary-color);
}

/* Schedule Adherence */
.adherence-container {
    margin-bottom: 20px;
}

.time-filter {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 20px;
    gap: 10px;
}

.chip {
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.adherence-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.adherence-table thead th {
    background-color: rgba(var(--primary-rgb), 0.05);
    color: var(--text-color);
    font-weight: 500;
    padding: 12px 15px;
}

.adherence-table td {
    padding: 12px 15px;
}

.percentage-bar {
    position: relative;
    height: 24px;
    background-color: #f5f5f5;
    border-radius: 4px;
    overflow: hidden;
}

.percentage-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: var(--success-color);
    border-radius: 4px;
}

.percentage-value {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
}

.percentage-breakdown {
    display: flex;
    height: 4px;
    margin-top: 5px;
    border-radius: 2px;
    overflow: hidden;
}

.percentage-breakdown .early {
    background-color: var(--info-color);
}

.percentage-breakdown .on-time {
    background-color: var(--success-color);
}

.percentage-breakdown .late {
    background-color: var(--error-color);
}

.trips-completed {
    font-weight: 500;
    text-align: center;
}

.completion-rate {
    font-size: 0.9rem;
    color: var(--light-text);
}

/* Prediction Map */
.prediction-map-container {
    margin-bottom: 20px;
}

.map-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.map-filter {
    width: 180px;
}

.prediction-toggle {
    display: flex;
    align-items: center;
}

.map-status {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--light-text);
}

.status-indication {
    display: flex;
    gap: 15px;
}

.status-item {
    display: flex;
    align-items: center;
}

.on-time-indicator, .early-indicator, .late-indicator, .prediction-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}

.on-time-indicator {
    background-color: var(--success-color);
}

.early-indicator {
    background-color: var(--info-color);
}

.late-indicator {
    background-color: var(--error-color);
}

.prediction-indicator {
    background-color: var(--warning-color);
    border-radius: 2px;
}

/* Widget Footer */
.widget-footer {
    text-align: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--divider-color);
}

.widget-action {
    color: var(--primary-color);
    font-weight: 500;
    margin: 0 10px;
}

.widget-action:hover {
    text-decoration: underline;
}

/* Driver Management Styles */
.driver-management-container {
    padding: 10px 0;
}

.driver-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 500;
    margin: 15px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--divider-color);
}

.active-drivers-table-container {
    overflow-x: auto;
    margin-bottom: 15px;
}

.active-drivers-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.active-drivers-table thead th {
    background-color: rgba(var(--primary-rgb), 0.05);
    padding: 12px 15px;
    font-weight: 500;
}

.active-drivers-table tbody td {
    padding: 12px 15px;
    vertical-align: middle;
}

.driver-info {
    min-width: 150px;
}

.driver-name {
    font-weight: 500;
}

.driver-id {
    font-size: 0.85rem;
    color: var(--light-text);
}

.driver-status {
    white-space: nowrap;
}

.status-indicator.on-duty {
    background-color: var(--success-color);
}

.status-indicator.off-duty {
    background-color: var(--light-text);
}

.status-indicator.break {
    background-color: var(--warning-color);
}

.status-text {
    font-size: 0.9rem;
}

.driver-assignment {
    min-width: 140px;
}

.driver-assignment .route {
    font-weight: 500;
}

.driver-assignment .vehicle {
    font-size: 0.85rem;
    color: var(--light-text);
}

.driver-hours {
    min-width: 130px;
}

.hours-today {
    font-weight: 500;
}

.hours-week {
    font-size: 0.85rem;
    color: var(--light-text);
}

.driver-performance {
    min-width: 120px;
}

.performance-bar {
    height: 8px;
    background-color: #eee;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.performance-fill {
    height: 100%;
    background-color: var(--success-color);
    border-radius: 4px;
}

.performance-value {
    font-size: 0.9rem;
    font-weight: 500;
    text-align: right;
}

.driver-actions {
    white-space: nowrap;
    text-align: right;
}

.driver-actions .btn-small {
    margin-left: 5px;
    width: 32px;
    height: 32px;
    padding: 0;
}

.driver-actions .view-btn {
    background-color: var(--info-color);
}

.driver-actions .edit-btn {
    background-color: var(--warning-color);
}

/* Responsive Adjustments */
@media only screen and (max-width: 992px) {
    .performance-gauge {
        margin: 0 auto 20px;
    }
    
    .performance-breakdown {
        justify-content: space-around;
    }
    
    .map-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .map-filter, .prediction-toggle {
        width: 100%;
    }
}

@media only screen and (max-width: 600px) {
    .stat-grid-4 {
        grid-template-columns: 1fr;
    }
    
    .departures-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .location-selector {
        width: 100%;
    }
    
    .status-indication {
        flex-wrap: wrap;
        margin-top: 5px;
    }
    
    .driver-stats {
        grid-template-columns: 1fr 1fr;
    }
}
