/* NHS Ambulance Operations Dashboard - Wide Screen Optimised */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #ffffff;
    overflow-x: hidden;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    width: 100vw;
}

/* Dashboard Container */
.dashboard-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Header Styles */
/* Dashboard Header */
.dashboard-header {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    height: 60px;
    min-height: 60px;
}

.header-left h1 {
    font-size: 1.5rem;
    color: #ffffff;
    margin-bottom: 0.1rem;
}

.header-left h1 i {
    color: #ff6b6b;
    margin-right: 0.5rem;
}

.timestamp {
    font-size: 0.9rem;
    color: #b8c5d6;
}

.header-center {
    flex-grow: 1;
    display: flex;
    justify-content: center;
}

.alert-level {
    padding: 0.5rem 1.5rem;
    border-radius: 25px;
    font-weight: bold;
    text-align: center;
    animation: pulse 2s infinite;
}

.alert-level.green {
    background: #28a745;
    border: 2px solid #34ce57;
}

.alert-level.yellow {
    background: #ffc107;
    border: 2px solid #ffcd39;
    color: #000;
}

.alert-level.orange {
    background: #fd7e14;
    border: 2px solid #ff8c42;
}

.alert-level.red {
    background: #dc3545;
    border: 2px solid #e74c3c;
    animation: flashRed 1s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

@keyframes flashRed {
    0% { background: #dc3545; }
    50% { background: #ff1744; }
    100% { background: #dc3545; }
}

.header-right {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.active-calls, .available-units {
    text-align: center;
}

.label {
    display: block;
    font-size: 0.8rem;
    color: #b8c5d6;
    margin-bottom: 0.2rem;
}

.count {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: #61dafb;
}

/* Main Dashboard Grid - 3x2 + Map */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 2fr;
    grid-template-rows: 1fr 1fr;
    gap: 0.75rem;
    padding: 0.75rem;
    flex: 1;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
    height: calc(100vh - 100px);
}

/* Optimize for ultra-wide screens */
@media (min-width: 2560px) {
    .dashboard-grid {
        grid-template-columns: 1fr 1fr 1fr 2fr;
        max-width: none;
        width: 100%;
    }
}

/* Panel Base Styles */
.panel {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

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

.panel h2 {
    margin-bottom: 0.75rem;
    color: #ffffff;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.4rem;
}

.panel h2 i {
    color: #61dafb;
}

/* Emergency Calls Panel - Top Left */
.emergency-calls {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
}

.calls-list {
    max-height: calc(50vh - 80px);
    overflow-y: auto;
}

.call-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    border-left: 4px solid;
}

.call-item.priority-1 {
    border-left-color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.call-item.priority-2 {
    border-left-color: #fd7e14;
    background: rgba(253, 126, 20, 0.1);
}

.call-item.priority-3 {
    border-left-color: #ffc107;
    background: rgba(255, 193, 7, 0.1);
}

.call-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.call-id {
    color: #61dafb;
}

.priority {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.time {
    color: #b8c5d6;
    font-size: 0.9rem;
}

.call-details {
    margin-bottom: 0.5rem;
}

.location {
    font-weight: bold;
    color: #ffffff;
    margin-bottom: 0.3rem;
}

.description {
    color: #b8c5d6;
    font-size: 0.9rem;
}

.response-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #61dafb;
}

/* Fleet Status Panel - Top Center */
.fleet-status {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
}

.fleet-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    max-height: calc(50vh - 80px);
    overflow-y: auto;
}

.vehicle-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 0.75rem;
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
}

.vehicle-card.status-available {
    border-color: #28a745;
}

.vehicle-card.status-enroute {
    border-color: #ffc107;
}

.vehicle-card.status-onscene {
    border-color: #fd7e14;
}

.vehicle-card.status-transport {
    border-color: #6f42c1;
}

.vehicle-card.status-maintenance {
    border-color: #6c757d;
}

.vehicle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.vehicle-id {
    font-weight: bold;
    font-size: 1.1rem;
    color: #61dafb;
}

.status {
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
}

.status-available .status {
    background: #28a745;
    color: white;
}

.status-enroute .status {
    background: #ffc107;
    color: black;
}

.status-onscene .status {
    background: #fd7e14;
    color: white;
}

.status-transport .status {
    background: #6f42c1;
    color: white;
}

.status-maintenance .status {
    background: #6c757d;
    color: white;
}

.vehicle-info {
    margin-bottom: 0.75rem;
}

.vehicle-info > div {
    margin-bottom: 0.3rem;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.vehicle-info i {
    width: 12px;
    color: #61dafb;
}

.vehicle-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #b8c5d6;
}

/* Performance Metrics Panel - Top Right */
.metrics-personnel, .metrics {
    grid-column: 3 / 4;
    grid-row: 1 / 2;
    display: block;
}

.metrics-section {
    height: 100%;
}

.metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    height: calc(50vh - 120px);
}

.metric-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 0.5rem;
    text-align: center;
}

.metric-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #61dafb;
    margin-bottom: 0.1rem;
    line-height: 1;
}

.metric-label {
    font-size: 0.7rem;
    color: #b8c5d6;
    margin-bottom: 0.2rem;
    line-height: 1;
}

