* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2196F3;
    --success: #4CAF50;
    --warning: #FF9800;
    --danger: #f44336;
    --dark: #1a1a1a;
    --light: #f5f5f5;
    --border: #ddd;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #0a0e27;
    color: #fff;
    height: 100%;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #333;
}

header h1 {
    font-size: 28px;
    font-weight: 600;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #999;
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: #4CAF50;
}

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

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.grid-full {
    display: grid;
    grid-template-columns: 1fr;
}

.card {
    background: #1a1a2e;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.card h2 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #fff;
}

/* Battery Card */
.battery-display {
    display: flex;
    gap: 15px;
    align-items: center;
}

.battery-bar {
    flex: 1;
    height: 40px;
    background: #333;
    border-radius: 20px;
    overflow: hidden;
    border: 2px solid #555;
}

.battery-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    width: 100%;
    transition: width 0.3s ease;
}

.battery-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}

.battery-text span:first-child {
    font-size: 24px;
    font-weight: bold;
}

.subtitle {
    font-size: 12px;
    color: #999;
}

/* State Card */
.state-display {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.state-badge {
    display: inline-block;
    padding: 8px 16px;
    background: #2196F3;
    border-radius: 20px;
    font-weight: bold;
    text-align: center;
}

.sensor-health {
    display: flex;
    justify-content: space-around;
    gap: 10px;
}

.health-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 16px;
}

.health-ok {
    color: #4CAF50;
}

.health-error {
    color: #f44336;
}

/* Motors Card */
.motors-display {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.motor-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.motor-item label {
    min-width: 50px;
    font-weight: 600;
}

.motor-meter {
    flex: 1;
    height: 30px;
    background: #333;
    border-radius: 15px;
    overflow: hidden;
    border: 1px solid #555;
}

.motor-bar {
    height: 100%;
    background: linear-gradient(90deg, #FF9800, #F44336);
    width: 0%;
    transition: width 0.2s ease;
}

.motor-item span:last-child {
    min-width: 70px;
    text-align: right;
    font-size: 12px;
    color: #999;
}

/* WiFi Card */
.wifi-display {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px;
}

.wifi-icon {
    font-size: 40px;
}

.wifi-text {
    display: flex;
    flex-direction: column;
}

.wifi-text span:first-child {
    font-size: 20px;
    font-weight: bold;
}

/* Map Card */
.map-display {
    width: 100%;
    height: 300px;
    background: #0a0e27;
    border: 1px solid #333;
    border-radius: 4px;
}

.map-info {
    margin-top: 10px;
    font-size: 12px;
    color: #999;
}

/* Events Card */
.event-list {
    max-height: 300px;
    overflow-y: auto;
}

.event-item {
    padding: 10px;
    margin-bottom: 8px;
    background: #0a0e27;
    border-left: 3px solid #2196F3;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.4;
}

.event-time {
    color: #999;
    font-size: 11px;
}

.placeholder {
    color: #666;
    text-align: center;
    padding: 20px;
}

footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #333;
    color: #999;
    font-size: 12px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .map-display {
        height: 250px;
    }

    .container {
        padding: 10px;
    }

    .card {
        padding: 15px;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a2e;
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #666;
}
