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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a2e;
    color: #e0e0e0;
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    height: 100vh;
}

/* Sidebar */
#sidebar {
    width: 320px;
    min-width: 320px;
    background: #16213e;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    border-right: 1px solid #0f3460;
}

.sidebar-header {
    padding: 20px;
    background: #0f3460;
    text-align: center;
}

.sidebar-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: #00d4ff;
    letter-spacing: 4px;
}

.subtitle {
    font-size: 11px;
    color: #7f8c8d;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.server-status {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    border-bottom: 1px solid #0f3460;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online {
    background: #2ecc71;
    box-shadow: 0 0 6px #2ecc71;
}

.status-dot.offline {
    background: #e74c3c;
    box-shadow: 0 0 6px #e74c3c;
}

.lang-switcher {
    padding: 8px 20px;
    border-bottom: 1px solid #0f3460;
    display: flex;
    justify-content: flex-end;
}

.lang-switcher select {
    background: #1a1a2e;
    color: #e0e0e0;
    border: 1px solid #0f3460;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
    outline: none;
}

.lang-switcher select:hover {
    border-color: #00d4ff;
}

.section-title {
    padding: 12px 20px 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #7f8c8d;
    border-top: 1px solid #0f3460;
}

/* Device list */
#device-list {
    padding: 0 12px;
}

.device-card {
    padding: 12px;
    margin-bottom: 8px;
    background: #1a1a2e;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    border: 1px solid transparent;
}

.device-card:hover {
    background: #0f3460;
}

.device-card.selected {
    border-color: #00d4ff;
}

.device-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.device-name {
    font-size: 14px;
    font-weight: 600;
}

.device-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.device-id {
    font-size: 11px;
    color: #7f8c8d;
}

.btn-poweroff {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.4);
    border-radius: 4px;
    width: 24px;
    height: 24px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s;
    line-height: 1;
}

.btn-poweroff:hover {
    background: #e74c3c;
    color: #fff;
}

.device-meta {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: #95a5a6;
}

.device-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.battery-bar {
    width: 30px;
    height: 10px;
    background: #2c3e50;
    border-radius: 3px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
}

.battery-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

.battery-fill.high { background: #2ecc71; }
.battery-fill.medium { background: #f39c12; }
.battery-fill.low { background: #e74c3c; }

/* Alarm list */
#alarm-list {
    padding: 0 12px 12px;
}

.alarm-item {
    padding: 8px 12px;
    margin-bottom: 4px;
    background: rgba(231, 76, 60, 0.15);
    border-radius: 6px;
    font-size: 12px;
    border-left: 3px solid #e74c3c;
}

.alarm-item .alarm-type {
    font-weight: 600;
    color: #e74c3c;
}

.alarm-item .alarm-time {
    color: #7f8c8d;
    font-size: 10px;
}

.no-data {
    padding: 12px;
    text-align: center;
    font-size: 12px;
    color: #5a6a7a;
}

/* Map */
#map-container {
    flex: 1;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
}

/* Leaflet popup */
.leaflet-popup-content-wrapper {
    background: #16213e;
    color: #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.leaflet-popup-tip {
    background: #16213e;
}

.popup-content {
    font-size: 12px;
    line-height: 1.6;
}

.popup-content .device-popup-name {
    font-size: 14px;
    font-weight: 700;
    color: #00d4ff;
    margin-bottom: 4px;
}

.popup-content .popup-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.popup-content .popup-label {
    color: #7f8c8d;
}

@media (max-width: 768px) {
    #app {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
        min-width: auto;
        max-height: 40vh;
    }
}