.metric-trend {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    line-height: 1;
}

.metric-trend.positive {
    background: rgba(40, 167, 69, 0.2);
    color: #28a745;
}

.metric-trend.negative {
    background: rgba(220, 53, 69, 0.2);
    color: #dc3545;
}

.metric-trend.neutral {
    background: rgba(108, 117, 125, 0.2);
    color: #6c757d;
}

/* Personnel Panel - Bottom Left */
.personnel {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
    margin-top: 0;
}

.personnel h2, .personnel h3 {
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
    color: #ffffff;
}

.personnel-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.3rem;
    max-height: calc(50vh - 80px);
    overflow-y: auto;
}

.personnel-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #61dafb;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-size: 0.8rem;
}

.person-info {
    flex-grow: 1;
}

.name {
    font-weight: bold;
    color: #ffffff;
    font-size: 0.7rem;
    margin-bottom: 0.05rem;
    line-height: 1;
}

.role {
    color: #b8c5d6;
    font-size: 0.6rem;
    margin-bottom: 0.05rem;
    line-height: 1;
}

.person-info .status {
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
}

.shift-info {
    text-align: right;
    font-size: 0.6rem;
    color: #b8c5d6;
    line-height: 1;
}

/* Recent Activity Panel - Bottom Center-Right */
.recent-activity {
    grid-column: 2 / 4;
    grid-row: 2 / 3;
    max-height: calc(50vh - 40px);
}

.activity-feed {
    max-height: calc(50vh - 80px);
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.activity-time {
    font-size: 0.75rem;
    color: #b8c5d6;
    min-width: 35px;
}

.activity-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(97, 218, 251, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #61dafb;
    font-size: 0.8rem;
}

.activity-content {
    flex-grow: 1;
}

.activity-title {
    font-weight: bold;
    color: #ffffff;
    font-size: 0.8rem;
    margin-bottom: 0.1rem;
}

.activity-description {
    color: #b8c5d6;
    font-size: 0.75rem;
}

/* Map Panel - Full Height Right Side */
.map-panel {
    grid-column: 4 / 5;
    grid-row: 1 / 3;
}

.leaflet-map {
    height: 100%;
    min-height: calc(100vh - 140px);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.map-placeholder {
    height: 100%;
    min-height: 400px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.map-content {
    text-align: center;
    color: #b8c5d6;
}

.map-content i {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    color: #61dafb;
}

.map-legend {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.8);
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    z-index: 1000;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
    color: #ffffff;
}

.legend-item:last-child {
    margin-bottom: 0;
}

/* Footer */
.dashboard-footer {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.8rem;
    color: #b8c5d6;
    height: 40px;
    min-height: 40px;
}

.status-indicator {
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-weight: bold;
}

.status-indicator.online {
    background: #28a745;
    color: white;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: rgba(97, 218, 251, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(97, 218, 251, 0.5);
}

/* Responsive adjustments for smaller wide screens */
@media (max-width: 1920px) and (min-width: 1400px) {
    .dashboard-grid {
        grid-template-columns: 1fr 1fr 1fr 2fr;
    }
}

@media (max-width: 1399px) and (min-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 1fr 1fr 1fr;
        grid-template-rows: auto auto auto;
    }
    
    .emergency-calls {
        grid-column: 1 / 2;
        grid-row: 1 / 2;
    }
    
    .fleet-status {
        grid-column: 2 / 4;
        grid-row: 1 / 2;
    }
    
    .fleet-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
    
    .metrics {
        grid-column: 1 / 2;
        grid-row: 2 / 3;
    }
    
    .personnel {
        grid-column: 2 / 3;
        grid-row: 2 / 3;
    }
    
    .recent-activity {
        grid-column: 3 / 4;
        grid-row: 2 / 3;
    }
    
    .map-panel {
        grid-column: 1 / 4;
        grid-row: 3 / 4;
    }
    
    .map-placeholder {
        height: 200px;
        min-height: 200px;
    }
}

@media (max-width: 1199px) {
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto auto;
    }
    
    .emergency-calls {
        grid-column: 1 / 2;
        grid-row: 1 / 2;
    }
    
    .fleet-status {
        grid-column: 2 / 3;
        grid-row: 1 / 3;
    }
    
    .fleet-grid {
        grid-template-columns: 1fr;
    }
    
    .metrics {
        grid-column: 1 / 2;
        grid-row: 2 / 3;
    }
    
    .personnel {
        grid-column: 1 / 2;
        grid-row: 3 / 4;
    }
    
    .recent-activity {
        grid-column: 2 / 3;
        grid-row: 3 / 4;
    }
    
    .map-panel {
        grid-column: 1 / 3;
        grid-row: 4 / 5;
    }
    
    .map-placeholder {
        height: 180px;
        min-height: 180px;
    }
}

/* Animation for critical alerts */
.critical-alert {
    animation: criticalFlash 0.5s infinite alternate;
}

@keyframes criticalFlash {
    from { background-color: rgba(220, 53, 69, 0.3); }
    to { background-color: rgba(220, 53, 69, 0.7); }
}