/* ============================================
   全局样式和重置
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8eef7 100%);
    color: #333;
    overflow: hidden;
}

/* ============================================
   仪表板容器
   ============================================ */
.dashboard-container {
    display: flex;
    width: 100%;
    height: 100%;
    gap: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8eef7 100%);
}

/* ============================================
   左侧面板 - 小车控制
   ============================================ */
.left-panel {
    flex: 0 0 380px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.car-display-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(30, 64, 175, 0.1);
    border: 1px solid rgba(30, 64, 175, 0.1);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: #1e40af;
    margin: 0;
}

/* 小车模型容器 */
.car-model-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8eef7 100%);
    border-radius: 12px;
    border: 2px solid #1e40af;
}

.car-model {
    width: 100%;
    max-width: 200px;
    height: auto;
    filter: drop-shadow(0 4px 8px rgba(30, 64, 175, 0.2));
}

.car-light {
    transition: fill 0.3s ease;
}

.car-light.on {
    fill: #fbbf24;
    filter: drop-shadow(0 0 8px #fbbf24);
}

/* 小车信息网格 */
.car-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    background: #f0f4ff;
    border-radius: 8px;
    border: 1px solid #1e40af;
    gap: 4px;
}

.info-label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.info-value {
    font-size: 20px;
    font-weight: 700;
    color: #1e40af;
}

.info-unit {
    font-size: 11px;
    color: #999;
}

/* 控制按钮 */
.control-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.forward-btn, .backward-btn {
    width: 100%;
}

.side-buttons {
    display: flex;
    gap: 12px;
    width: 100%;
    justify-content: center;
}

.side-buttons .control-btn {
    flex: 1;
}

.control-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.forward-btn, .backward-btn, .left-btn, .right-btn {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
}

.forward-btn:hover, .backward-btn:hover, .left-btn:hover, .right-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(30, 64, 175, 0.4);
}

.forward-btn:active, .backward-btn:active, .left-btn:active, .right-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.3);
}

.stop-btn {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.stop-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(249, 115, 22, 0.4);
}

.stop-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.3);
}

.btn-label {
    font-weight: 600;
}

/* ============================================
   右侧面板 - 数据面板
   ============================================ */
.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

/* 顶部标题栏 */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.08);
    border: 1px solid rgba(30, 64, 175, 0.1);
}

.dashboard-title {
    font-size: 24px;
    font-weight: 700;
    color: #1e40af;
    margin: 0;
}

.header-controls {
    display: flex;
    gap: 12px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: #f0f4ff;
    color: #1e40af;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: 1px solid #1e40af;
}

.icon-btn:hover {
    background: #1e40af;
    color: white;
    transform: scale(1.05);
}

.icon-btn:active {
    transform: scale(0.95);
}

/* 数据面板网格 */
.data-panels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
}

.data-panels-grid::-webkit-scrollbar {
    width: 8px;
}

.data-panels-grid::-webkit-scrollbar-track {
    background: transparent;
}

.data-panels-grid::-webkit-scrollbar-thumb {
    background: #1e40af;
    border-radius: 4px;
}

.data-panels-grid::-webkit-scrollbar-thumb:hover {
    background: #1e3a8a;
}

/* 数据卡片通用样式 */
.data-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 24px rgba(30, 64, 175, 0.1);
    border: 1px solid rgba(30, 64, 175, 0.1);
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all 0.3s ease;
}

.data-card:hover {
    box-shadow: 0 12px 32px rgba(30, 64, 175, 0.15);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f4ff;
}

.card-header .card-title {
    font-size: 16px;
    margin: 0;
}

.card-unit {
    font-size: 12px;
    color: #999;
    font-weight: 500;
}

.chart-control-btn {
    padding: 6px 12px;
    background: #f0f4ff;
    border: 1px solid #1e40af;
    color: #1e40af;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chart-control-btn:hover {
    background: #1e40af;
    color: white;
}

/* ============================================
   速度面板
   ============================================ */
.speed-gauge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.gauge-svg {
    width: 100%;
    height: 150px;
}

.gauge-value {
    font-size: 28px;
    font-weight: 700;
    color: #1e40af;
}

/* ============================================
   方向面板
   ============================================ */
.direction-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.direction-svg {
    width: 100%;
    height: 160px;
}

.direction-value {
    font-size: 24px;
    font-weight: 700;
    color: #1e40af;
}

/* ============================================
   电池面板
   ============================================ */
