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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #1a1a2e;
    color: #eee;
    min-height: 100vh;
}

header {
    background: #16213e;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-btn {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.nav-btn:hover {
    background: #3498db;
    color: #fff;
}

#status-summary {
    display: flex;
    gap: 1rem;
}

.status-badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.status-badge.online {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
}

.status-badge.offline {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

main {
    padding: 2rem;
    max-width: 1600px;
    margin: 0 auto;
}

#weighbridges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.weighbridge-card {
    background: #16213e;
    border-radius: 12px;
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.weighbridge-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.weighbridge-card.offline {
    opacity: 0.6;
    border: 2px solid #e74c3c;
}

.weighbridge-card .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.weighbridge-card .id {
    font-size: 0.85rem;
    color: #888;
}

.weighbridge-card .name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.weighbridge-card .status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.weighbridge-card .status-indicator.online {
    background: #2ecc71;
}

.weighbridge-card .status-indicator.offline {
    background: #e74c3c;
    animation: none;
}

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

.weighbridge-card .weight {
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
    margin: 0.5rem 0;
}

.weighbridge-card .unit {
    font-size: 1.2rem;
    color: #888;
    margin-left: 0.25rem;
}

.weighbridge-card .stable-indicator {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.weighbridge-card .stable-indicator.stable {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
}

.weighbridge-card .stable-indicator.unstable {
    background: rgba(241, 196, 15, 0.2);
    color: #f1c40f;
}

.weighbridge-card .last-update {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: #666;
}

#events-section {
    background: #16213e;
    border-radius: 12px;
    padding: 1.5rem;
}

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

.section-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.btn-secondary {
    background: transparent;
    border: 1px solid #444;
    color: #888;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    border-color: #666;
    color: #fff;
}

#events-list {
    max-height: 300px;
    overflow-y: auto;
}

.event-item {
    display: flex;
    gap: 1rem;
    padding: 0.75rem;
    border-bottom: 1px solid #222;
    font-size: 0.9rem;
}

.event-item:last-child {
    border-bottom: none;
}

.event-item .time {
    color: #666;
    min-width: 80px;
}

.event-item .icon {
    font-size: 1rem;
}

.event-item .message {
    flex: 1;
}

.event-item.online .icon { color: #2ecc71; }
.event-item.offline .icon { color: #e74c3c; }
.event-item.warning .icon { color: #f1c40f; }

footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #16213e;
    padding: 0.75rem 2rem;
    font-size: 0.85rem;
    color: #666;
    border-top: 1px solid #222;
}

#connection-status.connected { color: #2ecc71; }
#connection-status.disconnected { color: #e74c3c; }
#connection-status.reconnecting { color: #f1c40f; }

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

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

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

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

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}