.battery-display {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.battery-bar-container {
    width: 100%;
    height: 24px;
    background: #f0f4ff;
    border-radius: 12px;
    border: 2px solid #1e40af;
    overflow: hidden;
    position: relative;
}

.battery-bar {
    height: 100%;
    background: linear-gradient(90deg, #1e40af 0%, #3b82f6 100%);
    border-radius: 10px;
    width: 100%;
    transition: width 0.3s ease;
    position: relative;
}

.battery-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.battery-value {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 4px;
}

.value-number {
    font-size: 24px;
    font-weight: 700;
    color: #1e40af;
}

.value-percent {
    font-size: 14px;
    color: #999;
}

.battery-status {
    text-align: center;
    font-size: 12px;
    color: #666;
}

/* ============================================
   障碍物检测面板
   ============================================ */
.obstacle-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.obstacle-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.obstacle-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
    animation: pulse 2s infinite;
}

.obstacle-circle.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

.obstacle-circle.danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.obstacle-text {
    font-size: 14px;
    font-weight: 600;
    color: #666;
}

.obstacle-distance {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 4px;
    font-size: 14px;
}

.distance-label {
    color: #666;
}

.distance-value {
    font-size: 20px;
    font-weight: 700;
    color: #1e40af;
}

.distance-unit {
    color: #999;
}

/* ============================================
   灯光状态面板
   ============================================ */
.light-display {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.light-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.toggle-btn {
    width: 60px;
    height: 32px;
    border: none;
    border-radius: 16px;
    background: #e8eef7;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    border: 2px solid #1e40af;
}

.toggle-btn.on {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
}

.toggle-indicator {
    position: absolute;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-btn.on .toggle-indicator {
    left: 32px;
}

.toggle-label {
    font-size: 14px;
    font-weight: 600;
    color: #666;
    min-width: 40px;
}

.light-brightness {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.brightness-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #f0f4ff;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.brightness-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(30, 64, 175, 0.3);
}

.brightness-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(30, 64, 175, 0.3);
}

.brightness-value {
    min-width: 35px;
    text-align: right;
    color: #1e40af;
    font-weight: 600;
}

/* ============================================
   传感器数据面板
   ============================================ */
.sensor-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sensor-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f0f4ff;
    border-radius: 8px;
    border-left: 4px solid #1e40af;
}

.sensor-name {
    font-size: 13px;
    color: #666;
    font-weight: 500;
    flex: 1;
}

.sensor-value {
    font-size: 16px;
    font-weight: 700;
    color: #1e40af;
    min-width: 50px;
    text-align: right;
}

.sensor-unit {
    font-size: 12px;
    color: #999;
    margin-left: 4px;
}

/* ============================================
   图表卡片
   ============================================ */
.chart-container {
    width: 100%;
    height: 200px;
    background: #f0f4ff;
    border-radius: 8px;
    border: 1px solid rgba(30, 64, 175, 0.1);
    overflow: hidden;
}

.chart-svg {
    width: 100%;
    height: 100%;
}

/* ============================================
   地图卡片
   ============================================ */
.map-container {
    width: 100%;
    height: 200px;
    background: #f0f4ff;
    border-radius: 8px;
    border: 1px solid rgba(30, 64, 175, 0.1);
    overflow: hidden;
}

.map-svg {
    width: 100%;
    height: 100%;
}

/* ============================================
   摄像头卡片
   ============================================ */
.camera-container {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8eef7 100%);
    border-radius: 8px;
    border: 2px dashed #1e40af;
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #1e40af;
}

.camera-placeholder svg {
    opacity: 0.5;
}

.camera-placeholder p {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.placeholder-text {
    font-size: 12px;
    color: #999;
    font-weight: 400;
}

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 1400px) {
    .data-panels-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (max-width: 1200px) {
    .dashboard-container {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
    }

    .left-panel {
        flex: 0 0 auto;
        max-height: 300px;
    }

    .right-panel {
        flex: 1;
    }

    .data-panels-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
    }

    .left-panel {
        max-height: 280px;
    }

    .data-panels-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-title {
        font-size: 20px;
    }

    .card-title {
        font-size: 16px;
    }

    .control-buttons {
        gap: 10px;
    }

    .side-buttons {
        gap: 10px;
    }

    .control-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* ============================================
   滚动条美化
   ============================================ */
.left-panel::-webkit-scrollbar,
.right-panel::-webkit-scrollbar {
    width: 8px;
}

.left-panel::-webkit-scrollbar-track,
.right-panel::-webkit-scrollbar-track {
    background: transparent;
}

.left-panel::-webkit-scrollbar-thumb,
.right-panel::-webkit-scrollbar-thumb {
    background: #1e40af;
    border-radius: 4px;
}

.left-panel::-webkit-scrollbar-thumb:hover,
.right-panel::-webkit-scrollbar-thumb:hover {
    background: #1e3a8a;
}

